Package com.mxgraph.layout.hierarchical
Class mxHierarchicalLayout
- java.lang.Object
- 
- com.mxgraph.layout.mxGraphLayout
- 
- com.mxgraph.layout.hierarchical.mxHierarchicalLayout
 
 
- 
- All Implemented Interfaces:
- mxIGraphLayout
 
 public class mxHierarchicalLayout extends mxGraphLayout The top level compound layout of the hierarchical layout. The individual elements of the layout are called in sequence.
- 
- 
Field SummaryFields Modifier and Type Field Description protected booleandisableEdgeStyleSpecifies if the STYLE_NOEDGESTYLE flag should be set on edges that are modified by the result.protected booleanfineTuningWhether or not to perform local optimisations and iterate multiple times through the algorithmprotected doubleinterHierarchySpacingThe spacing buffer between unconnected hierarchiesprotected doubleinterRankCellSpacingThe spacing buffer added between cell on adjacent layersprotected doubleintraCellSpacingThe spacing buffer added between cells on the same layerprotected mxGraphHierarchyModelmodelThe internal model formed of the layoutprotected booleanmoveParentSpecifies if the parnent should be moved if resizeParent is enabled.protected intorientationThe position of the root node(s) relative to the laid out graph in.protected doubleparallelEdgeSpacingThe distance between each parallel edge on each ranks for long edgesprotected intparentBorderThe border to be added around the children if the parent is to be resized using resizeParent.protected booleanresizeParentSpecifies if the parent should be resized after the layout so that it contains all the child cells.protected java.util.List<java.lang.Object>rootsThe root nodes of the layoutprotected booleantraverseAncestorsWhether or not to navigate edges whose terminal vertices have different parents but are in the same ancestry chain- 
Fields inherited from class com.mxgraph.layout.mxGraphLayoutgraph, parent, useBoundingBox
 
- 
 - 
Constructor SummaryConstructors Constructor Description mxHierarchicalLayout(mxGraph graph)Constructs a hierarchical layoutmxHierarchicalLayout(mxGraph graph, int orientation)Constructs a hierarchical layout
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcrossingStage(java.lang.Object parent)Executes the crossing stage using mxMedianHybridCrossingReduction.voidcycleStage(java.lang.Object parent)Executes the cycle stage.voidexecute(java.lang.Object parent)Executes the layout for the children of the specified parent.voidexecute(java.lang.Object parent, java.util.List<java.lang.Object> roots)Executes the layout for the children of the specified parent.java.util.Set<java.lang.Object>filterDescendants(java.lang.Object cell)Creates a set of descendant cellsjava.util.List<java.lang.Object>findRoots(java.lang.Object parent, java.util.Set<java.lang.Object> vertices)Returns all visible children in the given parent which do not have incoming edges.java.lang.Object[]getEdges(java.lang.Object cell)doublegetInterHierarchySpacing()doublegetInterRankCellSpacing()doublegetIntraCellSpacing()mxGraphHierarchyModelgetModel()Returns the model for this layout algorithm.intgetOrientation()doublegetParallelEdgeSpacing()intgetParentBorder()Returns parentBorder.booleanisDisableEdgeStyle()booleanisFineTuning()booleanisMoveParent()Returns the moveParent flag.booleanisResizeParent()Returns the resizeParent flag.voidlayeringStage()Implements first stage of a Sugiyama layout.doubleplacementStage(double initialX, java.lang.Object parent)Executes the placement stage using mxCoordinateAssignment.voidrun(java.lang.Object parent)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.voidsetDisableEdgeStyle(boolean disableEdgeStyle)voidsetFineTuning(boolean fineTuning)voidsetInterHierarchySpacing(double interHierarchySpacing)voidsetInterRankCellSpacing(double interRankCellSpacing)voidsetIntraCellSpacing(double intraCellSpacing)voidsetMoveParent(boolean value)Sets the moveParent flag.voidsetOrientation(int orientation)voidsetParallelEdgeSpacing(double parallelEdgeSpacing)voidsetParentBorder(int value)Sets parentBorder.voidsetResizeParent(boolean value)Sets the resizeParent flag.java.lang.StringtoString()ReturnsHierarchical, the name of this algorithm.protected voidtraverse(java.lang.Object vertex, boolean directed, java.lang.Object edge, java.util.Set<java.lang.Object> allVertices, java.util.Set<java.lang.Object> currentComp, java.util.List<java.util.Set<java.lang.Object>> hierarchyVertices, java.util.Set<java.lang.Object> filledVertexSet)Traverses the (directed) graph invoking the given function for each visited vertex and edge.- 
Methods inherited from class com.mxgraph.layout.mxGraphLayoutarrangeGroups, getConstraint, getConstraint, getGraph, getParentOffset, getVertexBounds, isEdgeIgnored, isUseBoundingBox, isVertexIgnored, isVertexMovable, moveCell, setEdgePoints, setEdgeStyleEnabled, setOrthogonalEdge, setUseBoundingBox, setVertexLocation
 
- 
 
- 
- 
- 
Field Detail- 
rootsprotected java.util.List<java.lang.Object> roots The root nodes of the layout
 - 
resizeParentprotected boolean resizeParent Specifies if the parent should be resized after the layout so that it contains all the child cells. Default is false. @See parentBorder.
 - 
moveParentprotected boolean moveParent Specifies if the parnent should be moved if resizeParent is enabled. Default is false. @See resizeParent.
 - 
parentBorderprotected int parentBorder The border to be added around the children if the parent is to be resized using resizeParent. Default is 0. @See resizeParent.
 - 
intraCellSpacingprotected double intraCellSpacing The spacing buffer added between cells on the same layer
 - 
interRankCellSpacingprotected double interRankCellSpacing The spacing buffer added between cell on adjacent layers
 - 
interHierarchySpacingprotected double interHierarchySpacing The spacing buffer between unconnected hierarchies
 - 
parallelEdgeSpacingprotected double parallelEdgeSpacing The distance between each parallel edge on each ranks for long edges
 - 
orientationprotected int orientation The position of the root node(s) relative to the laid out graph in. Default isSwingConstants.NORTH, i.e. top-down.
 - 
disableEdgeStyleprotected boolean disableEdgeStyle Specifies if the STYLE_NOEDGESTYLE flag should be set on edges that are modified by the result. Default is true.
 - 
fineTuningprotected boolean fineTuning Whether or not to perform local optimisations and iterate multiple times through the algorithm
 - 
traverseAncestorsprotected boolean traverseAncestors Whether or not to navigate edges whose terminal vertices have different parents but are in the same ancestry chain
 - 
modelprotected mxGraphHierarchyModel model The internal model formed of the layout
 
- 
 - 
Constructor Detail- 
mxHierarchicalLayoutpublic mxHierarchicalLayout(mxGraph graph) Constructs a hierarchical layout- Parameters:
- graph- the graph to lay out
 
 - 
mxHierarchicalLayoutpublic mxHierarchicalLayout(mxGraph graph, int orientation) Constructs a hierarchical layout- Parameters:
- graph- the graph to lay out
- orientation-- SwingConstants.NORTH, SwingConstants.EAST, SwingConstants.SOUTHor- SwingConstants.WEST
 
 
- 
 - 
Method Detail- 
getModelpublic mxGraphHierarchyModel getModel() Returns the model for this layout algorithm.
 - 
executepublic void execute(java.lang.Object parent) Executes the layout for the children of the specified parent.- Specified by:
- executein interface- mxIGraphLayout
- Overrides:
- executein class- mxGraphLayout
- Parameters:
- parent- Parent cell that contains the children to be laid out.
 
 - 
executepublic void execute(java.lang.Object parent, java.util.List<java.lang.Object> roots)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
 
 - 
findRootspublic java.util.List<java.lang.Object> findRoots(java.lang.Object parent, java.util.Set<java.lang.Object> vertices)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.
 
 - 
getEdgespublic java.lang.Object[] getEdges(java.lang.Object cell) - Parameters:
- cell-
- Returns:
 
 - 
runpublic void run(java.lang.Object parent) 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.
 - 
filterDescendantspublic java.util.Set<java.lang.Object> filterDescendants(java.lang.Object cell) 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)
 
 - 
traverseprotected void traverse(java.lang.Object vertex, boolean directed, java.lang.Object edge, java.util.Set<java.lang.Object> allVertices, java.util.Set<java.lang.Object> currentComp, java.util.List<java.util.Set<java.lang.Object>> hierarchyVertices, java.util.Set<java.lang.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- Optional- that represents the incoming edge. This is null for the first step of the traversal. 
- allVertices- Array of cell paths for the visited cells.
 
 - 
cycleStagepublic void cycleStage(java.lang.Object parent) Executes the cycle stage. This implementation uses the mxMinimumCycleRemover.
 - 
layeringStagepublic void layeringStage() Implements first stage of a Sugiyama layout.
 - 
crossingStagepublic void crossingStage(java.lang.Object parent) Executes the crossing stage using mxMedianHybridCrossingReduction.
 - 
placementStagepublic double placementStage(double initialX, java.lang.Object parent)Executes the placement stage using mxCoordinateAssignment.
 - 
isResizeParentpublic boolean isResizeParent() Returns the resizeParent flag.
 - 
setResizeParentpublic void setResizeParent(boolean value) Sets the resizeParent flag.
 - 
isMoveParentpublic boolean isMoveParent() Returns the moveParent flag.
 - 
setMoveParentpublic void setMoveParent(boolean value) Sets the moveParent flag.
 - 
getParentBorderpublic int getParentBorder() Returns parentBorder.
 - 
setParentBorderpublic void setParentBorder(int value) Sets parentBorder.
 - 
getIntraCellSpacingpublic double getIntraCellSpacing() - Returns:
- Returns the intraCellSpacing.
 
 - 
setIntraCellSpacingpublic void setIntraCellSpacing(double intraCellSpacing) - Parameters:
- intraCellSpacing- The intraCellSpacing to set.
 
 - 
getInterRankCellSpacingpublic double getInterRankCellSpacing() - Returns:
- Returns the interRankCellSpacing.
 
 - 
setInterRankCellSpacingpublic void setInterRankCellSpacing(double interRankCellSpacing) - Parameters:
- interRankCellSpacing- The interRankCellSpacing to set.
 
 - 
getOrientationpublic int getOrientation() - Returns:
- Returns the orientation.
 
 - 
setOrientationpublic void setOrientation(int orientation) - Parameters:
- orientation- The orientation to set.
 
 - 
getInterHierarchySpacingpublic double getInterHierarchySpacing() - Returns:
- Returns the interHierarchySpacing.
 
 - 
setInterHierarchySpacingpublic void setInterHierarchySpacing(double interHierarchySpacing) - Parameters:
- interHierarchySpacing- The interHierarchySpacing to set.
 
 - 
getParallelEdgeSpacingpublic double getParallelEdgeSpacing() 
 - 
setParallelEdgeSpacingpublic void setParallelEdgeSpacing(double parallelEdgeSpacing) 
 - 
isFineTuningpublic boolean isFineTuning() - Returns:
- Returns the fineTuning.
 
 - 
setFineTuningpublic void setFineTuning(boolean fineTuning) - Parameters:
- fineTuning- The fineTuning to set.
 
 - 
isDisableEdgeStylepublic boolean isDisableEdgeStyle() 
 - 
setDisableEdgeStylepublic void setDisableEdgeStyle(boolean disableEdgeStyle) - Parameters:
- disableEdgeStyle-
 
 - 
toStringpublic java.lang.String toString() ReturnsHierarchical, the name of this algorithm.- Overrides:
- toStringin class- java.lang.Object
 
 
- 
 
-