|
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.EdgeReversalStage
public class EdgeReversalStage
EdgeReversalStage
selectively reverses edges in a graph,
while keeping the layout and label positions of the reversed edges
as close to the pre-reversal layout and positions as possible.
Field Summary | |
---|---|
static java.lang.Object |
REVERSE_EDGES_DPKEY
A DataProvider key for selecting edges for reversal
|
Fields inherited from interface y.layout.Layouter |
---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, NODE_TYPE_DPKEY, SELECTED_EDGES, SELECTED_NODES |
Constructor Summary | |
---|---|
EdgeReversalStage()
Creates a new EdgeReversalStage instance with default settings. |
|
EdgeReversalStage(Layouter coreLayouter)
Creates a new EdgeReversalStage instance using the given algorithm
as core layout algorithm . |
Method Summary | |
---|---|
boolean |
canLayout(LayoutGraph graph)
Accepts all graphs that can be handled by the core layout algorithm . |
void |
doLayout(LayoutGraph graph)
Reverses all selected edges before calling the core layout algorithm and
restores the original edge direction after the core layout algorithm has finished. |
static void |
findReversedTreeEdges(LayoutGraph graph,
Node root,
DataAcceptor reversedEdges)
Marks edges in a tree-structured graph component that need to be reversed to make the specified node the root of the tree component. |
void |
reverseEdge(LayoutGraph graph,
Edge edge)
Reverses the specified edge in the specified graph. |
void |
reverseEdges(LayoutGraph graph)
Reverses selected edges in the specified 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 REVERSE_EDGES_DPKEY
DataProvider
key for selecting edges for reversal
DataProvider
registered with this key, all edges are reversed.Constructor Detail |
---|
public EdgeReversalStage()
EdgeReversalStage
instance with default settings.
public EdgeReversalStage(Layouter coreLayouter)
EdgeReversalStage
instance using the given algorithm
as core layout algorithm
.
coreLayouter
- the core layout algorithmAbstractLayoutStage.setCoreLayouter(Layouter)
Method Detail |
---|
public boolean canLayout(LayoutGraph graph)
core layout algorithm
.
If there is no core layout algorithm
, all graphs are accepted.
graph
- 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)
core layout algorithm
and
restores the original edge direction after the core layout algorithm has finished.
graph
- the input graphLayouter.canLayout(LayoutGraph)
public void reverseEdges(LayoutGraph graph)
DataProvider
registered with REVERSE_EDGES_DPKEY
.
Implementation detail: This method calls reverseEdge(LayoutGraph, Edge)
in order to reverse a
selected edge.
graph
- the graph in which to reverse edges.REVERSE_EDGES_DPKEY
,
reverseEdge(LayoutGraph, Edge)
public void reverseEdge(LayoutGraph graph, Edge edge)
LayoutTool.reverseEdgeLayout(EdgeLayout)
.
Moreover, the positions of all labels associated with the specified edge
are adjusted to match the pre-reversal position as closely as possible.
(Depending on a label's model it might not always be possible to achieve
an exact match.)
graph
- the graph to which the specified edge belongsedge
- the edge to be reversedLayoutTool.reverseEdgeLayout(EdgeLayout)
public static void findReversedTreeEdges(LayoutGraph graph, Node root, DataAcceptor reversedEdges)
graph
- the graph to which the specified node belongsroot
- the node to be considered the root of its tree componentreversedEdges
- a DataAcceptor
to mark edges for reversal
java.lang.IllegalArgumentException
- if the specified root node is null
or does not belong to
the specified graphREVERSE_EDGES_DPKEY
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |