dooApp/FXForm2 — Issue #4: Boolean Properties do not update properly on change.
Author: Stelk
Created: 2011-11-02 03:44:31+00:00
State: open

Looks like there is a bug in the BooleanPropertyDelegate that is preventing Boolean fields in a Form from being updated properly when changed.

checkBox.selectedProperty().addListener(controllerListener);

should probably be changed to

checkBox.selectedProperty().addListener(checkBoxListenerr);

in the following code.

public class BooleanPropertyDelegate implements NodeFactory> {

public DisposableNode createNode(final PropertyElementController controller) {
final CheckBox checkBox = new CheckBox();
checkBox.setSelected(controller.getValue());
final ChangeListener controllerListener = new ChangeListener() {
public void changed(ObservableValue observableValue, Boolean aBoolean, Boolean aBoolean1) {
checkBox.setSelected(aBoolean1);
}
};
controller.addListener(controllerListener);
final ChangeListener checkBoxListener = new ChangeListener() {
public void changed(ObservableValue observableValue, Boolean aBoolean, Boolean aBoolean1) {
controller.setValue(aBoolean1);
}
};
checkBox.selectedProperty().addListener(controllerListener);
return new DisposableNodeWrapper(checkBox, new Callback() {
public Void call(Node node) {
checkBox.selectedProperty().removeListener(checkBoxListener);
controller.removeListener(controllerListener);
return null;
}
});
}
}