Package com.mxgraph.layout.hierarchical
Class mxHierarchicalLayout
java.lang.Object
com.mxgraph.layout.mxGraphLayout
com.mxgraph.layout.hierarchical.mxHierarchicalLayout
- All Implemented Interfaces:
mxIGraphLayout
The top level compound layout of the hierarchical layout. The individual
elements of the layout are called in sequence.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
Specifies if the STYLE_NOEDGESTYLE flag should be set on edges that are modified by the result.protected boolean
Whether or not to perform local optimisations and iterate multiple times through the algorithmprotected double
The spacing buffer between unconnected hierarchiesprotected double
The spacing buffer added between cell on adjacent layersprotected double
The spacing buffer added between cells on the same layerprotected mxGraphHierarchyModel
The internal model formed of the layoutprotected boolean
Specifies if the parnent should be moved if resizeParent is enabled.protected int
The position of the root node(s) relative to the laid out graph in.protected double
The distance between each parallel edge on each ranks for long edgesprotected int
The border to be added around the children if the parent is to be resized using resizeParent.protected boolean
Specifies if the parent should be resized after the layout so that it contains all the child cells.The root nodes of the layoutprotected boolean
Whether or not to navigate edges whose terminal vertices have different parents but are in the same ancestry chainFields inherited from class com.mxgraph.layout.mxGraphLayout
graph, parent, useBoundingBox
-
Constructor Summary
ConstructorsConstructorDescriptionmxHierarchicalLayout
(mxGraph graph) Constructs a hierarchical layoutmxHierarchicalLayout
(mxGraph graph, int orientation) Constructs a hierarchical layout -
Method Summary
Modifier and TypeMethodDescriptionvoid
crossingStage
(Object parent) Executes the crossing stage using mxMedianHybridCrossingReduction.void
cycleStage
(Object parent) Executes the cycle stage.void
Executes the layout for the children of the specified parent.void
Executes the layout for the children of the specified parent.filterDescendants
(Object cell) Creates a set of descendant cellsReturns all visible children in the given parent which do not have incoming edges.Object[]
double
double
double
getModel()
Returns the model for this layout algorithm.int
double
int
Returns parentBorder.boolean
boolean
boolean
Returns the moveParent flag.boolean
Returns the resizeParent flag.void
Implements first stage of a Sugiyama layout.double
placementStage
(double initialX, Object parent) Executes the placement stage using mxCoordinateAssignment.void
The API method used to exercise the layout upon the graph description and produce a separate description of the vertex position and edge routing changes made.void
setDisableEdgeStyle
(boolean disableEdgeStyle) void
setFineTuning
(boolean fineTuning) void
setInterHierarchySpacing
(double interHierarchySpacing) void
setInterRankCellSpacing
(double interRankCellSpacing) void
setIntraCellSpacing
(double intraCellSpacing) void
setMoveParent
(boolean value) Sets the moveParent flag.void
setOrientation
(int orientation) void
setParallelEdgeSpacing
(double parallelEdgeSpacing) void
setParentBorder
(int value) Sets parentBorder.void
setResizeParent
(boolean value) Sets the resizeParent flag.toString()
ReturnsHierarchical
, the name of this algorithm.protected void
traverse
(Object vertex, boolean directed, Object edge, Set<Object> allVertices, Set<Object> currentComp, List<Set<Object>> hierarchyVertices, Set<Object> filledVertexSet) Traverses the (directed) graph invoking the given function for each visited vertex and edge.Methods inherited from class com.mxgraph.layout.mxGraphLayout
arrangeGroups, getConstraint, getConstraint, getGraph, getParentOffset, getVertexBounds, isEdgeIgnored, isUseBoundingBox, isVertexIgnored, isVertexMovable, moveCell, setEdgePoints, setEdgeStyleEnabled, setOrthogonalEdge, setUseBoundingBox, setVertexLocation
-
Field Details
-
roots
The root nodes of the layout -
resizeParent
protected boolean resizeParentSpecifies if the parent should be resized after the layout so that it contains all the child cells. Default is false. @See parentBorder. -
moveParent
protected boolean moveParentSpecifies if the parnent should be moved if resizeParent is enabled. Default is false. @See resizeParent. -
parentBorder
protected int parentBorderThe border to be added around the children if the parent is to be resized using resizeParent. Default is 0. @See resizeParent. -
intraCellSpacing
protected double intraCellSpacingThe spacing buffer added between cells on the same layer -
interRankCellSpacing
protected double interRankCellSpacingThe spacing buffer added between cell on adjacent layers -
interHierarchySpacing
protected double interHierarchySpacingThe spacing buffer between unconnected hierarchies -
parallelEdgeSpacing
protected double parallelEdgeSpacingThe distance between each parallel edge on each ranks for long edges -
orientation
protected int orientationThe position of the root node(s) relative to the laid out graph in. Default isSwingConstants.NORTH
, i.e. top-down. -
disableEdgeStyle
protected boolean disableEdgeStyleSpecifies if the STYLE_NOEDGESTYLE flag should be set on edges that are modified by the result. Default is true. -
fineTuning
protected boolean fineTuningWhether or not to perform local optimisations and iterate multiple times through the algorithm -
traverseAncestors
protected boolean traverseAncestorsWhether or not to navigate edges whose terminal vertices have different parents but are in the same ancestry chain -
model
The internal model formed of the layout
-
-
Constructor Details
-
mxHierarchicalLayout
Constructs a hierarchical layout- Parameters:
graph
- the graph to lay out
-
mxHierarchicalLayout
Constructs a hierarchical layout- Parameters:
graph
- the graph to lay outorientation
-SwingConstants.NORTH, SwingConstants.EAST, SwingConstants.SOUTH
orSwingConstants.WEST
-
-
Method Details
-
getModel
Returns the model for this layout algorithm. -
execute
Executes the layout for the children of the specified parent.- Specified by:
execute
in interfacemxIGraphLayout
- Overrides:
execute
in classmxGraphLayout
- Parameters:
parent
- Parent cell that contains the children to be laid out.
-
execute
Executes the layout for the children of the specified parent.- Parameters:
parent
- Parent cell that contains the children to be laid out.roots
- the starting roots of the layout
-
findRoots
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.- Returns:
- List of tree roots in parent.
-
getEdges
- Parameters:
cell
-- Returns:
-
run
The API method used to exercise the layout upon the graph description and produce a separate description of the vertex position and edge routing changes made. -
filterDescendants
Creates a set of descendant cells- Parameters:
cell
- The cell whose descendants are to be calculated- Returns:
- the descendants of the cell (not the cell)
-
traverse
protected void traverse(Object vertex, boolean directed, Object edge, Set<Object> allVertices, Set<Object> currentComp, List<Set<Object>> hierarchyVertices, Set<Object> filledVertexSet) Traverses the (directed) graph invoking the given function for each visited vertex and edge. The function is invoked with the current vertex and the incoming edge as a parameter. This implementation makes sure each vertex is only visited once. The function may return false if the traversal should stop at the given vertex.- Parameters:
vertex
-that represents the vertex where the traversal starts. directed
- Optional boolean indicating if edges should only be traversed from source to target. Default is true.edge
- Optionalthat represents the incoming edge. This is null for the first step of the traversal. allVertices
- Array of cell paths for the visited cells.
-
cycleStage
Executes the cycle stage. This implementation uses the mxMinimumCycleRemover. -
layeringStage
public void layeringStage()Implements first stage of a Sugiyama layout. -
crossingStage
Executes the crossing stage using mxMedianHybridCrossingReduction. -
placementStage
Executes the placement stage using mxCoordinateAssignment. -
isResizeParent
public boolean isResizeParent()Returns the resizeParent flag. -
setResizeParent
public void setResizeParent(boolean value) Sets the resizeParent flag. -
isMoveParent
public boolean isMoveParent()Returns the moveParent flag. -
setMoveParent
public void setMoveParent(boolean value) Sets the moveParent flag. -
getParentBorder
public int getParentBorder()Returns parentBorder. -
setParentBorder
public void setParentBorder(int value) Sets parentBorder. -
getIntraCellSpacing
public double getIntraCellSpacing()- Returns:
- Returns the intraCellSpacing.
-
setIntraCellSpacing
public void setIntraCellSpacing(double intraCellSpacing) - Parameters:
intraCellSpacing
- The intraCellSpacing to set.
-
getInterRankCellSpacing
public double getInterRankCellSpacing()- Returns:
- Returns the interRankCellSpacing.
-
setInterRankCellSpacing
public void setInterRankCellSpacing(double interRankCellSpacing) - Parameters:
interRankCellSpacing
- The interRankCellSpacing to set.
-
getOrientation
public int getOrientation()- Returns:
- Returns the orientation.
-
setOrientation
public void setOrientation(int orientation) - Parameters:
orientation
- The orientation to set.
-
getInterHierarchySpacing
public double getInterHierarchySpacing()- Returns:
- Returns the interHierarchySpacing.
-
setInterHierarchySpacing
public void setInterHierarchySpacing(double interHierarchySpacing) - Parameters:
interHierarchySpacing
- The interHierarchySpacing to set.
-
getParallelEdgeSpacing
public double getParallelEdgeSpacing() -
setParallelEdgeSpacing
public void setParallelEdgeSpacing(double parallelEdgeSpacing) -
isFineTuning
public boolean isFineTuning()- Returns:
- Returns the fineTuning.
-
setFineTuning
public void setFineTuning(boolean fineTuning) - Parameters:
fineTuning
- The fineTuning to set.
-
isDisableEdgeStyle
public boolean isDisableEdgeStyle() -
setDisableEdgeStyle
public void setDisableEdgeStyle(boolean disableEdgeStyle) - Parameters:
disableEdgeStyle
-
-
toString
ReturnsHierarchical
, the name of this algorithm.
-