JavaFX Family Tree Visualizer Source Code

Tuesday, March 16, 2010

A couple people have requested the source code for this Family Tree Visualizer that I contributed to JFXStudio a while back. You can get the source code here (updated for JavaFX 1.2). Thanks to those who had interest in it.

This visualization foregoes the typical tree structure by displaying a family tree in concentric rings with the younger generations rippling out from the middle (much like a real tree). There’s also some animation to flip back and forth between the two examples (the Baggins line and the House of Durin from Lord of the Rings).Screen shot 2010-03-16 at 12.14.57 PM

Here’s the web start link again for convenience:

One of the great things about JavaFX Script is its declarative syntax, which lends itself to feeling like a DSL for constructing objects.  To illustrate this idea, here’s an excerpt of the DSL-like syntax for creating the family tree from the above screen shot:

FamilyTree {
person: Person {
name:”Durin”
children: [
Person {
name:"Dain I"
children: [
Person {
name: "Tror"
children: [
Person {
name: "Thrain II"
children: [
Person {
name: "Thorin II"
}
Person {
name: "Frerin"
}
Person {
name: "Dis"
children: [
Person {
name: "Fili"
}
Person {
name:"Kili"
}
]
}
]
}
]
}
FamilyTree {
person: Person {
name:"Durin"
children: [
Person {
name:"Dain I"
children: [
Person {
name: "Tror"
children: [
Person {
name: "Thrain II"
children: [
Person { name: "Thorin II" }
Person { name: "Frerin" }
...

While it would be pretty generous to say that this is a full-blown DSL, its conciseness and structure certainly feels a lot like one. In my weaker moments I might even mistake it for a Groovy Builder.

I’ve heard it said many times over that JavaFX is a DSL for creating user interfaces. I may push that a bit farther and say that it’s a DSL for creating just about anything visual.

Next up, in keeping with recycling my old ideas, I’m going to update and release the source code for these tag cloud visualizers for those interested.

Top