JavaFX Family Tree Visualizer Source Code

Tuesday, March 16th, 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.

Tags:

4 Responses to “JavaFX Family Tree Visualizer Source Code”

  1. Bill wrote:
    March 16th, 2010 at 3:06 pm |

    Nice! – Timely as I am listening through the LOTR trilogy on CD.

  2. uberVU - social comments wrote:
    March 16th, 2010 at 7:34 pm |

    Social comments and analytics for this post…

    This post was mentioned on Twitter by stenkarl: Source code available for JavaFX Family Tree Visualizer: http://blogs.citytechinc.com/sanderson/?p=328…

  3. JavaFX Links of the week, March 22 // JavaFX News, Demos and Insight // FX Experience wrote:
    March 21st, 2010 at 4:25 pm |

    [...] Anderson has released the source code for a JavaFX family tree visualiser and a tag [...]

  4. Java desktop links of the week, March 22 | Jonathan Giles wrote:
    March 21st, 2010 at 4:26 pm |

    [...] Anderson has released the source code for a JavaFX family tree visualiser and a tag [...]

Leave a Reply