• Nov
    • 27
    • 2011

JFX Flow early access

Posted by In Uncategorized
This entry is part 7 of 15 in the series Building JEE applications in JavaFX 2.0

I started this blog a few weeks ago with the grand plan of stepping you through the process of building a clean architecture for building JEE, web-style GUI applications using JavaFX 2. As I wrote the first few blogs, I realised that if we stepped through each little twist and turn on the journey to a complete framework we’d be here for a few years. I also started to think that most of you probably don’t care about the details, you just want something that you can use so you can get on with the real job of building your applications and making your users happy.

So, “here’s one I prepared earlier”. The more attentive of you will have already noticed a new new link called ‘JFX Flow‘ in the menu bar above. Go on, click on it. In fact, have a flick through the ‘showcase’ linked to from the main page just to get a feel for what I’m talking about here.

This is an alpha version of a framework I’ve put together with all of my ideas in it for building web-style applications in JavaFX. I’m still fleshing out the documentation (yea, I leave the least fun stuff till last too) The core features are good enough to use right now (I’m using it in two of my projects currently, one which is a decent way along), however some of the supporting features (such as dialogs) are still a little rough around the edges and I can’t guarantee the API for some of these won’t change a little over the next few weeks.

It’s all free and open source. I’ve also tried as much as possible to make it so that you guys can customise bits and pieces without having to rewrite everything. If you want your own funky Browser that’s all in 3D and has flying magical dragons on it, you can write one (assuming you know how to use the javafx.magical.dragon package) and just plug it in.

I’ve deliberately limited JFX Flow to the GUI aspects of a JEE system. It’s goal is to allow you to build GUIs that provide the user with a familiar and enjoyable experience, and at a code level support dependency injection, have nice threading and error handling, and use a clean separation of concerns (view vs control, etc).

You won’t see anything in there specifically for database or server communication however. JFX Flow provides the ‘presentation’ tier only. It has ways to integrate with the back-end tiers but it does not give you an end-to-end JEE stack. JEE is at its best when it provides the developer with the freedom to mix and match technologies at each level of the stack. Specific projects always have their own specific requirements. Sometimes you need to use message queues and XML, sometimes you can make pure-Java RPC calls and can use Hibernate, and sometimes you might have to integrate with something weird like Google’s App Engine, or a legacy mainframe system. JFX Flow aims to give you that power, while making the front-end a bit easier to develop.

I’m guessing a lot of you probably still want to know how to do all that database and server communication stuff though. That’s what the rest of this blog will be about. Now that we’ve got a JavaFX presentation layer for our JEE stack, we can start looking at how this can be used for common scenarios. Those of you already familiar with the business and data layers of the JEE stack can go on ahead, JFX Flow is ready for you to use. The rest of you, stick with me and let’s see what we can come up with. For now have a play with JFX Flow and let me know what you like, and don’t like.

Series Navigation<< Client Server with JavaFX 2 and Hessian (+Guice +FXML)JavaFX and MVP – a smörgåsbord of design patterns >>

5 Comments

  • toni
    December 10, 2011

    hello Dan.

    i tried out all of your posts. great examples to start developing with javafx 2.0 – thanks sharing your experience!! i tried out to integrate jfxflow with the example “client-server with javafx 2 and hessian”. i am stuck somehow with guice and set up the browser:

    FxmlLoader loader = new FxmlLoader();
    DefaultNavigationManager navigationManager = new DefaultNavigationManager();

    HomeController homeActivity = loader.load(“/Home.fxml”);
    homeActivity.setNavigationManager(navigationManager);

    Injector injector = Guice.createInjector(new HelloClientModule());
    HelloController helloController = injector.getInstance(HelloController.class);

    Browser browser = new Browser(navigationManager);

    browser.getPlaceResolvers().add(new RegexPlaceResolver(“home”, homeActivity));
    //everything fine
    browser.getPlaceResolvers().add(new RegexPlaceResolver(“page1″, helloController));
    /* java.lang.NullPointerException
    at com.zenjava.jfxflow.transition.FadeInTransition.setupBeforeAnimation(FadeInTransition.java:22)
    at com.zenjava.jfxflow.control.Browser.transition(Browser.java:356)
    at com.zenjava.jfxflow.control.Browser$4.changed(Browser.java:170)*/

    i would appreciate your help showing me how to use it correctly. thank you in advance!! cheers, toni

  • zonski Author
    December 11, 2011

    Hi,

    This NullPointer could only occur if your helloController.getNode() is returning null. It’s hard to say why this is without seeing your HelloClientModule, but one possibility is that are not loading it using the FxmlLoader? If that doesn’t help, post your HelloClientModule code and we’ll have a look.

    As a general bigger picture thing, ideally you would load all your controllers, your navigation manager and your Browser from your Module, but I assume you are just trying to get one thing working first (which is a good idea). If I get some time then I will post a Guice version of my latest MVP post that includes an example for all this, but that may not be for a little while (tis the season).

    Cheers,
    zonski

  • toni
    December 13, 2011

    Hello zonski

    Thank you for your reply. Indeed, helloController.getNode() returned null. Actually the method wasn’t defined at all. So adding this method solved the problem. I am now trying out you latest post – thanks again for sharing!! Have a great day.

    Cheers, Toni

Leave a Comment