Search this API

y.layout
Class LayoutMultiplexer

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

public class LayoutMultiplexer
extends AbstractLayoutStage

This class delegates its layout calls to a core layout algorithm that is dynamically chosen at runtime by inspecting the nodes of the input graph.

If a data provider is registered with the given graph using the look-up key LAYOUTER_DPKEY it is used to retrieve the Layouter objects that are stored for the graph's nodes. If no such data provider is registered, this layout stage's core layouter (if any) is used for layout calculation of all nodes.
Note that the first non-null Layouter retrieved from the data provider is used for all nodes.

The main purpose of this class is to enable the use of individual layout algorithms for components (when used as the core layouter of class ComponentLayouter) or for the contents of group nodes (when used as the core layouter of class RecursiveGroupLayouter).


Field Summary
static Object LAYOUTER_DPKEY
          Look-up key used to register a DataProvider that provides a Layouter object for each node of a graph.
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
LayoutMultiplexer()
           
 
Method Summary
 boolean canLayout(LayoutGraph graph)
          Returns true iff the given graph can be laid out by this algorithm.
 void doLayout(LayoutGraph graph)
          Main layout routine that assigns new layout information to the given graph.
protected  Layouter getCoreLayouter(LayoutGraph graph)
          Returns the core layout algorithm associated with the nodes contained in the given 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
 

Field Detail

LAYOUTER_DPKEY

public static final Object LAYOUTER_DPKEY
Look-up key used to register a DataProvider that provides a Layouter object for each node of a graph.

Constructor Detail

LayoutMultiplexer

public LayoutMultiplexer()
Method Detail

canLayout

public boolean canLayout(LayoutGraph graph)
Description copied from interface: Layouter
Returns true iff the given graph can be laid out by this algorithm. Calling doLayout with the given graph as its argument will only success if this method returns true.


doLayout

public void doLayout(LayoutGraph graph)
Description copied from interface: Layouter
Main layout routine that assigns new layout information to the given graph.


getCoreLayouter

protected Layouter getCoreLayouter(LayoutGraph graph)
Returns the core layout algorithm associated with the nodes contained in the given graph. The default implementation looks up the layout algorithm in the data provider registered with the key LAYOUTER_DPKEY.


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