Java One 2009 – Day 2
Posted on 07. Jun, 2009 by todd in Java, groovy
Extreme GUI Makeover (Hybrid Swing and JavaFX™ Technology)
In this session, Amy Fowler, Jasper Potts, Paru Somasheka and David Grieve all from Sun took the Swing application that was written for last year’s installment of the GUI Makeover and added a bit of Java/FX. The idea is that there is a bit of a migration path for existing swing applications to Java/FX.
javafx.ext.swing.SwingComponent is the Java/FX component that can be used to wrap any existing swing component. The resultant object is a Node object that can be added to the FX scene graph. This is a decent approach but the biggest drawback is that none of the core elements for Java/FX (like transitions) can be applied to the contents of these kinds of nodes. They showed the CSS skinning approach that can be taken with Java/FX applications. It’s a good idea to separate the style (colour, font, size etc) from the actual components. Lastly Jasper showed an illustration of a an annimation on the Scene Graph.
It was pretty impressive all in all.
Move Your Users: Animation Principles for Great User Experiences
This session was presented by Chet Haas and Romain Guy. They introduced 12 animation principals that are documented in the book. The principals are related to traditional animation (cartoons) but they are very applicable to computer animation as well. They followed up a description of each of the principals with it’s application in building rich user interfaces on desktop applications. They did a great job. The content is something folks should consider when they’re implementing any sort of animation in their applications even things as simple as a fade transition or a scale. It’s really easy to get this stuff wrong and learning from the masters of animation who have been thinking about this stuff for almost a century could make a huge difference in your application.
The 12 principals are:
- Squash and Stretch
- Anticipation
- Staging (poses, camera angle, focus)
- Straight ahead vs. pose to pose (related to transitions)
- Follow through and overlapping action (objects should obey physical reality)
- Slow in and out (non linear timing)
- Arcs (things generally don’t move in a perfectly straight line)
- Secondary Action (an additional action that gives context to the main action)
- Timing
- Exaggeration
- Solid Drawing
- Appeal
One of the sources for their presentation was The Illusion of Life: Disney Animation
The Magic of the JXLayer Component
This session introduced the JXLayer component which is currently a java.net project. JXLayer is a wrapper or more precisely implements the decorator pattern for Swing Components. It has a bunch of different uses including a very lightweight way of disabling compound components, implementing mouse wheel scrolling as well a many other uses. We use this component in our framework quite a bit mostly in and around our UI security implementation. It’s great and if you write any Swing code and don’t know about this component go have a look. It was also announced in this session that this component is being promoted into JDK 7.
JavaFX™ Programming Language + Groovy = Beauty + Productivity
Dierk König author of Groovy in Action (still the best book on Groovy written to date in my opinion), presented a couple of different approaches to integrate groovy with Java/FX. One strategy is to use Java/FX for client code and then use a REST layer to have the Java/FX client talk to a back end written in Groovy (or Grails for that matter). This approach is pretty clean but you don’t get to take advantage of any Groovy code on the client.
Both Java/FX and Groovy are JVM languages and ultimately emit bytecode from their respective compilers. It is possible to reference Java/FX components from within Groovy but it’s messy. Andres Almiray has a JavaFX builder in the Griffon Project that begins to make this integration easier but it’s still early days.
The short answer is that true integration at this point in time is hard and will get better as Java/FX matures.
Hudson Community Meet-Up
I’ve been looking into Hudson for a few months now and it just keeps getting better and better. The project lead (Kohsuke Kawaguchi) gave a bit of background and some of the current trends of Hudson. The growth of the product and the community surrounding it since last Java One is very impressive. Plugins for Hudson are one of the distinguishing features. Tom Huybrechts from AGFA Healthcare demoed a new plugin he wrote that implements the JBoss Rules Engine (drools) within Hudson. Layered on top of it is a graphical builder for building workflow steps, gathering input at various points in the workflow and a ton of other cool stuff. It was very impressive and something I want to take a closer look at.
Netbeans project integration was also demoed (actually talked about as there was a technical glitch with the netbeans machine/projector combo). It would be interesting to monitor builds from within Netbeans, kick them off etc. but given that we’re an IntelliJ shop it’s not that relevant. There may be some form of plugin for IntelliJ but the web interface is great so I’m not sure we would even look at it.
Griffon in Depth
Danno Ferrin and James Williams gave an introduction to Griffon which is a Grails inspired framework for building Swing applications in Groovy. It’s still very early days with the project however the project team has leveraged all of the great work from the Grails project in bootstrapping the Griffon project. This is one technology that I’m quite excited about. Writing swing apps in Groovy is possible (see this post for an example) however writing a big Swing app would be quite a lot of work. The idea behind Griffon is to put a framework in place to support building Swing applications with the same sort of velocity the web guys are seeing with frameworks like Grails and Ruby on Rails. The fellows demoed a few applications written in Griffon the most impressive one was Greet which is a Twitter client written in Griffon. I wish the fellows much luck with this project and I’m trying to figure out a way I can help in some small way. Swing and Groovy in the same stack makes me very happy
