Class OrganizationalChart

All Implemented Interfaces:
JGraphLayout

public class OrganizationalChart extends JGraphTreeLayout
A simple organisational chart. There are a number of switches that cause children cells to be drawn downwards from a vertex with the edges routed on one side. If any of the conditions are true, the vertical style is used for those vertices, regardless of whether the other conditions are true or false.
  • Field Details

    • vertexDepthOrientationSwitch

      protected int vertexDepthOrientationSwitch
      The level at which nodes in the tree are switched to be vertically oriented. The first layer is 0, it cannot be laid out like this because there can only be 1 root per tree.
    • childrenLimitOrientationSwitch

      protected int childrenLimitOrientationSwitch
      The minimum number of children a parent has before all children are drawn in the vertical orientation style
    • horizontalParentsSet

      protected Set horizontalParentsSet
      A set of cells whose children should be drawn in the vertical style
    • verticalEdgeLeftInset

      protected int verticalEdgeLeftInset
      The inset from left hand side of parent vertices that descending vertical edges are placed
    • verticalEdgeRightInset

      protected int verticalEdgeRightInset
      The inset right from vertical edges that vertices in the vertical style are offset by
  • Constructor Details

    • OrganizationalChart

      public OrganizationalChart()
  • Method Details

    • run

      public void run(JGraphFacade graph)
      The API method used to exercise the layout upon the facade description and produce a separate description of the vertex position and edge routing changes made. It first builds a representation of the tree using the inner tree class by doing a depth first search of the graph from the root. It then lays out the graph using the obtained data
      Specified by:
      run in interface JGraphLayout
      Overrides:
      run in class JGraphTreeLayout
      Parameters:
      graph - the facade describing the graph and its configuration
    • getTreeNode

      protected JGraphTreeLayout.StandardTreeNode getTreeNode(Object cell)
      Obtains the tree node corresponding to the specified cell
      Overrides:
      getTreeNode in class JGraphTreeLayout
      Parameters:
      cell - the cell whose tree node is to be found
      Returns:
      the matching tree node, if any
    • layout

      protected void layout(JGraphTreeLayout.StandardTreeNode node)
      Top-level method that performs actual layout of tree for a specific node. Note this acts upon the internal tree node structure
      Overrides:
      layout in class JGraphTreeLayout
      Parameters:
      node - the tree node to be laid out