Package jdepend.swingui
Class DependTreeModel
- java.lang.Object
-
- jdepend.swingui.DependTreeModel
-
- All Implemented Interfaces:
javax.swing.tree.TreeModel
public class DependTreeModel extends java.lang.Object implements javax.swing.tree.TreeModelTheDependTreeModelclass defines the data model being observed by aDependTreeinstance.- Author:
- Mike Clark, Clarkware Consulting, Inc.
-
-
Constructor Summary
Constructors Constructor Description DependTreeModel(PackageNode root)Constructs aDependTreeModelwith the specified root package node.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddTreeModelListener(javax.swing.event.TreeModelListener l)Adds a listener for theTreeModelEventposted after the tree changes.java.lang.ObjectgetChild(java.lang.Object parent, int index)Returns the child of the specified parent at the specified index in the parent's child collection.intgetChildCount(java.lang.Object parent)Returns the number of children for the specified parent.intgetIndexOfChild(java.lang.Object parent, java.lang.Object child)Returns the index of the specified child within the specified parent.java.lang.ObjectgetRoot()Returns the root of the tree.booleanisLeaf(java.lang.Object o)Determines whether the specified tree node is a leaf node.voidremoveTreeModelListener(javax.swing.event.TreeModelListener l)Removes a listener forTreeModelEvents.voidvalueForPathChanged(javax.swing.tree.TreePath path, java.lang.Object newValue)Callback method triggered when the value for the item specified by path has changed to newValue .
-
-
-
Constructor Detail
-
DependTreeModel
public DependTreeModel(PackageNode root)
Constructs aDependTreeModelwith the specified root package node.- Parameters:
root- Root package node.
-
-
Method Detail
-
getRoot
public java.lang.Object getRoot()
Returns the root of the tree.- Specified by:
getRootin interfacejavax.swing.tree.TreeModel- Returns:
- The root of the tree, or
nullif the tree has no nodes.
-
getChild
public java.lang.Object getChild(java.lang.Object parent, int index)Returns the child of the specified parent at the specified index in the parent's child collection.The specified parent must be a node previously obtained from this data source.
- Specified by:
getChildin interfacejavax.swing.tree.TreeModel- Parameters:
parent- A node in the tree, obtained from this data source.index- Index of child in the parent's child collection.- Returns:
- Child.
-
getChildCount
public int getChildCount(java.lang.Object parent)
Returns the number of children for the specified parent.The specified parent must be a node previously obtained from this data source.
- Specified by:
getChildCountin interfacejavax.swing.tree.TreeModel- Parameters:
parent- A node in the tree, obtained from this data source.- Returns:
- The number of children of the specified parent, or 0 if the parent is a leaf node or if it has no children.
-
isLeaf
public boolean isLeaf(java.lang.Object o)
Determines whether the specified tree node is a leaf node.- Specified by:
isLeafin interfacejavax.swing.tree.TreeModel- Parameters:
o- A node in the tree, obtained from this data source.- Returns:
trueif the node is a leaf;falseotherwise.
-
valueForPathChanged
public void valueForPathChanged(javax.swing.tree.TreePath path, java.lang.Object newValue)Callback method triggered when the value for the item specified by path has changed to newValue .- Specified by:
valueForPathChangedin interfacejavax.swing.tree.TreeModel- Parameters:
path- Path to the node that has changed.newValue- The new value of the node.
-
getIndexOfChild
public int getIndexOfChild(java.lang.Object parent, java.lang.Object child)Returns the index of the specified child within the specified parent.- Specified by:
getIndexOfChildin interfacejavax.swing.tree.TreeModel- Parameters:
parent- Parent node.child- Child node.- Returns:
- Index of child within parent.
-
addTreeModelListener
public void addTreeModelListener(javax.swing.event.TreeModelListener l)
Adds a listener for theTreeModelEventposted after the tree changes.- Specified by:
addTreeModelListenerin interfacejavax.swing.tree.TreeModel- Parameters:
l- The listener to add.
-
removeTreeModelListener
public void removeTreeModelListener(javax.swing.event.TreeModelListener l)
Removes a listener forTreeModelEvents.- Specified by:
removeTreeModelListenerin interfacejavax.swing.tree.TreeModel- Parameters:
l- The listener to remove.
-
-