Package jmri

Class CatalogTreeNode

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode

    public class CatalogTreeNode
    extends DefaultMutableTreeNode
    Node of a CatalogTree.

    Name for the node Path is info needed for leafs.

    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class javax.swing.tree.DefaultMutableTreeNode

        allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
    • Constructor Summary

      Constructors 
      Constructor Description
      CatalogTreeNode​(java.lang.String name)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addLeaf​(java.lang.String name, java.lang.String path)
      Insert leaf according to height.
      void addLeaf​(CatalogTreeLeaf leaf)
      Append leaf to the end of the leafs list.
      java.util.Enumeration<javax.swing.tree.TreeNode> children()  
      void deleteLeaf​(java.lang.String name, java.lang.String path)  
      void deleteLeaves​(java.lang.String name)
      Leafs can be used for many-to-many relations.
      CatalogTreeLeaf getLeaf​(java.lang.String name, java.lang.String path)  
      java.util.ArrayList<CatalogTreeLeaf> getLeaves()  
      java.util.ArrayList<CatalogTreeLeaf> getLeaves​(java.lang.String name)
      Leafs can be used for many-to-many relations.
      int getNumLeaves()  
      void setLeaves​(java.util.ArrayList<CatalogTreeLeaf> leafs)  
      • Methods inherited from class javax.swing.tree.DefaultMutableTreeNode

        add, breadthFirstEnumeration, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject, toString
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • addLeaf

        public void addLeaf​(CatalogTreeLeaf leaf)
        Append leaf to the end of the leafs list.
        Parameters:
        leaf - the leaf to add
      • addLeaf

        public void addLeaf​(java.lang.String name,
                            java.lang.String path)
        Insert leaf according to height. Dan Boudreau 10/15/2018 eliminated the check for valid icon and the sorting of the icons by height. Improves load time at initialization by an order of magnitude.
        Parameters:
        name - name of the new leaf
        path - path to the new leaf
      • deleteLeaves

        public void deleteLeaves​(java.lang.String name)
        Leafs can be used for many-to-many relations.
        Parameters:
        name - the leafs to remove
      • deleteLeaf

        public void deleteLeaf​(java.lang.String name,
                               java.lang.String path)
      • getLeaves

        public java.util.ArrayList<CatalogTreeLeafgetLeaves​(java.lang.String name)
        Leafs can be used for many-to-many relations.
        Parameters:
        name - name of the leafs to get
        Returns:
        a list of matching leafs; an empty list if there are no matching leafs
      • children

        public java.util.Enumeration<javax.swing.tree.TreeNode> children()
        Specified by:
        children in interface javax.swing.tree.TreeNode
        Overrides:
        children in class javax.swing.tree.DefaultMutableTreeNode