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 TypeMethodDescriptionvoid
int
getChildCount
(Object parent) int
getIndexOfChild
(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()
boolean
protected void
notifyNodesAdded
(T parent, int index, T child) protected void
notifyNodesChanged
(T child) protected void
notifyNodesRemoved
(T parent, int index, T child) void
void
void
valueForPathChanged
(TreePath path, Object newValue)
-
Constructor Details
-
HierarchyTreeModel
-
-
Method Details
-
getRoot
-
getChild
-
getChildCount
- Specified by:
getChildCount
in interfaceTreeModel
-
isLeaf
-
getIndexOfChild
- Specified by:
getIndexOfChild
in interfaceTreeModel
-
valueForPathChanged
- Specified by:
valueForPathChanged
in interfaceTreeModel
-
addTreeModelListener
- Specified by:
addTreeModelListener
in interfaceTreeModel
-
removeTreeModelListener
- Specified by:
removeTreeModelListener
in 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
-