Search this API

y.layout
Class TemporaryGroupNodeInsertionStage

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

public class TemporaryGroupNodeInsertionStage
extends AbstractLayoutStage

TemporaryGroupNodeInsertionStage is useful if nodes should be treated by layout algorithms as if they were actually grouped without the need to manually create a grouped graph for the layout process.

This stage converts given TemporaryGroupDescriptors into a valid, temporary grouping structure that is visible for the core layout algorithm and is obeyed by it if it supports grouped graphs.

This stage works as follows:

  1. A graph grouping is derived from the given temporar group descriptors. All nodes with the same descriptor are assigned to a newly created group node that is inserted into the graph.
  2. The core layout algorithm is executed. It works on the graph containing the inserted group nodes.
  3. The temporarily inserted group nodes are removed, restoring the original graph structure.
In case that the input graph is already grouped, the following should be noted:

 
This stage is especially convenient if RecursiveGroupLayouter should be applied but the graph is not grouped. This way a layout algorithm (or different ones) can be applied independently for different sub-graphs without manually grouping the graph only for the layout process. To map a specific Layouter instance to a temporary group descriptor use TemporaryGroupDescriptor.setRecursiveGroupLayoutAlgorithm(Layouter). It is then not necessary to use RecursiveGroupLayouter.GROUP_NODE_LAYOUTER_DPKEY.
See Also:
TEMPORARY_GROUP_DESCRIPTOR_DPKEY, TemporaryGroupDescriptor, INSERTED_GROUP_NODE_DPKEY
 

Field Summary
static java.lang.Object INSERTED_GROUP_NODE_DPKEY
          A DataProvider key that this stage uses for marking the inserted group nodes The algorithm temporarily adds a DataProvider that is registered with this key and marks inserted group nodes.
static java.lang.Object TEMPORARY_GROUP_DESCRIPTOR_DPKEY
          A DataProvider key for specifying temporary groups of the input graph Nodes associated with the same TemporaryGroupDescriptor instance constitute a group and are assigned to the same, temporarily inserted group node, which is visible during the execution of the core layout algorithm and removed afterwards.
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, NODE_TYPE_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
TemporaryGroupNodeInsertionStage()
          Creates a new TemporaryGroupNodeInsertionStage with default settings.
TemporaryGroupNodeInsertionStage(Layouter core)
          Creates a new TemporaryGroupNodeInsertionStage with the given layout algorithm as 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)
          Creates temporary group nodes based on the sub-graphs define by the temporary group descriptors, executes the core layout algorithm, and, finally, removes the temporary group nodes.
 
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

TEMPORARY_GROUP_DESCRIPTOR_DPKEY

public static final java.lang.Object TEMPORARY_GROUP_DESCRIPTOR_DPKEY
A DataProvider key for specifying temporary groups of the input graph

Nodes associated with the same TemporaryGroupDescriptor instance constitute a group and are assigned to the same, temporarily inserted group node, which is visible during the execution of the core layout algorithm and removed afterwards.

See Also:
INSERTED_GROUP_NODE_DPKEY

INSERTED_GROUP_NODE_DPKEY

public static final java.lang.Object INSERTED_GROUP_NODE_DPKEY
A DataProvider key that this stage uses for marking the inserted group nodes

The algorithm temporarily adds a DataProvider that is registered with this key and marks inserted group nodes. More precisely, for each inserted group node DataProvider.getBool(Object) returns true. It is only available during the processing of this stage and automatically removed at the end.

Constructor Detail

TemporaryGroupNodeInsertionStage

public TemporaryGroupNodeInsertionStage()
Creates a new TemporaryGroupNodeInsertionStage with default settings.


TemporaryGroupNodeInsertionStage

public TemporaryGroupNodeInsertionStage(Layouter core)
Creates a new TemporaryGroupNodeInsertionStage with the given layout algorithm as core layout algorithm.

Parameters:
core - the core layout algorithm
Method Detail

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)
Creates temporary group nodes based on the sub-graphs define by the temporary group descriptors, executes the core layout algorithm, and, finally, removes the temporary group nodes.

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

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