Extending a Region to create a JUNG Layout

John Smith John_Smith at symantec.com
Fri May 30 17:55:05 UTC 2014


Much of the internal JavaFX implementation is performed subclassing Region (or Control which is just a Region subclass itself) and overriding layoutChildren, but I'm not aware of any official documentation on the subject other than the sparse stuff in the Javadoc - so no real tutorials.

Maybe try studying some of the JavaFX source which extends Region.

For example, take a look at Axis:
  https://bitbucket.org/openjfxmirrors/openjfx-8-master-rt/src/tip/modules/controls/src/main/java/javafx/scene/chart/Axis.java
  https://bitbucket.org/openjfxmirrors/openjfx-8-master-rt/src/tip/modules/controls/src/main/java/javafx/scene/chart/CategoryAxis.java

It would be nice if Oracle or somebody else produced some documentation on this.   You could create a feature request in Jira (https://javafx-jira.kenai.com) for such documentation or email the documentation team (javasedocs_us at oracle.com), or write a blog or a openjfx wiki article (https://wiki.openjdk.java.net/display/OpenJFX/Main) if you work out some good techniques.

John

-----Original Message-----
From: openjfx-dev [mailto:openjfx-dev-bounces at openjdk.java.net] On Behalf Of Jeffrey Guenther
Sent: Thursday, May 29, 2014 11:45 PM
To: openjfx-dev at openjdk.java.net
Subject: Extending a Region to create a JUNG Layout

Hi,

I'm in the midst of exploring how I might port JUNG(
http://jung.sourceforge.net/index.html) to JavaFX. JUNG is a graph/layout tool my lab uses for some of their data visualizations. With the release of JavaFX 2, we've started building our prototypes in JavaFX.

Rather than use the JFXSwingPanel, I want to try modifying the JUNG to work "natively" in JavaFX. In the long term, I'd like to see JUNG ported completely to JavaFX using properties, CSS and the like.

I've built a quick demo (
https://gist.github.com/jrguenther/9d0c37329f9928a2b56e) and need help going forward. I've been reading the docs and hitting google, but I think I need more info.

Can someone point me to a detailed explanation of how to extend Region to create my own layout?
In particular, how can I get a region to relayout it's children when it's being resized?
When does a the region's parent call layoutChildren()?
If the height and width of the region are set to Double.MAX_VALUE indicating the area can grow infinitely, how does the region know what size to set itself to?

Thanks,
Jeff


More information about the openjfx-dev mailing list