javafx 2.x

Javafx is looking pretty good. I still have concerns about its innovativeness especially when it comes to programming productivity.

Regardless, some notes for programmers....

When trying to locate resources, it is often necessary to search the node tree, which I think is the logical node tree, for resources. A couple of functions, similar to what you find in WPF are useful.

* Find a resource. Throw an illegal argument exception if its not found.
public static Object findResource(Node start, Object key) {
if (start == null)
return null;
if (start.getProperties().containsKey(key)) {
return start.getProperties().get(key);
if (start.getParent() != null)
return findResource(start.getParent(), key);
throw new IllegalArgumentException("Could not find resource with key "
+ key + " starting at node " + start);

* Try and find a resource. Do NOT throw an exception if its not found.
* @param key
* @param start
* @return
public static Object tryfindResource(Node start, Object key) {
try {
return findResource(start, key);
} catch (IllegalArgumentException e) {
// Do nothing!
return null;
These allow us to search up and down the tree to find resources conveniently. You can for example, store cell factories with match criteria so that a cell factory can be automatically located for a particular object. This gives you some flavors of runtime configurability which makes WPF/XAML so nice. You can add this an extensions module in groovy and have these methods on all the Node objects (as long as you are in groovy of course or use aspectj).


Popular posts from this blog

zio layers and framework integration

typescript and react types

dotty+scala.js+async: interesting options