Search this API

y.layout
Class CanonicMultiStageLayouter

java.lang.Object
  extended by y.layout.CanonicMultiStageLayouter
All Implemented Interfaces:
Layouter
Direct Known Subclasses:
ARTreeLayouter, BalloonLayouter, CircularLayouter, DirectedOrthogonalLayouter, FamilyTreeLayouter, GenericTreeLayouter, GraphTransformer, GRIP, HierarchicLayouter, HierarchicLayouter, HVTreeLayouter, IncrementalHierarchicLayouter, OrganicLayouter, OrthogonalGroupLayouter, OrthogonalLayouter, RadialLayouter, RandomLayouter, SeriesParallelLayouter, SingleCycleLayouter, SmartOrganicLayouter, TreeLayouter

public abstract class CanonicMultiStageLayouter
extends java.lang.Object
implements Layouter

An abstract base class for layout algorithms that provides services to simplify and decompose the input graph before it is passed to the core layout algorithm itself.

Subclasses of this layout algorithm have to provide implementations for the abstract methods:

Concept

This class provides a configurable pipeline that contains LayoutStages that add preprocessing steps and/or postprocessing steps to the layout algorithm. CanonicMultiStageLayouter provides some predefined LayoutStages, that simplify the input graph for the layout algorithm and complement the result. It is also possible to add custom LayoutStages which are executed before or after the predefined ones.

Each LayoutStage in the pipeline wraps its successor. When the layout pipeline is processed, the preprocessing code of the preceding LayoutStage is executed before the code in the current LayoutStage while the postprocessing code is executed afterwards.

The pipeline of predefined LayoutStages of CanonicMultiStageLayouter (when all are activated) causes the following sequence of steps:

  1. Hides the group nodes.
  2. Hides all except for the induced subgraph.
  3. Decomposes the graph into its connected components. Performs steps 4-12 on each component.
  4. Prepares for label placement.
  5. Prepares the layout for an orientation change.
  6. Hides self-loops.
  7. Hides parallel edges.
  8. Invokes the layout algorithm on the simplified graph.
  9. Un-hides and routes parallel edges.
  10. Un-hides and routes self-loops.
  11. Completes orientation change of the layout.
  12. Assigns label positions.
  13. Arranges the connected components of the graph.
  14. Un-hides non-induced subgraph.
  15. Un-hides the group nodes.

In order to take effect, a stage that is not already activated by default needs to be activated using the corresponding method, e.g., setGroupNodeHidingEnabled(boolean). Vice versa, a stage can also be deactivated, if necessary.

 

Field Summary
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, NODE_TYPE_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
CanonicMultiStageLayouter()
          Creates a new CanonicMultiStageLayouter instance with default settings.
 
Method Summary
 void appendStage(LayoutStage stage)
          Appends the given LayoutStage to the layout pipeline.
 GraphLayout calcLayout(GraphInterface graph, GraphLayout layout)
          Calculates a layout for the given GraphInterface and GraphLayout instances.
 GraphLayout calcLayout(LayoutGraph graph)
          Calculates a layout for the given input graph.
 boolean canLayout(LayoutGraph graph)
          Checks whether or not the given graph can be handled by this layout algorithm.
protected abstract  boolean canLayoutCore(LayoutGraph graph)
          Checks whether or not the core layout algorithm can layout the input graph.
protected  void checkGroupNodeSize(GraphLayout layout, java.lang.Object node)
          Checks the given group node for zero or negative width/height.
protected  void checkNodeSize(GraphLayout layout, java.lang.Object node)
          Checks the given node for zero or negative width/height.
 void doLayout(GraphInterface graph, GraphLayout layout)
          Calculates a layout for the given graph and writes it back to the given GraphLayout instance.
 void doLayout(LayoutGraph graph)
          Calculates a layout for the given graph and applies it directly to the graph.
