public abstract class AbstractTreeModel
extends java.lang.Object
implements javax.swing.tree.TreeModel
Modifier and Type | Field and Description |
---|---|
protected javax.swing.event.EventListenerList |
listenerList |
Constructor and Description |
---|
AbstractTreeModel() |
Modifier and Type | Method and Description |
---|---|
void |
addTreeModelListener(javax.swing.event.TreeModelListener l)
Adds a listener for the TreeModelEvent posted after the tree changes.
|
void |
fireTreeNodesChanged(java.lang.Object source,
java.lang.Object[] path,
int[] childIndices,
java.lang.Object[] children)
Notifies all listeners that have registered interest for
notification on this event type.
|
void |
fireTreeNodesInserted(java.lang.Object source,
java.lang.Object[] path,
int[] childIndices,
java.lang.Object[] children)
Notifies all listeners that have registered interest for
notification on this event type.
|
void |
fireTreeNodesRemoved(java.lang.Object source,
java.lang.Object[] path,
int[] childIndices,
java.lang.Object[] children)
Notifies all listeners that have registered interest for
notification on this event type.
|
void |
fireTreeStructureChanged(java.lang.Object source,
java.lang.Object[] path,
int[] childIndices,
java.lang.Object[] children)
Notifies all listeners that have registered interest for
notification on this event type.
|
void |
fireTreeStructureChanged(java.lang.Object source,
javax.swing.tree.TreePath path) |
java.util.EventListener[] |
getListeners(java.lang.Class listenerType)
Returns an array of all the objects currently registered
as
FooListener s
upon this model. |
javax.swing.event.TreeModelListener[] |
getTreeModelListeners()
Returns an array of all the tree model listeners
registered on this model.
|
void |
removeTreeModelListener(javax.swing.event.TreeModelListener l)
Removes a listener previously added with addTreeModelListener().
|
public void addTreeModelListener(javax.swing.event.TreeModelListener l)
addTreeModelListener
in interface javax.swing.tree.TreeModel
l
- the listener to addremoveTreeModelListener(javax.swing.event.TreeModelListener)
public void removeTreeModelListener(javax.swing.event.TreeModelListener l)
removeTreeModelListener
in interface javax.swing.tree.TreeModel
l
- the listener to removeaddTreeModelListener(javax.swing.event.TreeModelListener)
public javax.swing.event.TreeModelListener[] getTreeModelListeners()
TreeModelListener
s
or an empty
array if no tree model listeners are currently registeredaddTreeModelListener(javax.swing.event.TreeModelListener)
,
removeTreeModelListener(javax.swing.event.TreeModelListener)
public void fireTreeNodesChanged(java.lang.Object source, java.lang.Object[] path, int[] childIndices, java.lang.Object[] children)
source
- the node being changedpath
- the path to the root nodechildIndices
- the indices of the changed elementschildren
- the changed elementsEventListenerList
public void fireTreeNodesInserted(java.lang.Object source, java.lang.Object[] path, int[] childIndices, java.lang.Object[] children)
source
- the node where new elements are being insertedpath
- the path to the root nodechildIndices
- the indices of the new elementschildren
- the new elementsEventListenerList
public void fireTreeNodesRemoved(java.lang.Object source, java.lang.Object[] path, int[] childIndices, java.lang.Object[] children)
source
- the node where elements are being removedpath
- the path to the root nodechildIndices
- the indices of the removed elementschildren
- the removed elementsEventListenerList
public void fireTreeStructureChanged(java.lang.Object source, java.lang.Object[] path, int[] childIndices, java.lang.Object[] children)
source
- the node where the tree model has changedpath
- the path to the root nodechildIndices
- the indices of the affected elementschildren
- the affected elementsEventListenerList
public void fireTreeStructureChanged(java.lang.Object source, javax.swing.tree.TreePath path)
public java.util.EventListener[] getListeners(java.lang.Class listenerType)
FooListener
s
upon this model.
FooListener
s are registered using the
addFooListener
method.
You can specify the listenerType
argument
with a class literal,
such as
FooListener.class
.
For example, you can query a
DefaultTreeModel
m
for its tree model listeners with the following code:
TreeModelListener[] tmls = (TreeModelListener[])(m.getListeners(TreeModelListener.class));If no such listeners exist, this method returns an empty array.
listenerType
- the type of listeners requested; this parameter
should specify an interface that descends from
java.util.EventListener
FooListener
s on this component,
or an empty array if no such
listeners have been addedjava.lang.ClassCastException
- if listenerType
doesn't specify a class or interface that implements
java.util.EventListener
getTreeModelListeners()