Arnaud Denoyelle
Arnaud Denoyelle

Reputation: 31235

Is there an equivalent of GWT editors in JavaFX

Editors are a very useful feature in GWT and I am looking for an equivalent in JavaFX.

Let's say that I have a bean called Person with following properties :

I can create an Editor called PersonEditor with following components :

Then a simple call to the editor allows me to update all UI Components :

Person p = new Person
p.setName("name");
p.setSurname("surname");
p.setAge(28):

personEditor.edit(p);  //Updates all graphical components :)

Person p = personEditor.flush() //Or commit all changes made by the user and give me back the bean.

Is there an equivalent in javaFX? It would avoid me to call each component one by one to set/get their values...

Upvotes: 1

Views: 172

Answers (1)

jewelsea
jewelsea

Reputation: 159416

There is no complete equivalent of GWT Editors in JavaFX 2.x core code, though you can get pretty similar functionality through a combination of the core JavaFX system and supplemental 3rd party libraries.

Of the 3rd party libraries available for JavaFX, FXForm2 is probably the closest in functionality.

Core features to support some of the elements of GWT Editor like functionality are supplied in JavaFX, for example a UIBinder is a bit like an FXMLLoader. Virtual controls in JavaFX such as TableViews also provide similar functionality via Cells with cell factories and PropertyValueFactory that introspects on plain old java objects to provide 2-way UI binding of elements. And of course JavaFX has great built-in property and binding facilities.

ControlsFX provides the PropertySheet control for generating a UI form from a Java object.

Third party libraries can such as JideFX provide form validation facilities.

Upvotes: 2

Related Questions