this.style = style;
this.invalidStyle = style + INVALID;
}
public DisposableNode createNode(final ElementController controller) throws NodeCreationException {
final DisposableNode node = factory.createNode(controller);
node.getNode().setId(controller.getElement().getField().getName() + idSuffix);
node.getNode().getStyleClass().add(style);
controller.getConstraintViolations().addListener(new ListChangeListener<ConstraintViolation>() {
public void onChanged(Change<? extends ConstraintViolation> change) {
if (!controller.getConstraintViolations().isEmpty()) {
node.getNode().getStyleClass().add(invalidStyle);
} else {
node.getNode().getStyleClass().remove(invalidStyle);
}
}
});
return node;
}