Class DefaultConfiguration<TreeNode>

  • Type Parameters:
    TreeNode - Type of elements used as nodes in the tree
    All Implemented Interfaces:
    Configuration<TreeNode>

    public class DefaultConfiguration<TreeNode>
    extends java.lang.Object
    implements Configuration<TreeNode>
    Specify a Configuration through configurable parameters, or falling back to some frequently used defaults.
    • Method Detail

      • getGapBetweenLevels

        public double getGapBetweenLevels​(int nextLevel)
        Description copied from interface: Configuration
        Returns the size of the gap between subsequent levels.

        gapBetweenLevels Visualization

        Specified by:
        getGapBetweenLevels in interface Configuration<TreeNode>
        Parameters:
        nextLevel - [nextLevel > 0]
        Returns:
        the size of the gap between level (nextLevel-1) and nextLevel [result >= 0]
      • getGapBetweenNodes

        public double getGapBetweenNodes​(TreeNode node1,
                                         TreeNode node2)
        Description copied from interface: Configuration
        Returns the size of the minimal gap of nodes within a level.

        In the layout there will be a gap of at least the returned size between both given nodes.

        gapBetweenNodes Visualization

        node1 and node2 are at the same level and are placed next to each other.

        Specified by:
        getGapBetweenNodes in interface Configuration<TreeNode>
        Parameters:
        node1 -  
        node2 -  
        Returns:
        the minimal size of the gap between node1 and node2 [result >= 0]
      • getRootLocation

        public Configuration.Location getRootLocation()
        Description copied from interface: Configuration
        Returns the position of the root node in the diagram.

        By default the root of the tree is located at the top of the diagram. However one may also put it at the left, right or bottom of the diagram.

        Possible Root Positions
        Top (Default) Left Right Bottom
        Tree with root at top Tree with root at left side Tree with root at right side Tree with root at bottom
        Specified by:
        getRootLocation in interface Configuration<TreeNode>
        Returns:
        the position of the root node in the diagram
      • getAlignmentInLevel

        public Configuration.AlignmentInLevel getAlignmentInLevel()
        Description copied from interface: Configuration
        Returns the alignment of "smaller" nodes within a level.

        By default all nodes of one level are centered in the level. However one may also align them "towards the root" or "away from the root". When the root is located at the top this means the nodes are aligned "to the top of the level" or "to the bottom of the level".

        Alignment in level when root is at the top
        Center (Default) TowardsRoot ("top of level") AwayFromRoot ("bottom of level")
        Tree with root at top and nodes center aligned Tree with root at top and nodes aligned to top Tree with root at top and nodes aligned to bottom

        Alignment in level when root is at the left:

        Table: Possible Alignments of Nodes (when root at left side)
        Center (Default) TowardsRoot ("left of level") AwayFromRoot
        ("right of level")
        Tree with root at left side and nodes center aligned Tree with root at left side and nodes left aligned Tree with root at left side and nodes right aligned

        Of cause the alignment also works when the root is at the bottom or at the right side.

        Specified by:
        getAlignmentInLevel in interface Configuration<TreeNode>
        Returns:
        the alignment of "smaller" nodes within a level