View gist:5859633
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (c) 2012, dooApp <contact@dooapp.com> | |
* All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | |
* | |
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | |
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | |
* Neither the name of dooApp nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. | |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER |
View gist:5859630
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private StringBinding nameBinding = new FXStringBinding() { | |
@Override | |
protected void configure() { | |
try { | |
addObservable(aProperty); | |
addObservable(aProperty.get().bProperty()); | |
addObservable(aProperty.get().bProperty().get().cProperty()); | |
addObservable(aProperty.get().bProperty().get().cProperty().get().stringProperty()); | |
} catch (NullPointerException ignored) { | |
} |
View gist:5830210
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.dooapp.FXBinding.model; | |
import com.dooapp.FXBinding.FXDoubleBinding; | |
import javafx.beans.binding.DoubleBinding; | |
import javafx.collections.FXCollections; | |
import javafx.collections.ObservableList; | |
import javafx.scene.chart.XYChart; | |
/** | |
* A simple demo class |
View gist:5830193
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private DoubleBinding averageBinding = new FXDoubleBinding() { | |
/** | |
* This method is called every time the binding is becoming invalid. | |
*/ | |
@Override | |
protected void configure() { | |
addObservable(values()); | |
for (XYChart.Data<Number, Number> d : values()) { | |
addObservable(d.XValueProperty()); | |
} |
View gist:5830151
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.dooapp.FXBinding.model; | |
import javafx.beans.binding.DoubleBinding; | |
import javafx.collections.FXCollections; | |
import javafx.collections.ListChangeListener; | |
import javafx.collections.ObservableList; | |
import javafx.scene.chart.XYChart; | |
/** | |
* A simple demo class |
View gist:5830145
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* the average value of all XValue of Data in values | |
* | |
* @see #values() | |
*/ | |
private DoubleBinding averageBinding = new DoubleBinding() { | |
{ | |
//call #computeValue every time #values() changes | |
super.bind(values()); | |
for (XYChart.Data<Number, Number> d : values()) { |
View gist:5823215
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.dooapp.FXBinding.model; | |
import javafx.beans.binding.DoubleBinding; | |
import javafx.collections.FXCollections; | |
import javafx.collections.ObservableList; | |
import javafx.scene.chart.XYChart; | |
/** | |
* A simple demo class | |
* Created at 20/06/13 14:44.<br> |
View gist:5822656
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.dooapp.FXBinding.model; | |
import javafx.beans.binding.DoubleBinding; | |
import javafx.collections.FXCollections; | |
import javafx.collections.ObservableList; | |
import javafx.scene.chart.XYChart; | |
/** | |
* A simple demo class | |
* Created at 20/06/13 14:44.<br> |
View gist:5822644
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* the average value of all XValue of Data in values | |
* | |
* @see #values() | |
*/ | |
private DoubleBinding averageBinding = new DoubleBinding() { | |
{ | |
//call #computeValue every time #values() changes | |
super.bind(values()); | |
} |
View gist:5822568
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private DoubleBinding averageBinding = new DoubleBinding() { | |
{ | |
//call #computeValue every time #values() changes | |
super.bind(values()); | |
} | |
@Override | |
protected double computeValue() { | |
double result = 0; | |
if (values().isEmpty()) { | |
return result; |