Package com.mxgraph.layout
Class mxCompactTreeLayout
java.lang.Object
com.mxgraph.layout.mxGraphLayout
com.mxgraph.layout.mxCompactTreeLayout
- All Implemented Interfaces:
mxIGraphLayout
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classprotected static classprotected static classprotected classA utility class used to track cells whilst sorting occurs on the weighted sum of their connected edges. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intThe size of the vertical buffer in the center of inter-rank channels where edge control points should not be placedprotected booleanWhether or not to apply the internal tree edge routingprotected intPadding added to resized parentsprotected booleanSpecifies the orientation of the layout.protected booleanSpecifies if edge directions should be inverted.protected intHolds the levelDistance.protected intThe minimum distance for an edge jetty from a vertexprotected booleanSpecifies if the tree should be moved to the top, left corner if it is inside a top-level layer.protected intHolds the nodeDistance.A set of the parents that need updating based on children process as part of the layoutprotected intThe preferred horizontal distance between edges exiting a vertexprotected intThe preferred vertical offset between edges exiting a vertexprotected booleanSpecifies if all edge points of traversed edges should be removed.protected booleanIf the parents should be resized to match the width/height of the children.Fields inherited from class com.mxgraph.layout.mxGraphLayout
graph, parent, useBoundingBox -
Constructor Summary
ConstructorsConstructorDescriptionmxCompactTreeLayout(mxGraph graph) mxCompactTreeLayout(mxGraph graph, boolean horizontal) mxCompactTreeLayout(mxGraph graph, boolean horizontal, boolean invert) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAdjust parent cells whose child geometries have changed.protected mxRectangleapply(mxCompactTreeLayout.TreeNode node, mxRectangle bounds) protected voidattachParent(mxCompactTreeLayout.TreeNode node, double height) protected mxCompactTreeLayout.Polylinebridge(mxCompactTreeLayout.Polyline line1, double x1, double y1, mxCompactTreeLayout.Polyline line2, double x2, double y2) protected mxCompactTreeLayout.PolylinecreateLine(double dx, double dy, mxCompactTreeLayout.Polyline next) protected mxCompactTreeLayout.TreeNodecreateNode(Object cell) protected mxCompactTreeLayout.TreeNodeDoes a depth first search starting at the specified cell.voidExecutes the layout for the children of the specified parent.voidImplements invalid input: '<'mxGraphLayout.execute>.findTreeRoots(Object parent, boolean invert) Returns all visible children in the given parent which do not have incoming edges.doubleintintprotected mxRectanglehorizontalLayout(mxCompactTreeLayout.TreeNode node, double x0, double y0, mxRectangle bounds) booleanbooleanbooleanisInvert()booleanbooleanbooleanbooleanisVertexIgnored(Object vertex) Returns a boolean indicating if the givenshould be ignored as a vertex. protected doubleprotected voidStarts the actual compact tree layout algorithm at the given node.protected voidprotected voidMoves the specified node and all of its children by the given amount.protected doubleprotected voidmoveNode(mxCompactTreeLayout.TreeNode node, double dx, double dy) Moves the specified node and all of its children by the given amount.protected doubleoffset(double p1, double p2, double a1, double a2, double b1, double b2) protected voidSeparates the x position of edges as they connect to verticesvoidsetEdgeRouting(boolean edgeRouting) voidsetGroupPadding(int groupPadding) voidsetHorizontal(boolean horizontal) voidsetInvert(boolean invert) voidsetLevelDistance(int levelDistance) voidsetMoveTree(boolean moveTree) voidsetNodeDistance(int nodeDistance) voidsetResetEdges(boolean resetEdges) voidsetResizeParent(boolean resizeParent) protected mxRectangleverticalLayout(mxCompactTreeLayout.TreeNode node, Object parent, double x0, double y0, mxRectangle bounds) Methods inherited from class com.mxgraph.layout.mxGraphLayout
arrangeGroups, getConstraint, getConstraint, getGraph, getParentOffset, getVertexBounds, isEdgeIgnored, isUseBoundingBox, isVertexMovable, moveCell, setEdgePoints, setEdgeStyleEnabled, setOrthogonalEdge, setUseBoundingBox, setVertexLocation
-
Field Details
-
horizontal
protected boolean horizontalSpecifies the orientation of the layout. Default is true. -
invert
protected boolean invertSpecifies if edge directions should be inverted. Default is false. -
resizeParent
protected boolean resizeParentIf the parents should be resized to match the width/height of the children. Default is true. -
groupPadding
protected int groupPaddingPadding added to resized parents -
parentsChanged
A set of the parents that need updating based on children process as part of the layout -
moveTree
protected boolean moveTreeSpecifies if the tree should be moved to the top, left corner if it is inside a top-level layer. Default is false. -
resetEdges
protected boolean resetEdgesSpecifies if all edge points of traversed edges should be removed. Default is true. -
levelDistance
protected int levelDistanceHolds the levelDistance. Default is 10. -
nodeDistance
protected int nodeDistanceHolds the nodeDistance. Default is 20. -
prefHozEdgeSep
protected int prefHozEdgeSepThe preferred horizontal distance between edges exiting a vertex -
prefVertEdgeOff
protected int prefVertEdgeOffThe preferred vertical offset between edges exiting a vertex -
minEdgeJetty
protected int minEdgeJettyThe minimum distance for an edge jetty from a vertex -
channelBuffer
protected int channelBufferThe size of the vertical buffer in the center of inter-rank channels where edge control points should not be placed -
edgeRouting
protected boolean edgeRoutingWhether or not to apply the internal tree edge routing
-
-
Constructor Details
-
mxCompactTreeLayout
- Parameters:
graph-
-
mxCompactTreeLayout
- Parameters:
graph-horizontal-
-
mxCompactTreeLayout
- Parameters:
graph-horizontal-invert-
-
-
Method Details
-
isVertexIgnored
Returns a boolean indicating if the givenshould be ignored as a vertex. This returns true if the cell has no connections. - Overrides:
isVertexIgnoredin classmxGraphLayout- Parameters:
vertex- Object that represents the vertex to be tested.- Returns:
- Returns true if the vertex should be ignored.
-
isHorizontal
public boolean isHorizontal()- Returns:
- the horizontal
-
setHorizontal
public void setHorizontal(boolean horizontal) - Parameters:
horizontal- the horizontal to set
-
isInvert
public boolean isInvert()- Returns:
- the invert
-
setInvert
public void setInvert(boolean invert) - Parameters:
invert- the invert to set
-
isResizeParent
public boolean isResizeParent()- Returns:
- the resizeParent
-
setResizeParent
public void setResizeParent(boolean resizeParent) - Parameters:
resizeParent- the resizeParent to set
-
isMoveTree
public boolean isMoveTree()- Returns:
- the moveTree
-
setMoveTree
public void setMoveTree(boolean moveTree) - Parameters:
moveTree- the moveTree to set
-
isResetEdges
public boolean isResetEdges()- Returns:
- the resetEdges
-
setResetEdges
public void setResetEdges(boolean resetEdges) - Parameters:
resetEdges- the resetEdges to set
-
isEdgeRouting
public boolean isEdgeRouting() -
setEdgeRouting
public void setEdgeRouting(boolean edgeRouting) -
getLevelDistance
public int getLevelDistance()- Returns:
- the levelDistance
-
setLevelDistance
public void setLevelDistance(int levelDistance) - Parameters:
levelDistance- the levelDistance to set
-
getNodeDistance
public int getNodeDistance()- Returns:
- the nodeDistance
-
setNodeDistance
public void setNodeDistance(int nodeDistance) - Parameters:
nodeDistance- the nodeDistance to set
-
getGroupPadding
public double getGroupPadding() -
setGroupPadding
public void setGroupPadding(int groupPadding) -
execute
Description copied from interface:mxIGraphLayoutExecutes the layout for the children of the specified parent.- Specified by:
executein interfacemxIGraphLayout- Overrides:
executein classmxGraphLayout- Parameters:
parent- Parent cell that contains the children to be layed out.
-
execute
Implements invalid input: '<'mxGraphLayout.execute>. If the parent has any connected edges, then it is used as the root of the tree. Else, invalid input: '<'mxGraph.findTreeRoots> will be used to find a suitable root node within the set of children of the given parent. -
findTreeRoots
Returns all visible children in the given parent which do not have incoming edges. If the result is empty then the children with the maximum difference between incoming and outgoing edges are returned. This takes into account edges that are being promoted to the given root due to invisible children or collapsed cells.- Parameters:
parent- Cell whose children should be checked.invert- Specifies if outgoing or incoming edges should be counted for a tree root. If false then outgoing edges will be counted.- Returns:
- List of tree roots in parent.
-
moveNode
Moves the specified node and all of its children by the given amount. -
dfs
Does a depth first search starting at the specified cell. Makes sure the specified parent is never left by the algorithm. -
layout
Starts the actual compact tree layout algorithm at the given node. -
horizontalLayout
protected mxRectangle horizontalLayout(mxCompactTreeLayout.TreeNode node, double x0, double y0, mxRectangle bounds) -
verticalLayout
protected mxRectangle verticalLayout(mxCompactTreeLayout.TreeNode node, Object parent, double x0, double y0, mxRectangle bounds) -
attachParent
-
layoutLeaf
-
join
-
merge
-
offset
protected double offset(double p1, double p2, double a1, double a2, double b1, double b2) -
bridge
protected mxCompactTreeLayout.Polyline bridge(mxCompactTreeLayout.Polyline line1, double x1, double y1, mxCompactTreeLayout.Polyline line2, double x2, double y2) -
createNode
-
apply
- Parameters:
node-bounds-- Returns:
-
createLine
protected mxCompactTreeLayout.Polyline createLine(double dx, double dy, mxCompactTreeLayout.Polyline next) -
adjustParents
protected void adjustParents()Adjust parent cells whose child geometries have changed. The default implementation adjusts the group to just fit around the children with a padding. -
localEdgeProcessing
Moves the specified node and all of its children by the given amount. -
processNodeOutgoing
Separates the x position of edges as they connect to vertices- Parameters:
node- the root node of the tree
-