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> | |
* |
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; |
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()); | |
} |
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> |
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> |
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()) { |
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 |
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()); | |
} |
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 |
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