Class JGraphCompoundLayout
java.lang.Object
com.jgraph.layout.JGraphCompoundLayout
- All Implemented Interfaces:
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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface JGraphLayout
JGraphLayout.Stoppable -
Field Summary
FieldsFields inherited from interface JGraphLayout
VERSION -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructorJGraphCompoundLayout(JGraphLayout[] layouts) Constructs a compound layout consisting of the specified first- and secondStep. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(JGraphLayout layout) Adds a layout tolayouts.Returns the list of layouts.voidremove(JGraphLayout layout) Removes a layout fromlayoutsvoidrun(JGraphFacade graph) Runs all layouts in the order they were inserted.
-
Field Details
-
layouts
Holds all layouts.
-
-
Constructor Details
-
JGraphCompoundLayout
public JGraphCompoundLayout()Default constructor -
JGraphCompoundLayout
Constructs a compound layout consisting of the specified first- and secondStep.
-
-
Method Details
-
run
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:
runin interfaceJGraphLayout- Parameters:
graph- The layout facade that the layout will use as input
-
add
Adds a layout tolayouts.- Parameters:
layout- The layout to add.
-
remove
Removes a layout fromlayouts- Parameters:
layout- The layout to remove.
-
getLayouts
-