|
Search this API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecty.layout.BendConverter
public class BendConverter
BendConverter replaces edge bends with dummy nodes for the core layout algorithm.
Replacing the bends works in three steps:
core layout algorithm on the altered graph
When the dummy elements have been inserted, edge information about
port constraints, edge groups and
selection state can be adopted from the original edges. That way, the
core layout algorithm can access the mentioned information.
![]() |
![]() |
| Field Summary | |
|---|---|
static java.lang.Object |
SCOPE_DPKEY
A DataProvider key for specifying the set of edges for which this stage will replace bends
Only the bends of the marked edges will be replaced with dummy nodes. |
| Fields inherited from interface y.layout.Layouter |
|---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, NODE_TYPE_DPKEY, SELECTED_EDGES, SELECTED_NODES |
| Constructor Summary | |
|---|---|
BendConverter()
Creates a new BendConverter instance with default settings. |
|
BendConverter(double size)
Creates a new BendConverter instance with the given size as
the width and height for the dummy nodes. |
|
BendConverter(Layouter core)
Creates a new instance of BendConverter with the given core layout algorithm. |
|
| Method Summary | |
|---|---|
protected void |
addedPathForEdge(LayoutGraph graph,
Edge edge,
NodeList dummyNodes)
Adds information to newly created dummy nodes. |
boolean |
canLayout(LayoutGraph graph)
Accepts all graphs that can be handled by the core layout algorithm. |
void |
doLayout(LayoutGraph graph)
Replaces all bends in the current scope with dummy nodes before invoking the
core layout algorithm. |
Layouter |
getCoreLayouter()
Returns the core layout algorithm that is wrapped by this LayoutStage. |
java.lang.Object |
getSelectedEdgesDpKey()
Returns the key to register a DataProvider which identifies edges as selected. |
boolean |
isAdoptEdgeGroupsEnabled()
Returns whether or not edge grouping information of the original edge should be adopted by its replacement edges. |
boolean |
isAdoptPortConstraintsEnabled()
Returns whether or not the associated PortConstraints of the original edge
should be adopted by its replacement edges. |
boolean |
isAdoptSelectionEnabled()
Returns whether or not the selection state of the original edge should be adopted by its replacement edges. |
protected void |
prepare(LayoutGraph graph)
Prepares the graph before calling the core layout algorithm. |
void |
setAdoptEdgeGroupsEnabled(boolean adoptEdgeGroupsEnabled)
Specifies whether or not edge grouping information of the original edge should be adopted by its replacement edges. |
void |
setAdoptPortConstraintsEnabled(boolean adoptPortConstraintsEnabled)
Specifies whether or not the associated PortConstraints of the original edge
should be adopted by its replacement edges. |
void |
setAdoptSelectionEnabled(boolean adoptSelectionEnabled)
Specifies whether or not the selection state of the original edge should be adopted by its replacement edges. |
void |
setCoreLayouter(Layouter layouter)
Specifies the core layout algorithm that is wrapped by this LayoutStage. |
void |
setSelectedEdgesDpKey(java.lang.Object key)
Specifies the key to register a DataProvider which identifies edges as selected. |
protected void |
unprepare(LayoutGraph graph)
Restores the structure of the graph after the core layout algorithm has finished. |
| 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 SCOPE_DPKEY
DataProvider key for specifying the set of edges for which this stage will replace bends
Only the bends of the marked edges will be replaced with dummy nodes.
DataProvider is registered with this key, the bends of all edges are replaced.| Constructor Detail |
|---|
public BendConverter()
BendConverter instance with default settings.
public BendConverter(Layouter core)
BendConverter with the given core layout algorithm.
core - the core layout algorithmpublic BendConverter(double size)
BendConverter instance with the given size as
the width and height for the dummy nodes.
size - the size for the dummy nodes
java.lang.IllegalArgumentException - if the given size is negative| Method Detail |
|---|
public boolean canLayout(LayoutGraph graph)
core layout algorithm.
If there is no core layout algorithm, all graphs are accepted.
canLayout in interface Layoutergraph - the input graph
true if there is no core layout algorithm or the core layout algorithm accepts the graph,
false otherwiseLayouter.doLayout(LayoutGraph)public void doLayout(LayoutGraph graph)
scope with dummy nodes before invoking the
core layout algorithm.
After the core layout algorithm has finished, the edges between the dummy nodes are
reconnected and the dummy nodes are replaced by bends again.
doLayout in interface Layoutergraph - the input graphLayouter.canLayout(LayoutGraph)protected void prepare(LayoutGraph graph)
core layout algorithm.
The bends of the edges belonging to the current scope are replaced by dummy nodes and the segments between those dummy nodes are replaced by dummy edges.
Edge-specific information like PortConstraints, edge groups or selection state can be applied to the
dummy edges to keep this information for the core layout algorithm.
This method is called by doLayout(LayoutGraph) before invoking the
core layout algorithm. It may be overridden to extend the edge-specific information
that should be adopted by the dummy edges.
unprepare(LayoutGraph).graph - the input graphunprepare(LayoutGraph),
setAdoptSelectionEnabled(boolean),
setAdoptPortConstraintsEnabled(boolean),
setAdoptEdgeGroupsEnabled(boolean)protected void unprepare(LayoutGraph graph)
core layout algorithm has finished.
This method is called by doLayout(LayoutGraph) after invoking the
core layout algorithm. It may be overridden to clean up all additional information
added in prepare(LayoutGraph).
prepare(LayoutGraph) should be reverted by this method.graph - the graph arranged by the core layout algorithmprepare(LayoutGraph),
setAdoptSelectionEnabled(boolean),
setAdoptPortConstraintsEnabled(boolean),
setAdoptEdgeGroupsEnabled(boolean)public Layouter getCoreLayouter()
LayoutStage.
getCoreLayouter in interface LayoutStagesetCoreLayouter(Layouter)public void setCoreLayouter(Layouter layouter)
LayoutStage.
setCoreLayouter in interface LayoutStagelayouter - the core layout routinepublic boolean isAdoptEdgeGroupsEnabled()
true if dummy edges get the edge grouping information from their corresponding originals,
false otherwisesetAdoptEdgeGroupsEnabled(boolean),
PortConstraintKeys.SOURCE_GROUPID_KEY,
PortConstraintKeys.TARGET_GROUPID_KEYpublic void setAdoptEdgeGroupsEnabled(boolean adoptEdgeGroupsEnabled)
adoptEdgeGroupsEnabled - true if dummy edges should get the edge grouping information from their
corresponding originals, false otherwisePortConstraintKeys.SOURCE_GROUPID_KEY,
PortConstraintKeys.TARGET_GROUPID_KEYpublic boolean isAdoptPortConstraintsEnabled()
PortConstraints of the original edge
should be adopted by its replacement edges.
true if dummy edges get the PortConstraints of their corresponding originals,
false otherwisesetAdoptPortConstraintsEnabled(boolean),
PortConstraintKeys.SOURCE_PORT_CONSTRAINT_KEY,
PortConstraintKeys.TARGET_PORT_CONSTRAINT_KEYpublic void setAdoptPortConstraintsEnabled(boolean adoptPortConstraintsEnabled)
PortConstraints of the original edge
should be adopted by its replacement edges.
PortConstraints of the original edges are applied to the dummy edges.adoptPortConstraintsEnabled - true if dummy edges should get the PortConstraints of their
corresponding originals, false otherwisePortConstraintKeys.SOURCE_PORT_CONSTRAINT_KEY,
PortConstraintKeys.TARGET_PORT_CONSTRAINT_KEYpublic boolean isAdoptSelectionEnabled()
The selection state is looked up in a DataProvider registered with the key returned by
getSelectedEdgesDpKey().
true if dummy edges get the selection state of their corresponding original edge,
false otherwisesetAdoptSelectionEnabled(boolean),
getSelectedEdgesDpKey()public void setAdoptSelectionEnabled(boolean adoptSelectionEnabled)
The selection state is looked up in a DataProvider registered with the key returned by
getSelectedEdgesDpKey().
adoptSelectionEnabled - true if dummy edges should get the selection state of their corresponding
original edge, false otherwisegetSelectedEdgesDpKey()
protected void addedPathForEdge(LayoutGraph graph,
Edge edge,
NodeList dummyNodes)
This is a callback method that will be invoked after new elements for the given edge
have been added to the given graph by prepare(LayoutGraph). At this point, the original edge is still
in the graph.
The current implementation does nothing.
graph - the input graphedge - the edge whose bends were replaced by the given dummy nodesdummyNodes - the dummy nodes representing the bends of the edgepublic java.lang.Object getSelectedEdgesDpKey()
DataProvider which identifies edges as selected.
If the selection is conserved, the selection state described by the
DataProvider registered with this key is applied to the according dummy edges.
DataProvider keysetSelectedEdgesDpKey(Object),
setAdoptSelectionEnabled(boolean)public void setSelectedEdgesDpKey(java.lang.Object key)
DataProvider which identifies edges as selected.
If the selection is conserved, the selection state described by the
DataProvider registered with this key is applied to the according dummy edges.
Layouter.SELECTED_EDGESkey - the DataProvider key
java.lang.IllegalArgumentException - if the specified key is nullsetAdoptSelectionEnabled(boolean)
|
© Copyright 2000-2025, yWorks GmbH. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||