Proposal for improving nested controller interaction in JavaFX 2.2

Jonathan Giles jonathan.giles at oracle.com
Tue Feb 21 23:34:01 PST 2012


> +1 This brings me to my next question. Once you bring a scene graph into
> memory, what utils/tools does the JavaFX offer or support for traversing
> the scene graph? FXML would benefit from having tools/utils that make it
> easier to query and traverse the scene graph. A DOM like API would be nice.
> A DOM would allow developers to do something like:
> Button submitButton scene.getById("submit_button"); //Gets the object with
> an fx.id == "submit_button"
> submitButton.onMouseClicked(clickHandler);
>
> XPath could be used to traverse and query the graph. The graph can be
> treated like XML and the graph is essentially a DOM instance.

I'll leave Rich to expand on this tomorrow (if he feels compelled), but 
given it appears you're closer to my time zone (NZ) than his (US) (or 
you just work late), I thought I'd quickly respond to point you to the 
Node.lookup(String selector) and Node.lookupAll(String selector) methods 
here:

http://docs.oracle.com/javafx/2.0/api/javafx/scene/Node.html#lookup%28java.lang.String%29

You can also find similar methods in Scene:

http://docs.oracle.com/javafx/2.0/api/javafx/scene/Scene.html#lookup%28java.lang.String%29

-- Jonathan


More information about the openjfx-dev mailing list