Search this API

y.layout.grid
Class GenericPartitionGridStage

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

public class GenericPartitionGridStage
extends AbstractLayoutStage

This LayoutStage offers generic support for partition grid structures.

The stage performs the following steps:

  1. First it determines sub-components such that each component only contains nodes associated with the same grid cell. Nodes without associated grid cell are temporarily assigned to a suitable cell.
  2. Now this stage applies the specified core layout algorithm to each sub-component and, afterwards, reassembles the global partition grid structure. Since the sub-components do not contain nodes of different cells, the core layout algorithm doesn't require support for partition grid on its own.
  3. Finally, this stage routes edges that connect nodes of different sub-components by means of the specified inter-edge router. Note that such edges are temporarily hidden during the core layout runs.

Disabling property setMultiCellComponentSplittingEnabled(boolean) allows to switch to a mode where connected components are not split into smaller sub-components. Hence, a component may contain nodes of different partition cells and, thus, the specified core layout algorithm has to support partition grid structures by itself. In this case, this stage doesn't offer a generic partition grid support (since the core layout algorithm already has to support such structures). Instead it may speed up the layout calculation since the core layout algorithm is applied to different smaller graphs instead of a single, larger input graph.

See Also:
PartitionGrid
 

Field Summary
static java.lang.Object SPLIT_EDGES_DPKEY
          A DataProvider key for explicitly marking (some) edges that should not be considered when calculating the sub-components This key is only considered if property setMultiCellComponentSplittingEnabled(boolean) is disabled.
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, NODE_TYPE_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
GenericPartitionGridStage()
          Creates a new instance without a specific core layout algorithm.
GenericPartitionGridStage(Layouter coreLayouter)
          Creates a new instance using the given core layout algorithm.
 
Method Summary
 boolean canLayout(LayoutGraph graph)
          Accepts all graphs that can be handled by the core layout algorithm.
 void doLayout(LayoutGraph graph)
          Starts the layout.
 Layouter getInterEdgeRouter()
          Returns the current edge routing algorithm for handling inter-edges.
 java.lang.Object getInterEdgesDpKey()
          Returns the key for marking the inter-edges to be routed.
 boolean isLabelConsiderationEnabled()
          Returns whether or not to take node and edge labels into account when calculating the bounding box of the partition cells.
 boolean isMultiCellComponentSplittingEnabled()
          Returns whether or not the algorithm should split connected components that have nodes associated with different partition cells.
 void setInterEdgeRouter(Layouter interEdgeRouter)
          Specifies the current edge routing algorithm for handling inter-edges.
 void setInterEdgesDpKey(java.lang.Object interEdgesDpKey)
          Specifies the key for marking the inter-edges to be routed.
 void setLabelConsiderationEnabled(boolean enabled)
          Specifies whether or not to take node and edge labels into account when calculating the bounding box of the partition cells.
 void setMultiCellComponentSplittingEnabled(boolean multiCellComponentSplittingEnabled)
          Specifies whether or not the algorithm should split connected components that have nodes associated with different partition cells.
 
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
 

Field Detail

SPLIT_EDGES_DPKEY

public static final java.lang.Object SPLIT_EDGES_DPKEY
A DataProvider key for explicitly marking (some) edges that should not be considered when calculating the sub-components

This key is only considered if property setMultiCellComponentSplittingEnabled(boolean) is disabled. The marked edges, the so-called split-edges, are temporarily removed during the calculation of the sub-components and, finally, routed with the specified inter-edge router. This allows to control how the graph is split into smaller graph components. Recall that with this setting a component may contain nodes of different partition cells.

See Also:
setInterEdgeRouter(Layouter), setMultiCellComponentSplittingEnabled(boolean)
Constructor Detail

GenericPartitionGridStage

public GenericPartitionGridStage()
Creates a new instance without a specific core layout algorithm.


GenericPartitionGridStage

public GenericPartitionGridStage(Layouter coreLayouter)
Creates a new instance using the given core layout algorithm.

Parameters:
coreLayouter - the core layout algorithm
Method Detail

setLabelConsiderationEnabled

public void setLabelConsiderationEnabled(boolean enabled)
Specifies whether or not to take node and edge labels into account when calculating the bounding box of the partition cells.

 
The labels are only considered if option setMultiCellComponentSplittingEnabled(boolean) is enabled. Otherwise the proper calculation of the partition cell box is up to the core layout algorithm.
Default Value:
The default value is true. Node and edge labels are included in the bounds of the partition cells.
Parameters:
enabled - true if node and edge labels should be taken into account, false otherwise
See Also:
setMultiCellComponentSplittingEnabled(boolean)

isLabelConsiderationEnabled

public boolean isLabelConsiderationEnabled()
Returns whether or not to take node and edge labels into account when calculating the bounding box of the partition cells.

 
The labels are only considered if option setMultiCellComponentSplittingEnabled(boolean) is enabled. Otherwise the proper calculation of the partition cell box is up to the core layout algorithm.
Returns:
true if node and edge labels are taken into account, false otherwise
See Also:
setLabelConsiderationEnabled(boolean), setMultiCellComponentSplittingEnabled(boolean)

getInterEdgeRouter

