Search |
|||
Tim Boudreau's blogWicket + JavaFX?Posted by timboudreau on July 11, 2009 at 11:29 AM PDT
I've been trying some experiments with embedding JavaFX applets into Wicket components. The results look promising...
Basically, for testing purposes, I've got a JavaFX applet that shows text entry fields - basically a simple format where you see
_______________________________________ | ___________________ | | Your name |__________________|o | | | | ___________________ | | Something |__________________|o | | | | | | ______ ______ | | |Prev | | Next| | | |_____| |_____| | |______________________________________|where the number of pages, their contents and IDs are provided by applet parameters which the applet interprets. And yes, it's got some unobtrusive but cool looking fades and and other JavaFX sexiness. Neater still, it has a provision for server-side validation of the components. This took a little doing (some Java code that starts a background thread, and a Java interface for running it and performing callbacks which is implemented over a JavaFX class) - so when the user stops typing into a field for a few seconds, the applet can communicate with the server (presumably using the same mechanisms as Wicket's built-in AJAX support); the little "o" you see beside each text field shows whether the data is good or not, and while the background part is running (currently just a Thread.sleep() - I wanted to see if I could get this working at all).
But while what I've got is a really rough prototype, it proves you can do it (yes, you can do similar things with AJAX, but well, it's AJAX :-)).
Now, whether the world has any use for this is another question - but it could be interesting to make generic data entry applets with lovely UIs, which could simply be embedded in a Wicket component (and skinned with your site's own CSS - though this actually seems to be a little broken in JavaFX at the moment). Drop the component on your page, and, voila.
Now, of course, the hard side is the server<->client communication - that's next. Or maybe I'll take the weekend off...that would be unusual :-)»
Related Topics >>
Java Enterprise Comments
Comments are listed in date ascending order (oldest first)
Submitted by timboudreau on Mon, 2009-07-20 20:50.
Thinking about it some more, there are some real possibilities here. The JavaFX guys demo'd some Adobe Illustrator plugins at JavaOne. They generate "declarative" (no logic) JavaFX files from Illustrator (so you can do animation paths, the whole ui design in a real graphic design tool). The result *is* JavaFX code; the elements that matter to the programmer are given string IDs (Wicket folks, does *that* sound familiar?). In short, there's a very small impedance mismatch between JavaFX + FXD (I think that was the file extension for those declarative files) and Java + HTML in Wicket.
So, you write a generic JavaFX applet. It implements Wicket's wire communication for AJAX. On the server side, you have a Wicket panel that instantiates that applet. You add forms, labels, whatever to it just like you would to a normal Wicket component (only the IDs have to match up to the FXD file IDs because there is no HTML for it). On the server side you're writing plain Wicket code. The client communicates to the server just as if it were wicket components on a web page communicating with the server via AJAX or a form submit.
As long as you have a designer to do the FXD, you could make embedding slick, sexy JavaFX components into a Wicket web page completely transparent to the server-side programmer - they're just adding labels and text fields and such to a panel like they would any panel (the component, instead of rendering its children, renders them to applet startup parameters). If you had an FXD that matched up its ID hierarchy to an existing Panel's html, you could just swap the superclass and it would work.
This seems so too good to be true, there's got to be something wrong with this idea.
Submitted by knight2castle on Mon, 2009-07-13 05:18.
I think this will be really cool, good job man.
Submitted by fabriziogiudici on Sun, 2009-07-12 01:04.
For instance, in Wicket contributions there is a component to render graphs based on Flash... now that JavaFX 1.2 has got specific APIs for graphs it would make sense that somebody made a JavaFX version. BTW, the Flash component works great: but if you don't know Flash, like me, you can't extend it.
|
CategoriesArchivesJuly 2009
June 2009 May 2009 April 2009 March 2009 February 2009 October 2008 August 2008 June 2008 April 2008 February 2008 January 2008 December 2007 November 2007 October 2007 September 2007 August 2007 July 2007 February 2007 January 2007 November 2006 October 2006 September 2006 August 2006 July 2006 June 2006 May 2006 April 2006 March 2006 February 2006 January 2006 November 2005 October 2005 September 2005 August 2005 July 2005 June 2005 April 2005 March 2005 February 2005 January 2005 December 2004 September 2004 Recent Entries |
||
|
|