Hibernate Validator with JavaFX

One of the key features in Exadel Flamingo is that it allows you to use Hibernate Validator based validation on JavaFX UI side.

On the server you can have something like this:

@Entity
@Name ("message")
public class Message {
   @Id @GeneratedValue
   private Long id;

   @Length(min=3, max=40)
   private String text;
   ...
}

This is a simple entity and also a Seam component.

On the JavaFX side all you need to do is this:

var textBox : TextBox = TextBox {};
var errorText: String {};
...
errorText = FlamingoServiceFactory.getHessianEntityValidator().
                    validate("message.text", textBox.text);

message.text – message is Seam component name and text is component property. textBox.text is JavaFX node (widget) whose value we need to validate.

Simple… right?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s