protected abstract  void doLayoutCore(LayoutGraph graph)
          Invokes the core layout algorithm.
 void enableOnlyCore()
          Deactivates all predefined LayoutStages so that upon doLayout(y.layout.LayoutGraph) only the layout algorithm will be executed.
 LayoutStage getComponentLayouter()
          Returns the LayoutStage that arranges the connected components of an input graph.
 LayoutStage getGroupNodeHider()
          Returns the LayoutStage that hides the group nodes of the input graph.
 LayoutStage getLabelLayouter()
          Returns the LayoutStage that places the labels of the input graph.
 byte getLayoutOrientation()
          Returns the main orientation of the layout.
 LayoutStage getOrientationLayouter()
          Returns the LayoutStage that modifies the orientation of a computed layout.
 LayoutStage getParallelEdgeLayouter()
          Returns the LayoutStage that routes parallel edges.
 LayoutStage getSelfLoopLayouter()
          Returns the LayoutStage that routes self-loops.
 LayoutStage getSubgraphLayouter()
          Returns the LayoutStage that constrains the layout process to a subgraph of the input graph.
 boolean isComponentLayouterEnabled()
          Returns whether or not the LayoutStage used for arranging the components of the graph is activated.
 boolean isGroupNodeHidingEnabled()
          Returns whether or not the LayoutStage used for hiding group nodes is activated.
 boolean isLabelLayouterEnabled()
          Returns whether or not the LayoutStage used for placing the labels of the input graph is activated.
 boolean isOrientationLayouterEnabled()
          Returns whether or not the LayoutStage that modifies the orientation of the layout is activated.
 boolean isParallelEdgeLayouterEnabled()
          Returns whether or not the LayoutStage used for routing parallel edges is activated.
 boolean isSelfLoopLayouterEnabled()
          Returns whether or not the LayoutStage used for routing self-loops is activated.
 boolean isSubgraphLayouterEnabled()
          Returns whether or not the LayoutStage used for constraining the layout process to a subgraph of the input graph is activated.
 void prependStage(LayoutStage stage)
          Prepends the given LayoutStage to the layout pipeline.
 void removeStage(LayoutStage stage)
          Removes the given LayoutStage from the layout pipeline.
 void setComponentLayouter(LayoutStage layouter)
          Specifies the LayoutStage that arranges the connected components of an input graph.
 void setComponentLayouterEnabled(boolean enabled)
          Specifies whether or not the LayoutStage used for arranging the components of the graph is activated.
 void setGroupNodeHider(LayoutStage layouter)
          Specifies the LayoutStage that hides the group nodes of the input graph.
 void setGroupNodeHidingEnabled(boolean groupNodeHidingEnabled)
          Specifies whether or not the LayoutStage used for hiding group nodes is activated.
 void setLabelLayouter(LayoutStage labeler)
          Specifies the LayoutStage that places the labels of the input graph.
 void setLabelLayouterEnabled(boolean enabled)
          Specifies whether or not the LayoutStage used for placing the labels of the input graph is activated.
 void setLayoutOrientation(byte orientation)
          Specifies the main orientation of the layout.
 void setOrientationLayouter(LayoutStage layouter)
          Specifies the LayoutStage that modifies the orientation of a computed layout.
 void setOrientationLayouterEnabled(boolean enabled)
          Specifies whether or not the LayoutStage that modifies the orientation of the layout is activated.
 void setParallelEdgeLayouter(LayoutStage layouter)
          Specifies the LayoutStage that routes parallel edges.
 void setParallelEdgeLayouterEnabled(boolean enabled)
          Specifies whether or not the LayoutStage used for routing parallel edges is activated.
 void setSelfLoopLayouter(LayoutStage layouter)
          Specifies the LayoutStage that routes self-loops.
 void setSelfLoopLayouterEnabled(boolean enabled)
          Specifies whether or not the LayoutStage used for routing self-loops is activated.
 void setSubgraphLayouter(LayoutStage layouter)
          Specifies the LayoutStage that constrains the layout process to a subgraph of the input graph.
 void setSubgraphLayouterEnabled(boolean enabled)
          Specifies whether or not the LayoutStage used for constraining the layout process to a subgraph of the input graph is activated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CanonicMultiStageLayouter

public CanonicMultiStageLayouter()
Creates a new CanonicMultiStageLayouter instance with default settings.

Method Detail

doLayoutCore

protected abstract void doLayoutCore(LayoutGraph graph)
Invokes the core layout algorithm.

This method should be implemented by subclasses in order to perform the layout routine of the layout algorithm.

Parameters:
graph - the input graph

canLayoutCore

protected abstract boolean canLayoutCore(LayoutGraph graph)
Checks whether or not the core layout algorithm can layout the input graph.

This method should be implemented by subclasses such that it determines whether or not the core layout algorithm accepts the input graph.

Parameters:
graph - the input graph
Returns:
true if the core layout algorithm can handle the input graph, false otherwise

checkNodeSize

protected void checkNodeSize(GraphLayout layout,
                             java.lang.Object node)
                      throws java.lang.IllegalArgumentException
Checks the given node for zero or negative width/height.

This method is called before the invocation of the core layouter for each normal node of the input graph. It may be overridden in order to obtain a custom implementation of the node size check or to remove it entirely.

Parameters:
layout - the GraphLayout instance
node - the node object
Throws:
java.lang.IllegalArgumentException - if the width/height of the node object is zero or negative
See Also:
checkGroupNodeSize(GraphLayout,Object), canLayout(LayoutGraph), doLayout(LayoutGraph), doLayout(GraphInterface, GraphLayout), calcLayout(LayoutGraph), calcLayout(GraphInterface, GraphLayout)

checkGroupNodeSize

protected void checkGroupNodeSize(GraphLayout layout,
                                  java.lang.Object node)
                           throws java.lang.IllegalArgumentException
Checks the given group node for zero or negative width/height.

This method is called by doLayout(LayoutGraph) for each group node of the input graph. It may be overridden in order to obtain a custom implementation of the group node size check or to remove it entirely.

Parameters:
layout - the GraphLayout instance
node - the group node object
Throws:
java.lang.IllegalArgumentException - if the width/height of the group node object is zero or negative
See Also:
checkNodeSize(GraphLayout,Object)

prependStage

public void prependStage(LayoutStage stage)
Prepends the given LayoutStage to the layout pipeline.

Stages that are added with this method will be invoked at the very beginning of the layout pipeline. This means before all previously prepended LayoutStages, all predefined stages, and all appended LayoutStages.

Parameters:
stage - the LayoutStage instance to be added
See Also:
removeStage(LayoutStage), appendStage(LayoutStage)

appendStage

public void appendStage(LayoutStage stage)
Appends the given LayoutStage to the layout pipeline.

Stages that are added with this method will be invoked at the very end of the layout pipeline. This means after all prepended LayoutStages, all predefined stages, and all previously appended LayoutStages, but just before the invocation of the layout algorithm.

Parameters:
stage - the LayoutStage instance to be added
See Also:
removeStage(LayoutStage), prependStage(LayoutStage)

removeStage

public void removeStage(LayoutStage stage)
Removes the given LayoutStage from the layout pipeline.

This method can only remove LayoutStages that have been previously added using appendStage(LayoutStage) or prependStage(LayoutStage). Predefined LayoutStages can be deactivated separately.

Parameters:
stage - a LayoutStage to be removed from the layout pipeline
See Also:
prependStage(LayoutStage), appendStage(LayoutStage), setSelfLoopLayouterEnabled(boolean), setParallelEdgeLayouterEnabled(boolean), setOrientationLayouterEnabled(boolean), setSubgraphLayouterEnabled(boolean), setLabelLayouterEnabled(boolean), setGroupNodeHidingEnabled(boolean), setComponentLayouterEnabled(boolean)

getLabelLayouter

public LayoutStage getLabelLayouter()
Returns the LayoutStage that places the labels of the input graph.

 
This LayoutStage needs to be activated in order to take effect.
Returns:
the LayoutStage instance
See Also:
setLabelLayouter(LayoutStage), setLabelLayouterEnabled(boolean), SALabeling, GreedyMISLabeling

setLabelLayouter

public void setLabelLayouter(LayoutStage labeler)
Specifies the LayoutStage that places the labels of the input graph.

 
This LayoutStage needs to be activated in order to take effect.
Default Value:
The default value is SALabeling. An instance of SALabeling with SALabeling.setMaximalDuration(long) set to 0.
Parameters:
labeler - the LayoutStage instance
See Also:
getLabelLayouter(), setLabelLayouterEnabled(boolean), SALabeling, GreedyMISLabeling

getSelfLoopLayouter

public LayoutStage getSelfLoopLayouter()
Returns the LayoutStage that routes self-loops.

 
This LayoutStage needs to be activated in order to take effect.
 
The default implementation temporarily removes all self-loops during core layout and routes them when inserting them again afterwards. Custom implementations should also hide the self-loops because the core layouter might not be able to handle them.
Returns:
the LayoutStage instance
See Also:
setSelfLoopLayouter(LayoutStage), setSelfLoopLayouterEnabled(boolean), SelfLoopLayouter

setSelfLoopLayouter

public void setSelfLoopLayouter(LayoutStage layouter)
Specifies the LayoutStage that routes self-loops.

 
This LayoutStage needs to be activated in order to take effect.
 
The default implementation temporarily removes all self-loops during core layout and routes them when inserting them again afterwards. Custom implementations should also hide the self-loops because the core layouter might not be able to handle them.
Default Value:
The default value is SelfLoopLayouter
Parameters:
layouter - the LayoutStage instance
See Also:
getSelfLoopLayouter(), setSelfLoopLayouterEnabled(boolean), SelfLoopLayouter

getParallelEdgeLayouter

public LayoutStage getParallelEdgeLayouter()
Returns the LayoutStage that routes parallel edges.

 
This LayoutStage needs to be activated in order to take effect.
 
The default implementation temporarily removes all parallel edges during core layout and routes them when inserting them again afterwards. Custom implementations should also hide the parallel edges because the core layouter might not be able to handle them.
Returns:
the LayoutStage instance
See Also:
setParallelEdgeLayouter(LayoutStage), setParallelEdgeLayouterEnabled(boolean), ParallelEdgeLayouter

setParallelEdgeLayouter

public void setParallelEdgeLayouter(LayoutStage layouter)
Specifies the LayoutStage that routes parallel edges.

 
This LayoutStage needs to be activated in order to take effect.
 
The default implementation temporarily removes all parallel edges during core layout and routes them when inserting them again afterwards. Custom implementations should also hide the parallel edges because the core layouter might not be able to handle them.
Default Value:
The default value is ParallelEdgeLayouter
Parameters:
layouter - the LayoutStage instance
See Also:
getParallelEdgeLayouter(), setParallelEdgeLayouterEnabled(boolean), ParallelEdgeLayouter

getComponentLayouter

public LayoutStage getComponentLayouter()
Returns the LayoutStage that arranges the connected components of an input graph.

 
This LayoutStage needs to be activated in order to take effect.
 
The default implementation passes all connected components to the layout algorithm separately. After all components are layouted, it arranges them in relation to each other. Custom implementations should respect that the layout algorithm may not be able to handle multiple connected components.
Returns:
the LayoutStage instance
See Also:
setComponentLayouter(LayoutStage), setComponentLayouterEnabled(boolean), ComponentLayouter

setComponentLayouter

public void setComponentLayouter(LayoutStage layouter)
Specifies the LayoutStage that arranges the connected components of an input graph.

 
This LayoutStage needs to be activated in order to take effect.
 
The default implementation passes all connected components to the layout algorithm separately. After all components are layouted, it arranges them in relation to each other. Custom implementations should respect that the layout algorithm may not be able to handle multiple connected components.
Default Value:
The default value is ComponentLayouter
Parameters:
layouter - the LayoutStage instance
See Also:
getComponentLayouter(), setComponentLayouterEnabled(boolean), ComponentLayouter

getSubgraphLayouter

public LayoutStage getSubgraphLayouter()
Returns the LayoutStage that constrains the layout process to a subgraph of the input graph.

 
This LayoutStage needs to be activated in order to take effect.
Default Value:
The default value is SubgraphLayouter
Returns:
the LayoutStage instance
See Also:
setSubgraphLayouter(LayoutStage), setSubgraphLayouterEnabled(boolean), SubgraphLayouter

setSubgraphLayouter

public void setSubgraphLayouter(LayoutStage layouter)
Specifies the LayoutStage that constrains the layout process to a subgraph of the input graph.

 
This LayoutStage needs to be activated in order to take effect.
Default Value:
The default value is SubgraphLayouter
Parameters:
layouter - the LayoutStage instance
See Also:
getSubgraphLayouter(), setSubgraphLayouterEnabled(boolean), SubgraphLayouter

getGroupNodeHider

public LayoutStage getGroupNodeHider()
Returns the LayoutStage that hides the group nodes of the input graph.

 
This LayoutStage needs to be activated in order to take effect.
 
The default implementation temporarily removes all group nodes during core layout and resizes them when inserting them again afterwards. Custom implementations should also hide the group nodes because the core layouter might not be able to handle them.
Returns:
the LayoutStage instance
See Also:
setGroupNodeHider(LayoutStage), setGroupNodeHidingEnabled(boolean), GroupNodeHider

setGroupNodeHider

public void setGroupNodeHider(LayoutStage layouter)
Specifies the LayoutStage that hides the group nodes of the input graph.

 
This LayoutStage needs to be activated in order to take effect.
 
