Search this API

y.layout
Class SubgraphLayouter

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

public class SubgraphLayouter
extends AbstractLayoutStage

A SubgraphLayouter is a LayoutStage that filters out all graph elements that are not part of a specific subgraph.

The nodes that induce this subgraph are marked using a DataProvider registered with a specific key. They will be arranged by the core layout algorithm.

 
All excluded nodes and their incident edges keep their locations. Hence, arranging only a subgraph may lead to overlaps.
 

Field Summary
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
SubgraphLayouter()
          Creates a new SubgraphLayouter instance with default settings.
SubgraphLayouter(Layouter coreLayouter)
          Creates a new SubgraphLayouter instance using the given core layout algorithm.
 
Method Summary
 boolean canLayout(LayoutGraph graph)
          Accepts all graphs whose specified subgraph can be handled by the core layout algorithm.
 void doLayout(LayoutGraph graph)
          Delegates the arrangement of the specified subgraph of the given graph to the core layout algorithm.
 java.lang.Object getSubgraphNodesDpKey()
          Returns the key to register a DataProvider which marks the nodes that induce the subgraph to be arranged.
 void setSubgraphNodesDpKey(java.lang.Object key)
          Specifies the key to register a DataProvider which marks the nodes that induce the subgraph to be arranged.
 
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

SubgraphLayouter

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

Parameters:
coreLayouter - the core layout routine

SubgraphLayouter

public SubgraphLayouter()
Creates a new SubgraphLayouter instance with default settings.

Method Detail

getSubgraphNodesDpKey

public java.lang.Object getSubgraphNodesDpKey()
Returns the key to register a DataProvider which marks the nodes that induce the subgraph to be arranged.

Returns:
the DataProvider key
See Also:
setSubgraphNodesDpKey(Object)

setSubgraphNodesDpKey

public void setSubgraphNodesDpKey(java.lang.Object key)
Specifies the key to register a DataProvider which marks the nodes that induce the subgraph to be arranged.

Default Value:
The default value is Layouter.SELECTED_NODES
Parameters:
key - the DataProvider key
Throws:
java.lang.IllegalArgumentException - if the specified key is null
See Also:
getSubgraphNodesDpKey()

doLayout

public void doLayout(LayoutGraph graph)
Delegates the arrangement of the specified subgraph of the given graph to the core layout algorithm.

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

canLayout

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

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

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