yFiles Tutorial Organization Chart Demo

This demo visualizes an organization chart. This comprehensive demo shows many aspects of yFiles. In particular it shows how to

This demo is composed of multiple classes. Class demo.view.OrgChartDemo is the organization chart application and driver class that organizes the UI elements and makes use of the swing component demo.view.orgchart.JOrgChart. The model data used in this sample is represented by the Swing tree model demo.view.orgchart.OrgChartTreeModel. Class demo.view.orgchart.JOrgChart builds upon the more generic tree chart component demo.view.orgchart.JTreeChart. In a nutshell, JTreeChart visualizes a generic TreeModel and includes all the viewer logic, while JOrgChart visualizes a OrgChartTreeModel and customizes the look and feel of the component. Also it customizes the look and feel of the component to make it suitable for organization charts.

Directory resources contains the XML-based organization chart sample file, a help file, and application icons.

Class Description
demo.view.orgchart.OrgChartDemo The main demo program in this tutorial.
demo.view.orgchart.OrgChartTreeModelTreeModel that uses Employee as TreeNodes.
demo.view.orgchart.JOrgChartOrganization chart component that builds upon the more generic tree chart component demo.view.orgchart.JTreeChart. It visualizes a demo.view.orgchart.OrgChartTreeModel. Also it customizes the look and feel of the component to make it suitable for organization charts. TreeModel that uses Employee as TreeNodes
demo.view.orgchart.JTreeChartTree chart component that allows to display local views of the tree.
demo.view.orgchart.KeyboardNavigationFactory class that provides java.awt.event.KeyListener implementations suitable for navigating within Graph2DView.

Running the Demos

From Within an IDE

Set <yFilesDir>/src as your source directory. Then add <yFilesDir>/lib/y.jar and the source folder <yFilesDir>/src to your classpath. Now you should be ready to compile and run all executable demo classes.

With Ant

First make sure you have the build tool Ant installed on your system. Now you can use the demo build script build.xml located in <yFilesDir>/src/demo to launch each demo by specifying its simple class name as a target. Alternatively, launch the interactive demo driver by specifying run as target to conveniently access all demos.