The default implementation temporarily removes all group nodes during core layout and resizes them when inserting them again afterwards. Custom implementations should also hide the group nodes because the core layouter might not be able to handle them.
Default Value:
The default value is GroupNodeHider
Parameters:
layouter - the LayoutStage instance
See Also:
getGroupNodeHider(), setGroupNodeHidingEnabled(boolean), GroupNodeHider

getOrientationLayouter

public LayoutStage getOrientationLayouter()
Returns the LayoutStage that modifies the orientation of a computed layout.

 
In order to configure this LayoutStage using setLayoutOrientation(byte), it is necessary that an instance of OrientationLayouter is used.
Returns:
the LayoutStage instance
See Also:
setOrientationLayouter(LayoutStage), setOrientationLayouterEnabled(boolean), setLayoutOrientation(byte), OrientationLayouter

setOrientationLayouter

public void setOrientationLayouter(LayoutStage layouter)
Specifies the LayoutStage that modifies the orientation of a computed layout.

 
In order to configure this LayoutStage using setLayoutOrientation(byte), it is necessary that an instance of OrientationLayouter is used.
Default Value:
The default value is OrientationLayouter
Parameters:
layouter - the LayoutStage instance
See Also:
getOrientationLayouter(), setOrientationLayouterEnabled(boolean), setLayoutOrientation(byte), OrientationLayouter

setOrientationLayouterEnabled

public void setOrientationLayouterEnabled(boolean enabled)
Specifies whether or not the LayoutStage that modifies the orientation of the layout is activated. This LayoutStage may be deactivated if the orientation is irrelevant for the layout or if the core layout algorithm already handles the layout orientation by itself.

 
If the current layout orientation is LayoutOrientation.TOP_TO_BOTTOM, the orientation of the layout will not be modified.
Default Value:
The default value is true. The orientation LayoutStage is activated.
Parameters:
enabled - true if the stage that modifies the orientation is activated, false otherwise
See Also:
isOrientationLayouterEnabled(), setOrientationLayouter(LayoutStage), setLayoutOrientation(byte), OrientationLayouter

setLayoutOrientation

public void setLayoutOrientation(byte orientation)
Specifies the main orientation of the layout.

This is a convenience method that configures the orientation layout stage.

 
This method will take effect only if the layout stage that modifies the orientation is an instance of OrientationLayouter. It has to be overridden to support LayoutStages that do not extend OrientationLayouter.
Default Value:
The default value is LayoutOrientation.TOP_TO_BOTTOM
Parameters:
orientation - one of the default layout orientations
Throws:
java.lang.IllegalArgumentException - if the specified orientation does not match a default layout orientation
See Also:
getLayoutOrientation(), setOrientationLayouter(LayoutStage), setOrientationLayouterEnabled(boolean)

getLayoutOrientation

public byte getLayoutOrientation()
Returns the main orientation of the layout.

This is a convenience method that configures the orientation layout stage.

 
This method will take effect only if the layout stage that modifies the orientation is an instance of OrientationLayouter. It has to be overridden to support LayoutStages that do not extend OrientationLayouter.
Returns:
one of the default layout orientations
See Also:
setLayoutOrientation(byte), setOrientationLayouter(LayoutStage), setOrientationLayouterEnabled(boolean)

isOrientationLayouterEnabled

public boolean isOrientationLayouterEnabled()
Returns whether or not the LayoutStage that modifies the orientation of the layout is activated. This LayoutStage may be deactivated if the orientation is irrelevant for the layout or if the core layout algorithm already handles the layout orientation by itself.

 
If the current layout orientation is LayoutOrientation.TOP_TO_BOTTOM, the orientation of the layout will not be modified.
Returns:
true if the stage that modifies the orientation is activated, false otherwise
See Also:
setOrientationLayouterEnabled(boolean), setOrientationLayouter(LayoutStage), setLayoutOrientation(byte), OrientationLayouter

setSelfLoopLayouterEnabled

public void setSelfLoopLayouterEnabled(boolean enabled)
Specifies whether or not the LayoutStage used for routing self-loops is activated. This LayoutStage should be deactivated if the layout algorithm handles self-loops by itself.

Default Value:
The default value is true. The stage that routes self-loops is activated.
Parameters:
enabled - true if the stage responsible for routing self-loops is activated, false otherwise
See Also:
isSelfLoopLayouterEnabled(), setSelfLoopLayouter(LayoutStage), SelfLoopLayouter

