Search this API

y.layout.hierarchic.incremental
Class TopLevelGroupToSwimlaneStage

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

public class TopLevelGroupToSwimlaneStage
extends AbstractLayoutStage

This layout stage can be used for automatically assigning SwimLaneDescriptor instances to nodes by treating top-level group nodes as swimlanes.

This stage will modify the hierarchy by temporarily removing the top-level group nodes and assigning corresponding descriptors to the remaining nodes. After running the core layout, the top-level group nodes will be arranged to function as swimlanes. This class allows using the current coordinates of the group nodes to arrange the swimlanes from sketch. Also, the spacing between swimlanes may be specified.

This stage can be appended to the IncrementalHierarchicLayouter.

See Also:
IncrementalHierarchicLayouter, SwimLaneDescriptor, GroupingKeys
 

Field Summary
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, NODE_TYPE_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
TopLevelGroupToSwimlaneStage()
          Creates a new instance of TopLevelGroupToSwimlaneStage with the default settings.
 
Method Summary
 boolean canLayout(LayoutGraph graph)
          Checks whether or not the given graph can be arranged by this layout algorithm.
 void doLayout(LayoutGraph graph)
          Calculates the layout by automatically assigning SwimLaneDescriptor instances to nodes and treating top-level group nodes as swimlanes.
 double getSpacing()
          Returns the spacing between the swimlanes.
 boolean isFromSketchSwimlaneOrderingEnabled()
          Returns whether or not the order of the swimlanes should be determined based on the current sketch.
 void setFromSketchSwimlaneOrderingEnabled(boolean fromSketchSwimlaneOrderingEnabled)
          Specifies whether or not the order of the swimlanes should be determined based on the current sketch.
 void setSpacing(double spacing)
          Specifies the spacing between the swimlanes.
 
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

TopLevelGroupToSwimlaneStage

public TopLevelGroupToSwimlaneStage()
Creates a new instance of TopLevelGroupToSwimlaneStage with the default settings.

Method Detail

getSpacing

public double getSpacing()
Returns the spacing between the swimlanes.

The spacing should be greater than 0.

Returns:
a non-negative spacing value
See Also:
setSpacing(double)

setSpacing

public void setSpacing(double spacing)
Specifies the spacing between the swimlanes.

The spacing should be greater than 0.

Default Value:
The default value is 0.0d.
Parameters:
spacing - a non-negative spacing value
Throws:
java.lang.IllegalArgumentException - if the spacing is negative
Sample Graphs:

Swimlane spacing 5

Swimlane spacing 20

isFromSketchSwimlaneOrderingEnabled

public boolean isFromSketchSwimlaneOrderingEnabled()
Returns whether or not the order of the swimlanes should be determined based on the current sketch.

Returns:
true if the order of the swimlanes is determined from the current sketch, false otherwise
See Also:
setFromSketchSwimlaneOrderingEnabled(boolean)

setFromSketchSwimlaneOrderingEnabled

public void setFromSketchSwimlaneOrderingEnabled(boolean fromSketchSwimlaneOrderingEnabled)
Specifies whether or not the order of the swimlanes should be determined based on the current sketch.

Default Value:
The default value is false. The order of the swimlanes is not determined from the current sketch.
Parameters:
fromSketchSwimlaneOrderingEnabled - true if the order of the swimlanes is determined from the current sketch, false otherwise
Sample Graphs:

Initial graph

false

true

canLayout

public boolean canLayout(LayoutGraph graph)
Description copied from interface: Layouter
Checks whether or not the given graph can be arranged by this layout algorithm. Calling the main layout routine on this graph will only succeed if this method returns true.

Parameters:
graph - the input graph
Returns:
true if this layout algorithm can handle the input graph, false otherwise
See Also:
Layouter.doLayout(LayoutGraph)

doLayout

public void doLayout(LayoutGraph graph)
Calculates the layout by automatically assigning SwimLaneDescriptor instances to nodes and treating top-level group nodes as swimlanes.

 
The given graph will not be copied during the layout process and the layout will be immediately applied to the given graph.
Parameters:
graph - the input graph
See Also:
Layouter.canLayout(LayoutGraph)

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