Search this API

y.layout
Class CompositeLayoutStage

java.lang.Object
  extended by y.layout.AbstractLayoutStage
      extended by y.layout.CompositeLayoutStage
All Implemented Interfaces:
Layouter, LayoutStage

public class CompositeLayoutStage
extends AbstractLayoutStage

CompositeLayoutStage allows for combining multiple LayoutStages.

The LayoutStages are organized in a pipeline where additional LayoutStages can be prepended or appended.

Each LayoutStage in the pipeline executes its pre-processing code before calling its successor LayoutStage. Then, after all subsequent LayoutStages have finished, it will execute its post-processing code.

Note that the pipeline only works when all LayoutStages call their core layout algorithm which is the next LayoutStage in the pipeline.

 

Field Summary
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
CompositeLayoutStage()
          Creates a new CompositeLayoutStage instance with an empty pipeline.
CompositeLayoutStage(LayoutStage outerStage, LayoutStage innerStage)
          Creates a new CompositeLayoutStage instance with two LayoutStages in the pipeline.
 
Method Summary
 void appendStage(LayoutStage stage)
          Appends a LayoutStage to the previously added LayoutStages.
 boolean canLayout(LayoutGraph graph)
          Checks whether or not the pipeline of LayoutStages can arrange the given graph.
 void doLayout(LayoutGraph graph)
          Executes the pipeline of LayoutStage and the core layout algorithm which apply the layout to the graph.
 java.util.List getLayoutStages()
          Returns the complete pipeline of LayoutStages that were added to this CompositeLayoutStage.
 void prependStage(LayoutStage stage)
          Prepends a LayoutStage to the previously added LayoutStages.
 
Methods inherited from class y.layout.AbstractLayoutStage
canLayoutCore, doLayoutCore, getCoreLayouter, setCoreLayouter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositeLayoutStage

public CompositeLayoutStage()
Creates a new CompositeLayoutStage instance with an empty pipeline.


CompositeLayoutStage

public CompositeLayoutStage(LayoutStage outerStage,
                            LayoutStage innerStage)
Creates a new CompositeLayoutStage instance with two LayoutStages in the pipeline.

The inner LayoutStage will be wrapped by the outer LayoutStage.

Parameters:
outerStage - the wrapping LayoutStage
innerStage - the wrapped LayoutStage
Method Detail

prependStage

public void prependStage(LayoutStage stage)
Prepends a LayoutStage to the previously added LayoutStages. The added LayoutStage will be invoked before any other LayoutStage. Its pre-processing code will be executed before the already added LayoutStages' pre-processing code, while its post-processing code will be executed after the post-processing code of all the other LayoutStages.

Parameters:
stage - the stage to prepend

getLayoutStages

public java.util.List getLayoutStages()
Returns the complete pipeline of LayoutStages that were added to this CompositeLayoutStage.

Returns:
a list of all LayoutStages in the pipeline

appendStage

public void appendStage(LayoutStage stage)
Appends a LayoutStage to the previously added LayoutStages. The added LayoutStage will be invoked just before the core layout algorithm will be invoked. Its pre-processing code will be executed after the already added LayoutStages' pre-processing code, while its post-processing code will be executed before the post-processing code of all the other LayoutStages.

Parameters:
stage - the stage to append

canLayout

public boolean canLayout(LayoutGraph graph)
Checks whether or not the pipeline of LayoutStages can arrange the given graph.

Parameters:
graph - the input graph
Returns:
true if the graph can be arranged by the pipeline of LayoutStages, false otherwise
See Also:
Layouter.doLayout(LayoutGraph)

doLayout

public void doLayout(LayoutGraph graph)
Executes the pipeline of LayoutStage and the core layout algorithm which apply the layout to the graph.

Parameters:
graph - the input graph
See Also:
Layouter.canLayout(LayoutGraph)

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