Search this API

y.layout
Class NormalizingGraphElementOrderStage

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

public class NormalizingGraphElementOrderStage
extends AbstractLayoutStage

Layout stage that can be used to normalize the order of the elements within a graph. Amongst other factors, the results produced by layout algorithms usually depend on the order of the nodes and edges within a graph. Unfortunately, useful operations such as hiding or unhiding elements from a graph or simply invoking layout algorithms on a graph will have the potential side effect of changing that order. With this layout stage it is possible to establish a predefined order of nodes and edges within a graph to avoid non-deterministic layout behavior. Defining the order of nodes and edges is done by associating each node or edge in the graph with a Comparable value using DataProviders registered with the key COMPARABLE_NODE_DPKEY, or COMPARABLE_EDGE_DPKEY respectively. the DataProvider key


Field Summary
static Object COMPARABLE_EDGE_DPKEY
          The DataProvider registered with this key must return a Comparable object for each edge thereby inducing a (global) order for edges.
static Object COMPARABLE_NODE_DPKEY
          The DataProvider registered with this key must return a Comparable object for each node thereby inducing a (global) order for nodes.
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
NormalizingGraphElementOrderStage()
           
NormalizingGraphElementOrderStage(Layouter coreLayouter)
           
 
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.
static void fillComparableMapFromGraph(Graph graph, DataMap comparableNodeMap, DataMap comparableEdgeMap)
          Convenience method that assigns comparable values for each node and edge.
 
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

COMPARABLE_NODE_DPKEY

public static final Object COMPARABLE_NODE_DPKEY
The DataProvider registered with this key must return a Comparable object for each node thereby inducing a (global) order for nodes.


COMPARABLE_EDGE_DPKEY

public static final Object COMPARABLE_EDGE_DPKEY
The DataProvider registered with this key must return a Comparable object for each edge thereby inducing a (global) order for edges.

Constructor Detail

NormalizingGraphElementOrderStage

public NormalizingGraphElementOrderStage()

NormalizingGraphElementOrderStage

public NormalizingGraphElementOrderStage(Layouter coreLayouter)
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.


fillComparableMapFromGraph

public static void fillComparableMapFromGraph(Graph graph,
                                              DataMap comparableNodeMap,
                                              DataMap comparableEdgeMap)
Convenience method that assigns comparable values for each node and edge. The compared values are induced from the current ordering of the nodes and edges within the given graph.


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