Class TreeStatus


  • public final class TreeStatus
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.Object rootNode  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private TreeStatus()  
        TreeStatus​(java.lang.Object rootNode)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private javax.swing.tree.TreePath generatePath​(java.lang.String pathString)
      Constructs TreePath from Status String.
      private java.lang.String generatePathString​(javax.swing.tree.TreePath path)
      Constructs a status string from the path.
      private java.lang.String getObjectName​(java.lang.Object treeNode)
      Get the object name of a tree node.
      javax.swing.tree.TreePath getPathForString​(java.lang.String statusString)
      Provides TreePath for a given status string.
      java.lang.String getStringForPath​(javax.swing.tree.TreePath path)
      Provides status string for a TreePath instance.
      private java.util.List<java.lang.String> parsePathString​(java.lang.String path)
      Parses a string and lists all the nodes.
      private java.lang.Object searchNode​(java.lang.Object obj, java.lang.String searchStr)
      An object is searched in the tree structure using the identifiers parsed earlier step.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • rootNode

        private java.lang.Object rootNode
    • Constructor Detail

      • TreeStatus

        private TreeStatus()
      • TreeStatus

        public TreeStatus​(java.lang.Object rootNode)
        Constructor.
        Parameters:
        rootNode - the root node of the tree which will be used to construct a treepath from a tree status string.
    • Method Detail

      • getStringForPath

        public java.lang.String getStringForPath​(javax.swing.tree.TreePath path)
        Provides status string for a TreePath instance.
        Parameters:
        path - TreePath instance.
        Returns:
        pathString.
      • getPathForString

        public javax.swing.tree.TreePath getPathForString​(java.lang.String statusString)
        Provides TreePath for a given status string. In case of invalid string returns null.
        Parameters:
        statusString -
        Returns:
        path.
      • generatePathString

        private java.lang.String generatePathString​(javax.swing.tree.TreePath path)
        Constructs a status string from the path.
        Parameters:
        path -
        Returns:
        the status string.
      • generatePath

        private javax.swing.tree.TreePath generatePath​(java.lang.String pathString)
        Constructs TreePath from Status String.
        Parameters:
        pathString -
        Returns:
        a TreePath, or null if there is an error.
      • getObjectName

        private java.lang.String getObjectName​(java.lang.Object treeNode)
        Get the object name of a tree node. If the given node of the tree is a MapEntry, its key is used as node identifier; if it is an ArrayEntry, then its index is used as identifier.
        Parameters:
        treeNode - node of a tree.
        Returns:
        the name of the node.
        Throws:
        java.lang.IllegalArgumentException - if there is an unknown treeNode type.
      • parsePathString

        private java.util.List<java.lang.String> parsePathString​(java.lang.String path)
        Parses a string and lists all the nodes.
        Parameters:
        path - a tree path.
        Returns:
        a list of nodes, or null if there is an empty node.
      • searchNode

        private java.lang.Object searchNode​(java.lang.Object obj,
                                            java.lang.String searchStr)
        An object is searched in the tree structure using the identifiers parsed earlier step.
        Parameters:
        obj -
        searchStr -
        Returns:
        the Object found or null