20 Sept 2010

Read about JavaFX 1.2, port to 1.3, know about 2.0

As I mentioned in my last post I was asked to review JavaFX 1.2 Application Development Cookbook. Since JavaFX 1.2 is quite old I decided to use 1.3 and port code found in book along the way. Until chapter 4 which is about components and skinning in JavaFX I hadn't any big obstacles. I was hitting Shift+F6 in NetBeans and everything was running fine. First recipe FormDemo of fourth chapter failed to run due to some compile error in Deck class which wasn't even used in FormDemo (I hadn't got time to dig why this is happening) so I decided to port this custom control to 1.3. Below is code that gave me a chance to learn something new about creating controls in JavaFX.

override function create():Node {
        stack.effect = if(enableReflection)Reflection{fraction:0.35} else null;
        stack
}

I knew this is the way you created CustomNode in JavaFX, but Control would have to be a different beast. Its online documentation doesn't tell anything about extending. Searching gave me some interesting information on JavaFX forum and I was directed to CustomNode doc which says, that overriding create function is the way of dinosaurs. Now one should override children variable.

JavaONE 2010

...

And all the above and all the work done by author of the mentioned book and numerous people working on JavaFX Script libraries, components, books, sessions and docs will become deprecated in a year, because Oracle decided to drop JavaFX Script from JavaFX 2.0 release. Instead you will be able to write against JavaFX libraries in Scala, Groovy, Jython, JRuby and plain old Java and there will be WebPane at last. It's a shame JavaFX Script is going to go out of JavaFX platform, but I guess it didn't see a lot adoption, developers wanted more integration with their favorite languages and Oracle being very pragmatic decided there's no point in pushing new language. I felt something was wrong with Tor Norby when listening to JavaPosse and now I know why. I don't think Oracle will tell a word about JavaFX Authoring Tool. There's no need for such a tool in corporate environment. I haven't heard anything about Mobile either, so I guess there's no future for JavaFX Mobile, too. I also wonder what will happen to JavaFX Production Suite, since it produced FXZ files, that were JavaFX Script files zipped. There's also JavaFX Composer affected by depracating FX Script. I'd like to see JavaFX Script being like FXG in Flex 4.

I'm sad that JavaFX Script is going away. I really like the ease of literal objects creation, binding, animation syntax. Maybe it will be fully open sourced (yeah, I know it's Oracle, but I can dream, right?) someone will pick it up and make it as yet another language running on JVM?

Anyway, Oracle is really strengthening Java in RIA space. Especially opening JavaFX libraries to other languages and creating WebPane are great moves.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.