View gist:5822407
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; | |
/** | |
* A simple demo class | |
* Created at 20/06/13 14:44.<br> | |
* |
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; |
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: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: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: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: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: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: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: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) { | |
} |
OlderNewer