}
@Override
protected void bind(final FXFormNode fxFormNode) {
viewChangeListener = new ChangeListener() {
public void changed(ObservableValue observableValue, Object o, Object o1) {
try {
Adapter adapter = annotationAdapterProvider.getAdapter(getElement().getType(), getNode().getProperty().getClass(), getElement(), getNode());
if (adapter == null) {
adapter = getFxForm().getAdapterProvider().getAdapter(getElement().getType(), getNode().getProperty().getClass(), getElement(), getNode());
}
Object newValue = propertyElementValidator.adapt(o1, adapter);
propertyElementValidator.validate(newValue);
if (!propertyElementValidator.isInvalid()) {
if (!((PropertyElement) getElement()).isBound()) {
((PropertyElement) getElement()).setValue(newValue);
}
}
} catch (AdapterException e) {
// The input value can not be adapted as model value
// Nothing to do, a constraint violation should have been reported by the PropertyElementValidator
}
}
};
fxFormNode.getProperty().addListener(viewChangeListener);
modelChangeListener = new ChangeListener() {
public void changed(ObservableValue observableValue, Object o, Object o1) {
updateView(o1, fxFormNode);
// The element value was updated, so request a class level check again
getFxForm().getClassLevelValidator().validate();
}