Package jmri
Class CatalogTreeNode
- java.lang.Object
-
- javax.swing.tree.DefaultMutableTreeNode
-
- jmri.util.swing.DefaultMutableTreeNode
-
- jmri.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
-
-
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
-
-
-
-
Constructor Detail
-
CatalogTreeNode
public CatalogTreeNode(java.lang.String name)
-
-
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 leafpath
- 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)
-
getLeaf
public CatalogTreeLeaf getLeaf(java.lang.String name, java.lang.String path)
-
getLeaves
public java.util.ArrayList<CatalogTreeLeaf> getLeaves(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 interfacejavax.swing.tree.TreeNode
- Overrides:
children
in classjavax.swing.tree.DefaultMutableTreeNode
-
getLeaves
public java.util.ArrayList<CatalogTreeLeaf> getLeaves()
-
getNumLeaves
public int getNumLeaves()
-
setLeaves
public void setLeaves(java.util.ArrayList<CatalogTreeLeaf> leafs)
-
-