Package com.macrofocus.hierarchy.swing
Class HierarchyTreeModel<T>
java.lang.Object
com.macrofocus.hierarchy.swing.HierarchyTreeModel<T>
- All Implemented Interfaces:
TreeModel
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidintgetChildCount(Object parent) intgetIndexOfChild(Object parent, Object child) Object[]getPathToRoot(T aNode) Builds the parents of node up to and including the root node, where the original node is the last element in the returned array.protected Object[]getPathToRoot(T aNode, int depth) Builds the parents of node up to and including the root node, where the original node is the last element in the returned array.getRoot()booleanprotected voidnotifyNodesAdded(T parent, int index, T child) protected voidnotifyNodesChanged(T child) protected voidnotifyNodesRemoved(T parent, int index, T child) voidvoidvoidvalueForPathChanged(TreePath path, Object newValue)
-
Constructor Details
-
HierarchyTreeModel
-
-
Method Details
-
getRoot
-
getChild
-
getChildCount
- Specified by:
getChildCountin interfaceTreeModel
-
isLeaf
-
getIndexOfChild
- Specified by:
getIndexOfChildin interfaceTreeModel
-
valueForPathChanged
- Specified by:
valueForPathChangedin interfaceTreeModel
-
addTreeModelListener
- Specified by:
addTreeModelListenerin interfaceTreeModel
-
removeTreeModelListener
- Specified by:
removeTreeModelListenerin interfaceTreeModel
-
notifyNodesAdded
-
notifyNodesChanged
-
notifyNodesRemoved
-
notifyStructureChanged
public void notifyStructureChanged() -
getPathToRoot
Builds the parents of node up to and including the root node, where the original node is the last element in the returned array. The length of the returned array gives the node's depth in the tree.- Parameters:
aNode- the TreeNode to get the path for
-
getPathToRoot
Builds the parents of node up to and including the root node, where the original node is the last element in the returned array. The length of the returned array gives the node's depth in the tree.- Parameters:
aNode- the TreeNode to get the path fordepth- an int giving the number of steps already taken towards the root (on recursive calls), used to size the returned array- Returns:
- an array of TreeNodes giving the path from the root to the specified node
-