Search this API

y.layout.organic
Class OrganicPartitionGridLayoutStage

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

public class OrganicPartitionGridLayoutStage
extends AbstractLayoutStage

This layout stage enables support for handling a graph with a PartitionGrid structure.

Concept

Before executing the core layout algorithm, this stage prepares the grid structure of the graph accordingly, e.g., by hiding top-level grid nodes. Then, the core layout algorithm is applied to the graph. Finally, the grid is restored, configured and positioned such that it is consistent with the layout computed by the core algorithm.

Information about the PartitionGrid structure is retrieved from a DataProvider registered with the graph using key PartitionGrid.PARTITION_GRID_DPKEY.

Usage

When using SmartOrganicLayouter, this stage will automatically be used, if required. It is not necessary to append this stage manually to SmartOrganicLayouter.

Appending this stage can be useful to add support for partition grid structures to other Layouters.

The stage can be appended to all algorithms of type CanonicMultiStageLayouter by using method CanonicMultiStageLayouter.appendStage(y.layout.LayoutStage).

 
Group nodes that span multiple grid cells are not supported by this stage.
See Also:
PartitionGrid
 

Field Summary
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, NODE_TYPE_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
OrganicPartitionGridLayoutStage(Layouter core)
          Creates a new instance of OrganicPartitionGridLayoutStage with the given layout algorithm as core algorithm.
 
Method Summary
 boolean canLayout(LayoutGraph graph)
          Accepts all graphs which are accepted by the specified core layout algorithm.
 void doLayout(LayoutGraph graph)
          Calculates the layout according to the core layout algorithm, while considering an existing partition grid structure defined for the graph.
 
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

OrganicPartitionGridLayoutStage

public OrganicPartitionGridLayoutStage(Layouter core)
Creates a new instance of OrganicPartitionGridLayoutStage with the given layout algorithm as core algorithm.

Parameters:
core - the core layout algorithm
Method Detail

canLayout

public boolean canLayout(LayoutGraph graph)
Accepts all graphs which are accepted by the specified core layout algorithm.

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

doLayout

public void doLayout(LayoutGraph graph)
Calculates the layout according to the core layout algorithm, while considering an existing partition grid structure defined for the graph.

If there is no PartitionGrid defined for the graph, only the core layout algorithm will be executed.

Parameters:
graph - the input graph
Throws:
WrongGraphStructure - if the graph has group nodes whose content spans multiple grid cells or if the associated group node mode data is equal to SmartOrganicLayouter.GROUP_NODE_MODE_FIX_CONTENTS or SmartOrganicLayouter.GROUP_NODE_MODE_FIX_BOUNDS.
See Also:
Layouter.canLayout(LayoutGraph)

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