|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.CanonicMultiStageLayouter y.layout.tree.HVTreeLayouter
public class HVTreeLayouter
The HVTreeLayouter
arranges the subgraphs of a tree horizontally and vertically.
The layout algorithm starts from the root and recursively assigns coordinates to all tree nodes. In this manner, leaf nodes will be placed first, while each parent node is placed centered above its children.
SUBTREE_ORIENTATION
can be used to register a DataProvider
that specifies an orientation for each
subtree. If no DataProvider
is registered with this key, all subtrees are arranged horizontally.
A custom node can be defined as root of the tree using a DataProvider
registered with the graph with
key SELECTED_ROOT_DPKEY
.
Field Summary | |
---|---|
protected LayoutGraph |
graph
The layout graph being acted upon. |
static java.lang.Object |
HORIZONTAL_SUBTREE
A subtree orientation specifier indicating that the subtree rooted at the associated node should be arranged horizontally. |
static java.lang.Object |
SELECTED_ROOT_DPKEY
A DataProvider key for marking the node that will be used as root node of the tree.
|
static java.lang.Object |
SUBTREE_ORIENTATION
A DataProvider key for specifying a horizontal or vertical orientation for each subtree
|
static java.lang.Object |
VERTICAL_SUBTREE
A subtree orientation specifier indicating that the subtree rooted at the associated node should be arranged vertically. |
Fields inherited from interface y.layout.Layouter |
---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, NODE_TYPE_DPKEY, SELECTED_EDGES, SELECTED_NODES |
Constructor Summary | |
---|---|
HVTreeLayouter()
Creates a new HVTreeLayouter instance with default settings. |
Method Summary | |
---|---|
boolean |
canLayoutCore(LayoutGraph graph)
Accepts all graphs with a tree structure. |
void |
doLayoutCore(LayoutGraph graph)
Arranges the tree in horizontal and vertical subtrees. |
java.util.Comparator |
getComparator()
Returns the Comparator that will be used for sorting the outgoing edges
of each local root in the tree before they are being arranged. |
double |
getHorizontalSpace()
Returns the horizontal distance between adjacent nodes. |
protected NodeCursor |
getSuccessors(Node localRoot)
Retrieves all children of the given local root. |
double |
getVerticalSpace()
Returns the vertical distance between adjacent nodes. |
protected boolean |
isHorizontalRoot(Node localRoot)
Determines whether or not the subtree rooted at the given node should be arranged horizontally. |
protected boolean |
isVerticalRoot(Node localRoot)
Determines whether or not the subtree rooted at the given node should be arranged vertically. |
void |
setComparator(java.util.Comparator comparator)
Specifies the Comparator that will be used for sorting the outgoing edges
of each local root in the tree before they are being arranged. |
void |
setComponentLayouterEnabled(boolean enabled)
Specifies whether or not the LayoutStage used for arranging the components of the graph is activated. |
void |
setGroupNodeHidingEnabled(boolean groupNodeHidingEnabled)
Specifies whether or not the LayoutStage used for hiding group nodes is activated. |
void |
setHorizontalSpace(double distance)
Specifies the horizontal distance between adjacent nodes. |
void |
setParallelEdgeLayouterEnabled(boolean enabled)
Specifies whether or not the LayoutStage used for routing parallel edges is activated. |
void |
setSelfLoopLayouterEnabled(boolean enabled)
Specifies whether or not the LayoutStage used for routing self-loops is activated. |
void |
setVerticalSpace(double distance)
Specifies the vertical distance between adjacent nodes. |
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 SUBTREE_ORIENTATION
DataProvider
key for specifying a horizontal or vertical orientation for each subtree
DataProvider
is registered with this key, then all subtrees are considered horizontal.public static final java.lang.Object HORIZONTAL_SUBTREE
public static final java.lang.Object VERTICAL_SUBTREE
public static final java.lang.Object SELECTED_ROOT_DPKEY
DataProvider
key for marking the node that will be used as root node of the tree.
protected LayoutGraph graph
Constructor Detail |
---|
public HVTreeLayouter()
HVTreeLayouter
instance with default settings.
Method Detail |
---|
public void setHorizontalSpace(double distance)
The distance needs to be non-negative.
public double getHorizontalSpace()
The distance needs to be non-negative.
setHorizontalSpace(double)
public void setVerticalSpace(double distance)
The distance needs to be non-negative.
public double getVerticalSpace()
The distance needs to be non-negative.
setVerticalSpace(double)
public void setComponentLayouterEnabled(boolean enabled)
LayoutStage
used for arranging the components of the graph is activated.
setComponentLayouterEnabled
in class CanonicMultiStageLayouter
HVTreeLayouter
can only handle single components. Disabling ComponentLayouter
will lead to errors during execution.enabled
- true
if the stage that arranges the graph components is activated,
false
otherwiseCanonicMultiStageLayouter.isComponentLayouterEnabled()
,
CanonicMultiStageLayouter.setComponentLayouter(LayoutStage)
,
ComponentLayouter
public void setGroupNodeHidingEnabled(boolean groupNodeHidingEnabled)
LayoutStage
used for hiding group nodes is activated.
setGroupNodeHidingEnabled
in class CanonicMultiStageLayouter
HVTreeLayouter
cannot handle group nodes. Disabling GroupNodeHider
will lead to errors
during execution.groupNodeHidingEnabled
- true
if the stage used for hiding group nodes is activated,
false
otherwiseCanonicMultiStageLayouter.isGroupNodeHidingEnabled()
,
CanonicMultiStageLayouter.setGroupNodeHider(LayoutStage)
,
GroupNodeHider
public void setParallelEdgeLayouterEnabled(boolean enabled)
LayoutStage
used for routing parallel edges is activated.
setParallelEdgeLayouterEnabled
in class CanonicMultiStageLayouter
HVTreeLayouter
cannot handle parallel edges. Disabling ParallelEdgeLayouter
will lead to errors during execution.enabled
- true
if the stage responsible for routing parallel edges is activated,
false
otherwiseCanonicMultiStageLayouter.isParallelEdgeLayouterEnabled()
,
CanonicMultiStageLayouter.setParallelEdgeLayouter(LayoutStage)
,
ParallelEdgeLayouter
public void setSelfLoopLayouterEnabled(boolean enabled)
LayoutStage
used for routing self-loops is activated.
setSelfLoopLayouterEnabled
in class CanonicMultiStageLayouter
HVTreeLayouter
cannot handle self-loops. Disabling SelfLoopLayouter
will lead
to errors during execution.enabled
- true
if the stage responsible for routing self-loops is activated, false
otherwiseCanonicMultiStageLayouter.isSelfLoopLayouterEnabled()
,
CanonicMultiStageLayouter.setSelfLoopLayouter(LayoutStage)
,
SelfLoopLayouter
public void doLayoutCore(LayoutGraph graph)
doLayoutCore
in class CanonicMultiStageLayouter
graph
- the input graph
WrongGraphStructure
- if the input graph is not a treepublic boolean canLayoutCore(LayoutGraph graph)
canLayoutCore
in class CanonicMultiStageLayouter
graph
- the input graph
true
if the given graph is a tree, false
otherwiseTrees.isTree(y.base.Graph)
protected boolean isVerticalRoot(Node localRoot)
The orientation is retrieved from a DataProvider
registered with SUBTREE_ORIENTATION
. If no
orientation is specified for this node, it is not a vertical root.
This method is called by doLayoutCore(LayoutGraph)
, before arranging a subtree. It may be overridden to
customize the selection of vertical subtrees.
localRoot
- the local root of a subtree
true
if the subtree of the local root is vertical, false
otherwiseisHorizontalRoot(Node)
protected boolean isHorizontalRoot(Node localRoot)
The orientation is retrieved from a DataProvider
registered with SUBTREE_ORIENTATION
. If no
orientation is specified for this node, it is not a horizontal root.
This method is called by doLayoutCore(LayoutGraph)
, before arranging a subtree. It may be overridden to
customize the selection of horizontal subtrees.
localRoot
- the local root of a subtree
true
if the subtree of the local root is horizontal, false
otherwiseisVerticalRoot(Node)
protected NodeCursor getSuccessors(Node localRoot)
This method is called by doLayoutCore(LayoutGraph)
to arrange the subtrees below the local root.
localRoot
- the root of a subtree
public java.util.Comparator getComparator()
Comparator
that will be used for sorting the outgoing edges
of each local root in the tree before they are being arranged.
Comparator
or null
if the default order should be usedsetComparator(Comparator)
public void setComparator(java.util.Comparator comparator)
Comparator
that will be used for sorting the outgoing edges
of each local root in the tree before they are being arranged.
comparator
- a Comparator
or null
if the default order should be used
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |