|
Search this API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecty.layout.AbstractLayoutStage
y.layout.NormalizingGraphElementOrderStage
public class NormalizingGraphElementOrderStage
NormalizingGraphElementOrderStage normalizes the order of the elements within a graph to ensure the same
order for multiple layout invocations.
Among 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 LayoutStage 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 a DataProvider
registered with the key COMPARABLE_NODE_DPKEY or COMPARABLE_EDGE_DPKEY, respectively.
![]() |
![]() |
| Field Summary | |
|---|---|
static java.lang.Object |
COMPARABLE_EDGE_DPKEY
A DataProvider key for defining a (global) order for edges
|
static java.lang.Object |
COMPARABLE_NODE_DPKEY
A DataProvider key for defining a (global) order for nodes
|
| Fields inherited from interface y.layout.Layouter |
|---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, NODE_TYPE_DPKEY, SELECTED_EDGES, SELECTED_NODES |
| Constructor Summary | |
|---|---|
NormalizingGraphElementOrderStage()
Creates a new NormalizingGraphElementOrderStage instance with default settings. |
|
NormalizingGraphElementOrderStage(Layouter coreLayouter)
Creates a new NormalizingGraphElementOrderStage instance using the given
core layout algorithm. |
|
| Method Summary | |
|---|---|
boolean |
canLayout(LayoutGraph graph)
Accepts all general graphs. |
void |
doLayout(LayoutGraph graph)
Enforces the specified order of nodes and order
of edges before invoking the core layout algorithm. |
static void |
fillComparableMapFromGraph(Graph graph,
DataMap comparableNodeMap,
DataMap comparableEdgeMap)
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 |
|---|
public static final java.lang.Object COMPARABLE_NODE_DPKEY
DataProvider key for defining a (global) order for nodes
public static final java.lang.Object COMPARABLE_EDGE_DPKEY
DataProvider key for defining a (global) order for edges
| Constructor Detail |
|---|
public NormalizingGraphElementOrderStage()
NormalizingGraphElementOrderStage instance with default settings.
public NormalizingGraphElementOrderStage(Layouter coreLayouter)
NormalizingGraphElementOrderStage instance using the given
core layout algorithm.
coreLayouter - the core layout routine| Method Detail |
|---|
public boolean canLayout(LayoutGraph graph)
graph - the input graph
true for every graphLayouter.doLayout(LayoutGraph)public void doLayout(LayoutGraph graph)
order of nodes and order
of edges before invoking the core layout algorithm.
graph - the input graph
java.lang.IllegalStateException - if there is no DataProvider registered for one of the keys
COMPARABLE_NODE_DPKEY and COMPARABLE_EDGE_DPKEYCOMPARABLE_NODE_DPKEY,
COMPARABLE_EDGE_DPKEY
public static void fillComparableMapFromGraph(Graph graph,
DataMap comparableNodeMap,
DataMap comparableEdgeMap)
The compared values are induced from the current ordering of the nodes and edges within the given graph.
This is a convenient method to fill the given DataMaps which can then be registered with the graph with
keys COMPARABLE_NODE_DPKEY and COMPARABLE_EDGE_DPKEY and used for several layout calculations.
graph - the input graphcomparableNodeMap - the map that will be filled with comparable values for the nodescomparableEdgeMap - the map that will be filled with comparable values for the edges
|
© Copyright 2000-2025, yWorks GmbH. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||