public class MainTreeModel
extends java.lang.Object
implements javax.swing.tree.TreeModel
Modifier and Type | Field and Description |
---|---|
static org.apache.log4j.Logger |
log
Used for logging.
|
Constructor and Description |
---|
MainTreeModel()
Constructs the model.
|
Modifier and Type | Method and Description |
---|---|
void |
addTopLevelItem(java.lang.Object item)
Adds a top-level item.
|
void |
addTreeModelListener(javax.swing.event.TreeModelListener l)
Adds a listener for the TreeModelEvent posted after the tree changes.
|
void |
fireTreeNodeChanged(java.lang.Object object,
javax.swing.tree.TreePath treePath)
The only event raised by this model is TreeStructureChanged with the
root as path, i.e.
|
void |
fireTreeStructureChanged(javax.swing.tree.TreePath treePath)
Indicates that the overall structure of the tree has changed.
|
java.lang.Object |
getChild(java.lang.Object parent,
int index)
Returns the child of parent at index in the parent's child array.
|
int |
getChildCount(java.lang.Object parent)
Returns the number of children of parent.
|
int |
getIndexOfChild(java.lang.Object parent,
java.lang.Object child)
Returns the index of child in parent.
|
int |
getNumTopLevelItems()
Gets the number of top-level items.
|
java.lang.Object |
getRoot()
Returns the root of the tree.
|
int |
getSequenceOfTopLevelItem(java.lang.Object object)
Gets the sequence of the object amongst the top-level items.
|
java.util.Iterator |
getTopLevelItemsIterator()
Returns an
Iterator over which the top-level
items can be cycled. |
boolean |
isLeaf(java.lang.Object node)
Returns true if node is a leaf.
|
void |
reload()
Re-loads all top-level items.
|
void |
removeTreeModelListener(javax.swing.event.TreeModelListener l)
Removes a listener previously added with addTreeModelListener().
|
void |
valueForPathChanged(javax.swing.tree.TreePath path,
java.lang.Object newValue)
Messaged when the user has altered the value for the item
identified by path to newValue.
|
public int getNumTopLevelItems()
public java.util.Iterator getTopLevelItemsIterator()
Iterator
over which the top-level
items can be cycled.Iterator
.public int getSequenceOfTopLevelItem(java.lang.Object object)
object
- The object to seek.public void addTopLevelItem(java.lang.Object item)
item
- The item to add.public void reload()
public java.lang.Object getRoot()
getRoot
in interface javax.swing.tree.TreeModel
public int getIndexOfChild(java.lang.Object parent, java.lang.Object child)
getIndexOfChild
in interface javax.swing.tree.TreeModel
public java.lang.Object getChild(java.lang.Object parent, int index)
getChild
in interface javax.swing.tree.TreeModel
public int getChildCount(java.lang.Object parent)
getChildCount
in interface javax.swing.tree.TreeModel
public boolean isLeaf(java.lang.Object node)
isLeaf
in interface javax.swing.tree.TreeModel
public void removeTreeModelListener(javax.swing.event.TreeModelListener l)
removeTreeModelListener
in interface javax.swing.tree.TreeModel
public void addTreeModelListener(javax.swing.event.TreeModelListener l)
addTreeModelListener
in interface javax.swing.tree.TreeModel
public void fireTreeNodeChanged(java.lang.Object object, javax.swing.tree.TreePath treePath)
object
- The object that changed.treePath
- The TreePath
corresponding to the
object that changed.public void fireTreeStructureChanged(javax.swing.tree.TreePath treePath)
public void valueForPathChanged(javax.swing.tree.TreePath path, java.lang.Object newValue)
valueForPathChanged
in interface javax.swing.tree.TreeModel