This demo visualizes an organization chart. This comprehensive demo shows many aspects of yFiles. In particular it shows how to
javax.swing.tree.TreeModel
y.view.NavigationMode
view modejavax.swing.JTree
and y.view.Graph2D
y.layout.tree.GenericTreeLayouter
to make it a perfect match for laying out organization chartsy.view.Graph2DView
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.OrgChartTreeModel | TreeModel that uses Employee as TreeNodes. |
demo.view.orgchart.JOrgChart | Organization 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.JTreeChart | Tree chart component that allows to display local views of the tree. |
demo.view.orgchart.KeyboardNavigation | Factory class that provides java.awt.event.KeyListener implementations suitable for
navigating within Graph2DView.
|
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.
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.