Class JGraphCompoundLayout

java.lang.Object
com.jgraph.layout.JGraphCompoundLayout
All Implemented Interfaces:
JGraphLayout

public class JGraphCompoundLayout extends Object implements JGraphLayout
This allows to recursively compose any number of abstract layouts into a compound abstract layout. Note that this is more flexible than a decorator pattern, because you can use different class hierarchies to implement the input (facade) and the layout algorithms, while adhering to the rule that each layout algorithm uses the output of the last layout as its input.
  • Field Details

    • layouts

      protected List layouts
      Holds all layouts.
  • Constructor Details

    • JGraphCompoundLayout

      public JGraphCompoundLayout()
      Default constructor
    • JGraphCompoundLayout

      public JGraphCompoundLayout(JGraphLayout[] layouts)
      Constructs a compound layout consisting of the specified first- and secondStep.
  • Method Details

    • run

      public void run(JGraphFacade graph)
      Runs all layouts in the order they were inserted. Note: The facade encapsulates the input and output of the algorithm, thus ensuring that each algorithm runs on the outcome of preceding algorithm.
      Specified by:
      run in interface JGraphLayout
      Parameters:
      graph - The layout facade that the layout will use as input
    • add

      public void add(JGraphLayout layout)
      Adds a layout to layouts.
      Parameters:
      layout - The layout to add.
    • remove

      public void remove(JGraphLayout layout)
      Removes a layout from layouts
      Parameters:
      layout - The layout to remove.
    • getLayouts

      public List getLayouts()
      Returns the list of layouts.
      Returns:
      Returns the list of layouts.