Skip to content

Instantly share code, notes, and snippets.

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