Monday, November 3, 2014

Automagical JavaFX2 Beans

FX Serials allows your traditional Java Beans to play in the new JavaFX scene.

Why?

JavaFX 2.0 introduced the JavaFX Beans specification that adds properties support to Java objects through the help of the properties classes from the JavaFX 2.0 properties and bindings framework. This allows the JavaFX GUI to bind its controls with the data model without the need for extra binding frameworks.
Although properties support has been long awaited in Java, the adoption of the new JavaFX2 Beans by enterprise application developers faces two challenges:
  1. For new applications, there is the questionable need for binding or observing a property on the server side, together with the additional dependencies and performance overhead needed to handle the extended domain model (see James Denvir's One Bean to Bind Them All post);
  2. For existing applications, there is the need to re-code the domain model in order to accommodate the new specification.
On the one hand, It would help the decision for new applications if there were some successful case studies. And on the other hand, facilitating the move for existing applications would help create some of those case studies.

How about a solution where you have traditional java beans on the server side which are "automagically" transformed into JavaFX2 Beans on the client side? - The concerns in 1 would be mute and there would be no need to re-code the domain model. Cool!

I implemented a first approach to this solution in my latest project: FXSerials. I hope you find it cool too :)

Version 1.0.1 is out and you can add it as a maven dependency with the following coordinates:
<groupid>io.github.juffrou</groupid>

<artifactid>fx-serials</artifactid>

<version>1.0.1</version>

This is still early stages but you can already proxy a class and a bean instance.

Please see the examples at the FXSerials page and check out the source code on Github.
Don't hesitate to drop me a line if you have a question or a suggestion about FXSerials.

No comments:

Post a Comment