I would like to make a bidirectional bind between the entity field and the javaFx controllers. In this scenario how could I validate fields using Bean Validation?
Ex:
public class Category{ @NotNull(message = "Name can't be null) @Size(max = 255, min=3, message = "Size name must be between 255 and 3") private StringProperty name = new SimpleStringProperty(); //... getters & setters }
//some fx Controller... public class CategoryController{ @FXML private TextField textFiledCategoryName; private Category category;
@FXML public void initialize() { category = new Category(); textFiledCategoryName.textProperty().bindBidirectional(category.nameProperty()); } //other code... }