Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: BeanValidation 2.0 integration with JavaFX
PostPosted: Fri Nov 17, 2017 5:00 am 
Newbie

Joined: Thu Nov 16, 2017 12:11 pm
Posts: 1
How do I integrate Bean Validation with JavaFX?

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:
Code:
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...
}


thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.