isSelfLoopLayouterEnabled

public boolean isSelfLoopLayouterEnabled()
Returns whether or not the LayoutStage used for routing self-loops is activated. This LayoutStage should be deactivated if the layout algorithm handles self-loops by itself.

Returns:
true if the stage responsible for routing self-loops is activated, false otherwise
See Also:
setSelfLoopLayouterEnabled(boolean), setSelfLoopLayouter(LayoutStage), SelfLoopLayouter

setLabelLayouterEnabled

public void setLabelLayouterEnabled(boolean enabled)
Specifies whether or not the LayoutStage used for placing the labels of the input graph is activated. This LayoutStage may be activated to apply a generic labeling algorithm to the input graph. It will then try to find the best locations for the labels in the layout calculated by the layout algorithm. When the stage is deactivated, the labels are ignored or placed by an integrated labeling of the layout algorithm.

Default Value:
The default value is false. The stage responsible for label placement is deactivated.
Parameters:
enabled - true if the stage responsible for placing the labels is activated, false otherwise
See Also:
isLabelLayouterEnabled(), setLabelLayouter(LayoutStage), SALabeling, GreedyMISLabeling

isLabelLayouterEnabled

public boolean isLabelLayouterEnabled()
Returns whether or not the LayoutStage used for placing the labels of the input graph is activated. This LayoutStage may be activated to apply a generic labeling algorithm to the input graph. It will then try to find the best locations for the labels in the layout calculated by the layout algorithm. When the stage is deactivated, the labels are ignored or placed by an integrated labeling of the layout algorithm.

Returns:
true if the stage responsible for placing the labels is activated, false otherwise
See Also:
setLabelLayouterEnabled(boolean), setLabelLayouter(LayoutStage), SALabeling, GreedyMISLabeling

isGroupNodeHidingEnabled

public boolean isGroupNodeHidingEnabled()
Returns whether or not the LayoutStage used for hiding group nodes is activated. This LayoutStage should be deactivated if the layout algorithm handles group nodes itself.

Returns:
true if the stage used for hiding group nodes is activated, false otherwise
See Also:
setGroupNodeHidingEnabled(boolean), setGroupNodeHider(LayoutStage), GroupNodeHider

setGroupNodeHidingEnabled

public void setGroupNodeHidingEnabled(boolean groupNodeHidingEnabled)
Specifies whether or not the LayoutStage used for hiding group nodes is activated. This LayoutStage should be deactivated if the layout algorithm handles group nodes itself.

Default Value:
The default value is true. The stage responsible for hiding group nodes is activated.
Parameters:
groupNodeHidingEnabled - true if the stage used for hiding group nodes is activated, false otherwise
See Also:
isGroupNodeHidingEnabled(), setGroupNodeHider(LayoutStage), GroupNodeHider

setComponentLayouterEnabled

public void setComponentLayouterEnabled(boolean enabled)
Specifies whether or not the LayoutStage used for arranging the components of the graph is activated. This LayoutStage should be deactivated if the layout algorithm is able to handle several connected components.

Default Value:
The default value is true. The stage that arranges connected graph components is activated.
Parameters:
enabled - true if the stage that arranges the graph components is activated, false otherwise
See Also:
isComponentLayouterEnabled(), setComponentLayouter(LayoutStage), ComponentLayouter

isComponentLayouterEnabled

public boolean isComponentLayouterEnabled()
Returns whether or not the LayoutStage used for arranging the components of the graph is activated. This LayoutStage should be deactivated if the layout algorithm is able to handle several connected components.

Returns:
true if the stage that arranges the graph components is activated, false otherwise
See Also:
setComponentLayouterEnabled(boolean), setComponentLayouter(LayoutStage), ComponentLayouter

setParallelEdgeLayouterEnabled

public void setParallelEdgeLayouterEnabled(boolean enabled)
Specifies whether or not the LayoutStage used for routing parallel edges is activated. This LayoutStage should be deactivated if the layout algorithm handles parallel edges itself.

Default Value:
The default value is true. The stage that routes parallel edges is activated.
Parameters:
enabled - true if the stage responsible for routing parallel edges is activated, false otherwise
See Also:
isParallelEdgeLayouterEnabled(), setParallelEdgeLayouter(LayoutStage), ParallelEdgeLayouter

isParallelEdgeLayouterEnabled

