Max Katz heads Developer Relations for Appery.io, a cloud-based mobile app platform. He loves trying out new and cool REST APIs in mobile apps. Max is the author of two books “Practical RichFaces” (Apress 2008, 2011), and is a frequent speaker at developer conferences. You can find out what Max is up to on his blog: mkblog.exadel.com and Twitter: @maxkatz. Max is a DZone MVB and is not an employee of DZone and has posted 79 posts at DZone. You can read more from them at their website. View Full User Profile

JavaFX and Seam with Flamingo

06.16.2009
| 30840 views |
  • submit to reddit

This is a two part article (part two) that will demonstrate how to use JavaFX and Seam with the Flamingo RIA framework. The article assumes that you have a basic familiarity with JavaFX and Seam.

JavaFX was released in December 2008 and has received its own measure of approval and disapproval as virtually any major new technology will. I will let you decide for yourself into which camp you belong. I believe JavaFX is a great technology for creating rich Internet applications. It is not going to replace the browser (AJAX applications) but there are instances where JavaFX is a better fit then AJAX-based UIs. Having said that, one critique that I have is that there is virtually no mention of JavaFX and server-side integration. There are numerous examples of shapes, moving and bouncing around. There are also examples of games, but none show any enterprise level server-side integration. Enterprise-level applications are usually form-based. This article shows how Flamingo fills in this gap by letting you easily connect JavaFX with Seam or Spring back-ends.

JavaFX

JavaFX is a new rich client platform for building and delivering Rich Internet Applications that run inside the Java virtual machine. JavaFX Script, one of its main components, is a new declarative language for building rich interfaces. In this article I will refer to JavaFX Script as JavaFX.

Although I said that everything is new, it's not entirely true. One way to look at JavaFX is that it's Applets reborn and better (if you don't remember Applets, then all the better for you). Problems such as challenging runtime installation, runtime download size, and slow application start up time existed with the old Applets, problems which are now fixed in JavaFX. JavaFX provides a declarative way to define the UI, easy runtime installation and update, and quicker application start up time.

Furthermore, JavaFX applications can be deployed and run inside the browser (Java runtime installed as plug-in) via Java Web Start and standalone applications. Given that JavaFX applications are compiled and run inside the Java virtual machine, a richer user experience can be delivered, unlike the standard Web browser scenario where markup (HTML) and JavaScript are interpreted.

JBoss Seam

Seam is a lightweight framework whose goal is to make Java EE development simpler. To be more specific, it greatly simplifies development by unifying JSF and JBoss RichFaces with EJB3, JPA, or Hibernate. Out of the box, Seam works with JSF and RichFaces. (GWT supports also exists.)

JavaFX with Seam

One question that remains unanswered is how we could use JavaFX with Seam. In other words, how does one build a user interface with JavaFX (deploy it as Applet, Web Start, or even standalone) and connect it to a server-side running JBoss Seam? Because JavaFX seamlessly integrates with any Java class (after all, it's based on Java) we could build our own communication protocol to talk to Seam. I'm pretty sure most of you grinned at this idea. Who would want to start building their own communication protocol? Luckily a solution exists. The solution has actually existed since June 2008. Now that JavaFX is more mature and gaining momentum, it is the perfect time to revisit the solution.

Flamingo

Exadel Flamingo is a tool for easily bootstrapping JavaFX with a Seam/Spring back-end. (Remember though, we are concentrating on Seam in this article.) It has three main features:

CRUD Tools

Flamingo provides the ability to quickly generate a CRUD-type application with entities, a database, and a user interface. This is important because putting together a Java EE Web project has become quite a challenge. There are so many different way to configure the project and numerous dependencies to resolve. With Flamingo tools, you can not only create a new project quickly, but also generate pieces of an application on demand over the course of the development cycle. If you have ever used the seam-gen tool to generate a Seam project, well, Flamingo provides similar tooling.

An Integration Library

It serves as the glue between the JavaFX client and the Seam server code working behind the scenes, so the developers can concentrate on business problems instead of writing “plumbing” code. Additionally, communication between JavaFX and Seam is done via binary protocols. (They are the most efficient.) For JavaFX-to-server communication, the Hessian protocol is used.

Published at DZone with permission of Max Katz, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Ayo Bakare replied on Thu, 2009/07/30 - 7:32pm

This makes perfect sence Free Macbook | Free iPhone 3GS

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.