com.jgraph.layout

Class JGraphCompoundLayout

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 Summary
protected Listlayouts
Holds all layouts.
Constructor Summary
JGraphCompoundLayout()
Default constructor
JGraphCompoundLayout(JGraphLayout[] layouts)
Constructs a compound layout consisting of the specified first- and secondStep.
Method Summary
voidadd(JGraphLayout layout)
Adds a layout to layouts.
ListgetLayouts()
Returns the list of layouts.
voidremove(JGraphLayout layout)
Removes a layout from layouts
voidrun(JGraphFacade graph)
Runs all layouts in the order they were inserted.

Field Detail

layouts

protected List layouts
Holds all layouts.

Constructor Detail

JGraphCompoundLayout

public JGraphCompoundLayout()
Default constructor

JGraphCompoundLayout

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

Method Detail

add

public void add(JGraphLayout layout)
Adds a layout to layouts.

Parameters: layout The layout to add.

getLayouts

public List getLayouts()
Returns the list of layouts.

Returns: Returns the list of layouts.

remove

public void remove(JGraphLayout layout)
Removes a layout from layouts

Parameters: layout The layout to remove.

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.
Copyright (C) 2001-2009 JGraph Ltd. All rights reserved.