public boolean isParallelEdgeLayouterEnabled()
Returns whether or not the LayoutStage used for routing parallel edges is activated. This LayoutStage should be deactivated if the layout algorithm handles parallel edges itself.

Returns:
true if the stage responsible for routing parallel edges is activated, false otherwise
See Also:
setParallelEdgeLayouterEnabled(boolean), setParallelEdgeLayouter(LayoutStage), ParallelEdgeLayouter

setSubgraphLayouterEnabled

public void setSubgraphLayouterEnabled(boolean enabled)
Specifies whether or not the LayoutStage used for constraining the layout process to a subgraph of the input graph is activated. This LayoutStage may be activated if the layout algorithm should be applied only to a specific part of the graph. The remaining graph will stay unchanged.

Default Value:
The default value is false. The stage that constrains the input graph to a subgraph is deactivated.
Parameters:
enabled - true if the stage that constrains the input graph to a subgraph is activated, false otherwise
See Also:
isSubgraphLayouterEnabled(), setSubgraphLayouter(LayoutStage), SubgraphLayouter

isSubgraphLayouterEnabled

public boolean isSubgraphLayouterEnabled()
Returns whether or not the LayoutStage used for constraining the layout process to a subgraph of the input graph is activated. This LayoutStage may be activated if the layout algorithm should be applied only to a specific part of the graph. The remaining graph will stay unchanged.

Returns:
true if the stage that constrains the input graph to a subgraph is activated, false otherwise
See Also:
setSubgraphLayouterEnabled(boolean), setSubgraphLayouter(LayoutStage), SubgraphLayouter

enableOnlyCore

public void enableOnlyCore()
Deactivates all predefined LayoutStages so that upon doLayout(y.layout.LayoutGraph) only the layout algorithm will be executed.

 
The LayoutStages prepare the graph for the layout algorithm, i.e., they can temporarily hide elements. If the layout algorithm cannot handle those elements, e.g., group nodes, it may not work well on the input graph.

doLayout

public void doLayout(LayoutGraph graph)
Calculates a layout for the given graph and applies it directly to the graph. This method executes all activated LayoutStages in the layout pipeline as well as the layout algorithm.

Specified by:
doLayout in interface Layouter
 
The given graph will not be copied during the layout process and the layout will be immediately applied to the given graph. This method is not side effect free in the sense that the order of edges or nodes in the input graph may change during the layout process.
Parameters:
graph - the input graph
See Also:
appendStage(LayoutStage), prependStage(LayoutStage), doLayoutCore(LayoutGraph)

doLayout

public void doLayout(GraphInterface graph,
                     GraphLayout layout)
Calculates a layout for the given graph and writes it back to the given GraphLayout instance. This method executes all activated LayoutStages in the layout pipeline as well as the layout algorithm.

Parameters:
graph - the input graph
layout - the GraphLayout instance to which the layout information is applied
See Also:
appendStage(LayoutStage), prependStage(LayoutStage), doLayoutCore(LayoutGraph)

calcLayout

public GraphLayout calcLayout(LayoutGraph graph)
Calculates a layout for the given input graph. This method executes all activated LayoutStages in the layout pipeline as well as the layout algorithm.

 
The given graph will not be modified by the layout process.
Parameters:
graph - the input graph
Returns:
the resulting layout information for the input graph
See Also:
appendStage(LayoutStage), prependStage(LayoutStage), doLayoutCore(LayoutGraph)

calcLayout

public GraphLayout calcLayout(GraphInterface graph,
                              GraphLayout layout)
Calculates a layout for the given GraphInterface and GraphLayout instances. This method executes all activated LayoutStages in the layout pipeline as well as the layout algorithm.

 
The given graph and layout will not be modified during the layout process.
Parameters:
graph - the GraphInterface
layout - the GraphLayout
Returns:
the resulting layout information for the input graph
See Also:
appendStage(LayoutStage), prependStage(LayoutStage), doLayoutCore(LayoutGraph)

canLayout

public boolean canLayout(LayoutGraph graph)
Checks whether or not the given graph can be handled by this layout algorithm.

All activated LayoutStages and layout algorithm must be able to calculate the layout to make this test successful.

Specified by:
canLayout in interface Layouter
Parameters:
graph - the input graph
Returns:
true if the input graph can be handled by the given layout algorithm, false otherwise
See Also:
Layouter.doLayout(LayoutGraph)

© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.