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 subgraph nodes key. They will be arranged by the core layout algorithm.

Optionally, the edges that are included in the subgraph can explicitly be marked as well by registering a DataProvider with the subgraph edges key. This feature is useful to exclude specific edges from being handled by the core layout. If no provider is registered, all edges are included.

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

Field Summary
static java.lang.Object SUBGRAPH_EDGES_DPKEY
          A DataProvider key for marking edges that are included in the subgraph, thus, visible during the core layout
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, NODE_TYPE_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 getSubgraphEdgesDpKey()
          Returns the key to register a DataProvider which marks the edges that are included in the subgraph, thus, visible during the core layout.
 java.lang.Object getSubgraphNodesDpKey()
          Returns the key to register a DataProvider which marks the nodes that induce the subgraph to be arranged.
 void setSubgraphEdgesDpKey(java.lang.Object key)
          Specifies the key to register a DataProvider which marks the edges that are included in the subgraph, thus, visible during the core layout.
 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
 

Field Detail

SUBGRAPH_EDGES_DPKEY

public static final java.lang.Object SUBGRAPH_EDGES_DPKEY
A DataProvider key for marking edges that are included in the subgraph, thus, visible during the core layout

 
If no DataProvider is registered with the key, all edges will be included, except those that are excluded because their source or target node is excluded.
 
This is the default key of property setSubgraphEdgesDpKey(Object). If a custom key is required, specify it as that properties value and register the DataProvider with the custom key. This may be useful if running multiple instances of this layout stage within a larger layout pipeline and the instances must include/exclude different edges.
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.

If no DataProvider is registered with the specified key, all nodes will be included.

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.

If no DataProvider is registered with the specified key, all nodes will be included.

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

getSubgraphEdgesDpKey

public java.lang.Object getSubgraphEdgesDpKey()
Returns the key to register a DataProvider which marks the edges that are included in the subgraph, thus, visible during the core layout.

If no DataProvider is registered with the specified key, all edges will be included, except those that are already excluded because their source or target node is excluded.

Returns:
the DataProvider key
Throws:
java.lang.IllegalArgumentException - if the specified key is null
See Also:
SUBGRAPH_EDGES_DPKEY, setSubgraphEdgesDpKey(Object)

setSubgraphEdgesDpKey

public void setSubgraphEdgesDpKey(java.lang.Object key)
Specifies the key to register a DataProvider which marks the edges that are included in the subgraph, thus, visible during the core layout.

If no DataProvider is registered with the specified key, all edges will be included, except those that are already excluded because their source or target node is excluded.

Default Value:
The default value is SUBGRAPH_EDGES_DPKEY
Parameters:
key - the DataProvider key
Throws:
java.lang.IllegalArgumentException - if the specified key is null
See Also:
SUBGRAPH_EDGES_DPKEY

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-2022,
yWorks GmbH.
All rights reserved.