Package introspector.model
Class IntrospectorModel
java.lang.Object
introspector.model.IntrospectorModel
- All Implemented Interfaces:
TreeModel
Model object that represents a tree.
It implements the TreeModel to allow its visualization as a JTree.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionIntrospectorModel(String name, Object root) Constructs a tres given its name and the root objectIntrospectorModel(String name, Object root, boolean deepClone) Constructs a tres given its name, the root object and whether the tree should be cloned deeply. -
Method Summary
Modifier and TypeMethodDescriptionvoidReturns theindex-th child of theparentnode.intgetChildCount(Object parent) Returns the number of children ofparentnode.intgetIndexOfChild(Object parent, Object child) Gets the index of thechildnode inparent.getRoot()booleanReturns whether the parameter is a leaf node.voidvoidvalueForPathChanged(TreePath path, Object newValue)
-
Field Details
-
root
The root node of the tree.
-
-
Constructor Details
-
IntrospectorModel
Constructs a tres given its name and the root object- Parameters:
name- The name used to visualize the tree.root- The object that will be used as the root node of the tree.
-
IntrospectorModel
Constructs a tres given its name, the root object and whether the tree should be cloned deeply.- Parameters:
name- The name used to visualize the tree.root- The object that will be used as the root node of the tree.deepClone- Whether the tree should be cloned deeply. This is important when the tree is going to be compared with a later version of the tree. In such a case, it must be cloned deeply to show the differences between the two trees.
-
-
Method Details
-
getRoot
-
getChild
Returns theindex-th child of theparentnode. -
getChildCount
Returns the number of children ofparentnode.- Specified by:
getChildCountin interfaceTreeModel- Parameters:
parent- a node in the tree, obtained from this data source- Returns:
- the number of children of
parentnode.
-
isLeaf
Returns whether the parameter is a leaf node. -
getIndexOfChild
Gets the index of thechildnode inparent.- Specified by:
getIndexOfChildin interfaceTreeModel- Parameters:
parent- a node in the tree, obtained from this data sourcechild- the node we are interested in- Returns:
- the index of the
childnode inparent.
-
valueForPathChanged
- Specified by:
valueForPathChangedin interfaceTreeModel
-
addTreeModelListener
- Specified by:
addTreeModelListenerin interfaceTreeModel
-
removeTreeModelListener
- Specified by:
removeTreeModelListenerin interfaceTreeModel
-