|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.AbstractLayoutStage y.layout.LayoutMultiplexer
public class LayoutMultiplexer
A LayoutMultiplexer
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 DataProvider
is registered with the given graph using the look-up key LAYOUTER_DPKEY
,
it is used for retrieving the Layouter
objects that are stored for the graph's
nodes.
If no such DataProvider
is registered, this layout stage's core layout algorithm
(if any) is used for the layout calculation of all nodes.
Note that the first non-null
Layouter
instance retrieved from the DataProvider
is used for all nodes.
The main purpose of this class is to enable the use of individual layout algorithms
for different components (when used as the core layout algorithm of ComponentLayouter
)
or for the contents of group nodes (when used as the core layout algorithm of
RecursiveGroupLayouter
).
Field Summary | |
---|---|
static java.lang.Object |
LAYOUTER_DPKEY
A DataProvider key for assigning layout algorithms to the nodes
At runtime, the layout algorithms are determined and applied to the current graph. |
Fields inherited from interface y.layout.Layouter |
---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, NODE_TYPE_DPKEY, SELECTED_EDGES, SELECTED_NODES |
Constructor Summary | |
---|---|
LayoutMultiplexer()
Creates a new instance of LayoutMultiplexer . |
Method Summary | |
---|---|
boolean |
canLayout(LayoutGraph graph)
Accepts all general graphs. |
void |
doLayout(LayoutGraph graph)
Retrieves and invokes the layout algorithm that is assigned to the 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 |
---|
public static final java.lang.Object LAYOUTER_DPKEY
DataProvider
key for assigning layout algorithms to the nodes
At runtime, the layout algorithms are determined and applied to the current graph. The first
non-null
Layouter
instance is used for the whole graph.
Constructor Detail |
---|
public LayoutMultiplexer()
LayoutMultiplexer
.
Method Detail |
---|
public boolean canLayout(LayoutGraph graph)
graph
- the input graph
true
if the graph is not null
, false
otherwiseLayouter.doLayout(LayoutGraph)
public void doLayout(LayoutGraph graph)
layout algorithm
that is assigned to the graph.
graph
- the input graphLayouter.canLayout(LayoutGraph)
protected Layouter getCoreLayouter(LayoutGraph graph)
This implementation looks up the layout algorithm in the DataProvider
registered with the key
LAYOUTER_DPKEY
.
The first non-null
layout algorithm
instance found for a node of the given
graph will be returned by this method. If no algorithm is registered at all, it will fall back to the
default core layout algorithm
.
This method is called in doLayout(LayoutGraph)
and may be overridden to implement a different
way of selecting the layout algorithms
.
graph
- the input graph
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |