Class mxHierarchicalLayout

  • All Implemented Interfaces:

    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 Detail

      • roots

        protected java.util.List<java.lang.Object> roots
        The root nodes of the layout
      • resizeParent

        protected 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.
      • moveParent

        protected boolean moveParent
        Specifies if the parnent should be moved if resizeParent is enabled. Default is false. @See resizeParent.
      • parentBorder

        protected int parentBorder
        The border to be added around the children if the parent is to be resized using resizeParent. Default is 0. @See resizeParent.
      • intraCellSpacing

        protected double intraCellSpacing
        The spacing buffer added between cells on the same layer
      • interRankCellSpacing

        protected double interRankCellSpacing
        The spacing buffer added between cell on adjacent layers
      • interHierarchySpacing

        protected double interHierarchySpacing
        The spacing buffer between unconnected hierarchies
      • parallelEdgeSpacing

        protected double parallelEdgeSpacing
        The distance between each parallel edge on each ranks for long edges
      • orientation

        protected int orientation
        The position of the root node(s) relative to the laid out graph in. Default is SwingConstants.NORTH, i.e. top-down.
      • disableEdgeStyle

        protected boolean disableEdgeStyle
        Specifies if the STYLE_NOEDGESTYLE flag should be set on edges that are modified by the result. Default is true.
      • fineTuning

        protected boolean fineTuning
        Whether or not to perform local optimisations and iterate multiple times through the algorithm
      • traverseAncestors

        protected boolean traverseAncestors
        Whether or not to navigate edges whose terminal vertices have different parents but are in the same ancestry chain
    • Constructor Detail

      • mxHierarchicalLayout

        public mxHierarchicalLayout​(mxGraph graph)
        Constructs a hierarchical layout
        graph - the graph to lay out
      • mxHierarchicalLayout

        public mxHierarchicalLayout​(mxGraph graph,
                                    int orientation)
        Constructs a hierarchical layout
        graph - the graph to lay out
        orientation - SwingConstants.NORTH, SwingConstants.EAST, SwingConstants.SOUTH or SwingConstants.WEST
    • Method Detail

      • execute

        public void execute​(java.lang.Object parent)
        Executes the layout for the children of the specified parent.
        Specified by:
        execute in interface mxIGraphLayout
        execute in class mxGraphLayout
        parent - Parent cell that contains the children to be laid out.
      • execute

        public void execute​(java.lang.Object parent,
                            java.util.List<java.lang.Object> roots)
        Executes the layout for the children of the specified parent.
        parent - Parent cell that contains the children to be laid out.
        roots - the starting roots of the layout
      • findRoots

        public 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.
        parent - Cell whose children should be checked.
        List of tree roots in parent.
      • getEdges

        public java.lang.Object[] getEdges​(java.lang.Object cell)
        cell -
      • run

        public 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.
      • filterDescendants

        public java.util.Set<java.lang.Object> filterDescendants​(java.lang.Object cell)
        Creates a set of descendant cells
        cell - The cell whose descendants are to be calculated
        the descendants of the cell (not the cell)
      • traverse

        protected 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.
        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.
      • cycleStage

        public void cycleStage​(java.lang.Object parent)
        Executes the cycle stage. This implementation uses the mxMinimumCycleRemover.
      • layeringStage

        public void layeringStage()
        Implements first stage of a Sugiyama layout.
      • crossingStage

        public void crossingStage​(java.lang.Object parent)
        Executes the crossing stage using mxMedianHybridCrossingReduction.
      • placementStage

        public double placementStage​(double initialX,
                                     java.lang.Object parent)
        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 the intraCellSpacing.
      • setIntraCellSpacing

        public void setIntraCellSpacing​(double intraCellSpacing)
        intraCellSpacing - The intraCellSpacing to set.
      • getInterRankCellSpacing

        public double getInterRankCellSpacing()
        Returns the interRankCellSpacing.
      • setInterRankCellSpacing

        public void setInterRankCellSpacing​(double interRankCellSpacing)
        interRankCellSpacing - The interRankCellSpacing to set.
      • getOrientation

        public int getOrientation()
        Returns the orientation.
      • setOrientation

        public void setOrientation​(int orientation)
        orientation - The orientation to set.
      • getInterHierarchySpacing

        public double getInterHierarchySpacing()
        Returns the interHierarchySpacing.
      • setInterHierarchySpacing

        public void setInterHierarchySpacing​(double interHierarchySpacing)
        interHierarchySpacing - The interHierarchySpacing to set.
      • getParallelEdgeSpacing

        public double getParallelEdgeSpacing()
      • setParallelEdgeSpacing

        public void setParallelEdgeSpacing​(double parallelEdgeSpacing)
      • isFineTuning

        public boolean isFineTuning()
        Returns the fineTuning.
      • setFineTuning

        public void setFineTuning​(boolean fineTuning)
        fineTuning - The fineTuning to set.
      • isDisableEdgeStyle

        public boolean isDisableEdgeStyle()
      • setDisableEdgeStyle

        public void setDisableEdgeStyle​(boolean disableEdgeStyle)
        disableEdgeStyle -
      • toString

        public java.lang.String toString()
        Returns Hierarchical, the name of this algorithm.
        toString in class java.lang.Object