I've been a zone leader with DZone since 2008, and I'm crazy about community. Every day I get to work with the best that JavaScript, HTML5, Android and iOS has to offer, creating apps that truly make at difference, as principal front-end architect at Avego. James is a DZone Zone Leader and has posted 639 posts at DZone. You can read more from them at their website. View Full User Profile

JavaFX In Practice - An Interview With Stephen Chin

01.12.2009
| 14329 views |
  • submit to reddit

I was interested to stumble across WidgetFX recently. It struck me as a good use of the JavaFX technology. A month after the JavaFX 1.0 release, it's good to see innovation and progression in the community. WidgetFX is a desktop widget platform written in the JavaFX Script language. It can run widgets written in either JavaFX Script or Java. I talked with the project lead, Stephen Chin about the WidgetFX project and JavaFX in general.

James Sugrue: Could you introduce yourself, and give us some details on your development history?

Stephen Chin: Sure.  I have been a long-time Java geek since the 1.0 days when synchronization was a dirty word.  My two passions are open-source software and agile development, which dovetail nicely in the Java world.  During the day I strive to create an environment for developers that I would want to work in, and in the evenings I try to contribute back just as much benefit as I derive from open-source projects.


Sugrue: What is the code base like for WidgetFX?

Chin: The WidgetFX codebase was written from the ground up in JavaFX Script, and we try to keep it pretty tight.  Whenever the codebase starts feeling cumbersome it gets a good refactoring, because I am one of those people who will drive twice as far around the mountains rather than sitting through a bad traffic backup.  As anyone who was waiting for the WidgetFX 1.0 release will tell you, quality is a much higher concern than promptness.  ;-)


Sugrue: What is the motivation for WidgetFX?

Chin: To put it simply, writing WidgetFX was a whole lot more productive and fun than it would have been to use an existing framework which requires you to hack HTML and Javascript.  The final push came from a discussion with Joshua Marinacci where we were talking about the need for a desktop widget framework written in JavaFX, and while we both agreed that it was needed, Josh clearly didn't have the time to do it himself.  A few days later (after a super-productive Memorial day holiday), WidgetFX was born.

WidgetFX also fills a very important niche for enterprise widget deployment.  For multiple reasons, including licensing terms, security model issues, and cross-platform support, most desktop widget containers do not meet the requirements to be deployed in a corporate setting.  WidgetFX is an open-source project built on the Java platform, which makes it a perfect fit for companies looking to deploy desktop widgets behind the firewall.


Sugrue: Is the ability to interact with Flash and Flex widgets easy to implement in JavaFX?

The Flash/Flex support in WidgetFX is based on the JDICplus libraries from the brilliant Alexey Utkin, so I can't take all the credit.  However, working out all the browser kinks to embed Flash, make it work in transparent windows, and supporting dragging of Flash widgets was probably one of the longest weeks I've had in a while...

The real value of embedding Flash is that you open up a huge library of existing components and provide a migration path for Java developers already on the Flex train.  I hope Sun sees the same value and provides some native, cross-platform container support for embedding Flash in a future version of JavaFX.


Sugrue: Is it possible to run WidgetFX widgets in Swing applications, and vice versa?

Embedding Swing applications in widgets is possible with a little bit of glue code.  All you need to do is create a JavaFX widget stub that uses SwingComponent.wrap() to embed the Swing UI components.Going the other way is a little more challenging.  There was a good blog post by the dynamic JavaFX trio (Josh, Rich, and Jasper) that explains how to embed JavaFX in Swing through the unsupported JXScene class, but it would be great to have this be part of the core APIs:http://blogs.sun.com/javafx/entry/how_to_use_javafx_in


Sugrue: A month after the launch of JavaFX 1.0, what are your impressions of how the community has adopted it? Is there still a long way to go for JavaFX?

Chin: I have been pleasantly surprised that the Java development community is warming up to JavaFX.  After an initial outcry of pundits spelling doom and gloom for Sun's new RIA platform, I have seen lots of positive responses about the technology from the Java community.I started another open-source project called JFXtras that fills in a lot of the holes and limitations of the JavaFX 1.0 release by providing a complete Grid layout, Dialog support, Declarative Unit Testing, an Asynchronous Worker, and a whole lot more.  I have been surprised at how much interest there has been in JFXtras, both from users and also top-notch open-source developers who are willing to lend a hand.  Among others, Andres Almiray of Groovy GraphicsBuilder fame recently joined the JFXtras project and is the mastermind behind the new custom shape support we will be releasing shortly.


Sugrue: What is your favourite thing about JavaFX?

Chin: I would have to say that I am a bind-a-holic.  It is strangely addictive to be able to hook up your model to your UI without writing event handlers or hand-writing bean synchronization code.  I also use it for doing simple layouts, keeping the UI and model in sync, and even as a pattern for inversion of control (IoC) in JavaFX Script.

I am actually in the process of writing the upcoming Pro JavaFX book together with Jim Weaver and Weiqi Gao.  It has become an outlet for sharing all the things I have learned about JavaFX in writing WidgetFX and working on my other JavaFX projects.


Sugrue: What tips would you give to adopters of JavaFX?

Chin: The JavaFX platform is still young, so use it for what it is good at today, and give it some time to mature.For those who like to live on the bleeding edge, I would recommend they check out the JFXtras project, because it may already have what they need to build a full application, or can always use additional contributors to create components that benefit the whole JavaFX community.


Sugrue: Is there a large community of widget writers for WidgetFX?

Chin: I have been impressed with the folks who have stepped up and taken an active roll so far.  Pär Dahlberg and Ludovic Hochet, the first two widget authors back from the Preview SDK days, were right on the ball in updating their widgets the first week WidgetFX 1.0 was released.  Jim Weaver has also posted a few examples on his blog with more to come.  And I am super-excited about some of the discussion on the WidgetFX mailing list about new widgets in the works.


Sugrue: What are your plans for the future versions of WidgetFX?

Chin: One of the features that is in the works is a seamless browser/desktop experience.  If you remember the famous Sun demo where they drag applets off onto the desktop, and they magically become Web Start applications, think of this as the answer to the question, "So what next?"  Well how about taking that same application and docking it on the WidgetFX sidebar...

There is also a huge queue of enhancements and improvements in the works.  The project issue tracker is a great place to see what else is coming, or to contribute enhancements and ideas.


Sugrue: Do you have any predictions for software development in 2009?

My prediction is that this will be the year that the RIA movement will help reclaim developer sanity.  Forcing all web applications to run inside the limitations of browser scripting languages was a tremendous setback to the modern computing era and sanity of developers across the world.  I have a lot of respect for the intellectual work that has gone into modern AJAX implementations and Javascript code generation libraries, but reproducing decade-old UI paradigms in the browser is not going to advance the computer science field.  JavaFX has the potential to unleash the creativity of everyday developers by providing a platform that is limitless in possibilities.

Comments

Richard Osbaldeston replied on Mon, 2009/01/12 - 10:36am

How do you refactor JavaFX Script? manually? because IDE support seems lacking (so far).

Stephen Chin replied on Mon, 2009/01/12 - 11:09am

Having IDE support for JavaFX refactorings would be sweet, but unfortunately right now it is good old-fashioned search and replace with text editors.  However, the same concepts apply, so just consider it good exercise for your carpals.  :)

Remon Sinnema replied on Tue, 2009/01/13 - 6:15am

What IDE do you use? Netbeans or Eclipse? You can always post feature requests for the Eclipse plugin.

Richard Osbaldeston replied on Tue, 2009/01/13 - 7:06am

Netbeans (well IDEA preferred) but NB is where I'd expect to find the most complete support. Guess in a pinch with refactoring the old-school way is making heavy use of the unit testing support offered in JFXtras?

Comment viewing options

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