[bv-dev] Bean Validation and JavaFX

Guillaume Smet guillaume.smet at gmail.com
Fri Nov 17 08:40:27 EST 2017


Hi Rafael,

Hendrik contributed a few JavaFX examples here:
https://github.com/hibernate/hibernate-demos/tree/master/hibernate-validator/javafx-validation-example
.

I think they will probably help you getting it working.

-- 
Guillaume

On Fri, Nov 17, 2017 at 2:05 PM, Rafael A P Nascimento <rfx.go.on at gmail.com>
wrote:

> Hi all!
> 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:
> 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!
> --
> *Rafael A P Nascimento *
>
> *finalexception.blogspot.com <http://finalexception.blogspot.com.br>*
>
>
> _______________________________________________
> beanvalidation-dev mailing list
> beanvalidation-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/beanvalidation-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/beanvalidation-dev/attachments/20171117/02af211b/attachment.html 


More information about the beanvalidation-dev mailing list