public Layouter getInterEdgeRouter()
Returns the current edge routing algorithm for handling inter-edges.

If option setMultiCellComponentSplittingEnabled(boolean) is enabled, components that contain nodes associated with different partition cells are split into sub-components. Edges that connect nodes of different sub-components are called inter-edges and routed with this edge routing algorithm.

It is required that a suitable selection key is specified. The same selection key must be used for setting the scope for the edge routing algorithm.

 
If no router is set, all inter-edges are routed as straight lines.
Returns:
the edge routing algorithm for inter-edges or null if edges are routed as straight lines
See Also:
setInterEdgeRouter(Layouter), setInterEdgesDpKey(Object)

setInterEdgeRouter

public void setInterEdgeRouter(Layouter interEdgeRouter)
Specifies the current edge routing algorithm for handling inter-edges.

If option setMultiCellComponentSplittingEnabled(boolean) is enabled, components that contain nodes associated with different partition cells are split into sub-components. Edges that connect nodes of different sub-components are called inter-edges and routed with this edge routing algorithm.

It is required that a suitable selection key is specified. The same selection key must be used for setting the scope for the edge routing algorithm.

 
If no router is set, all inter-edges are routed as straight lines.
Default Value:
The default value is null. Inter-edges are routed as straight lines.
Parameters:
interEdgeRouter - the edge routing algorithm for inter-edges or null if edges should be routed as straight lines
See Also:
setInterEdgesDpKey(Object)

getInterEdgesDpKey

public java.lang.Object getInterEdgesDpKey()
Returns the key for marking the inter-edges to be routed.

The key should be used by the specified inter-edge routing algorithm to obtain the edges that must be routed. This stage automatically marks these edges and registers the DataProvider using the specified key.

 
If there is already a DataAcceptor registered with this key, this stage uses it to mark the edges instead of adding a new DataProvider.
Returns:
the inter-edge selection key
See Also:
getInterEdgeRouter(), setInterEdgesDpKey(Object)

setInterEdgesDpKey

public void setInterEdgesDpKey(java.lang.Object interEdgesDpKey)
Specifies the key for marking the inter-edges to be routed.

The key should be used by the specified inter-edge routing algorithm to obtain the edges that must be routed. This stage automatically marks these edges and registers the DataProvider using the specified key.

 
If there is already a DataAcceptor registered with this key, this stage uses it to mark the edges instead of adding a new DataProvider.
Default Value:
The default value is Layouter.SELECTED_EDGES
Parameters:
interEdgesDpKey - the inter-edge selection key
Throws:
java.lang.IllegalArgumentException - if the specified key is null
See Also:
setInterEdgeRouter(Layouter)

isMultiCellComponentSplittingEnabled

public boolean isMultiCellComponentSplittingEnabled()
Returns whether or not the algorithm should split connected components that have nodes associated with different partition cells.

If this option is enabled, such components are split into sub-components that only include nodes associated with the same grid cell. Hence, the core layout algorithm doesn't see the partition grid at all. Edges that connect nodes of different sub-components are temporarily hidden and routed afterwards by means of the inter-edge router.

If this option is disabled, the layout algorithm determines independent components and calls the core layout algorithm for each of them. Note that two connected components are only independent if there is no group node that contains a node of each of them and if the two sub-partition grids induced by the connected components do no have a common ColumnDescriptor or RowDescriptor. The core layout algorithm is called once for each independent component and, thus, has to support partition grid structures.

 
If this option is disabled, the core layout algorithm has to support partition grid structures by itself.
Returns:
true if connected components with nodes of different partition cells are split, false otherwise
See Also:
setMultiCellComponentSplittingEnabled(boolean)

setMultiCellComponentSplittingEnabled

public void setMultiCellComponentSplittingEnabled(boolean multiCellComponentSplittingEnabled)
Specifies whether or not the algorithm should split connected components that have nodes associated with different partition cells.

If this option is enabled, such components are split into sub-components that only include nodes associated with the same grid cell. Hence, the core layout algorithm doesn't see the partition grid at all. Edges that connect nodes of different sub-components are temporarily hidden and routed afterwards by means of the inter-edge router.

If this option is disabled, the layout algorithm determines independent components and calls the core layout algorithm for each of them. Note that two connected components are only independent if there is no group node that contains a node of each of them and if the two sub-partition grids induced by the connected components do no have a common ColumnDescriptor or RowDescriptor. The core layout algorithm is called once for each independent component and, thus, has to support partition grid structures.

 
If this option is disabled, the core layout algorithm has to support partition grid structures by itself.
Default Value:
The default value is true. Components with nodes of different partition cells are split.
Parameters:
multiCellComponentSplittingEnabled - true if connected components with nodes of different partition cells should be split, false otherwise

canLayout

public boolean canLayout(LayoutGraph graph)
Accepts all graphs that can be handled by the core layout algorithm.

If there is no core layout algorithm, all graphs are accepted.

Parameters:
graph - the input graph
Returns:
true if there is no core layout algorithm or the core layout algorithm accepts the graph, false otherwise
See Also:
Layouter.doLayout(LayoutGraph)

doLayout

public void doLayout(LayoutGraph graph)
Starts the layout.

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

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