|
JComponentPack 1.3.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.zfqjava.swing.model.XmlTreeModel
public class XmlTreeModel
XmlTreeModel provides a
XML tree model.
| Field Summary | |
|---|---|
protected EventListenerList |
listenerList
List of listeners |
| Constructor Summary | |
|---|---|
XmlTreeModel(Node node)
Constructs a XML tree model use the specified node. |
|
| Method Summary | |
|---|---|
void |
addTreeModelListener(TreeModelListener l)
Adds a listener for the TreeModelEvent posted after the tree changes. |
protected void |
fireTreeNodesChanged(Object source,
Object[] path,
int[] childIndices,
Object[] children)
Notifies all listeners that have registered interest for notification on this event type. |
protected void |
fireTreeNodesInserted(Object source,
Object[] path,
int[] childIndices,
Object[] children)
Notifies all listeners that have registered interest for notification on this event type. |
protected void |
fireTreeNodesRemoved(Object source,
Object[] path,
int[] childIndices,
Object[] children)
Notifies all listeners that have registered interest for notification on this event type. |
protected void |
fireTreeStructureChanged(Object source,
Object[] path,
int[] childIndices,
Object[] children)
Notifies all listeners that have registered interest for notification on this event type. |
Object |
getChild(Object parent,
int index)
Returns the child of parent at index index
in the parent's
child array. |
int |
getChildCount(Object parent)
Returns the number of children of parent. |
int |
getIndexOfChild(Object parent,
Object child)
Returns the index of child in parent. |
EventListener[] |
getListeners(Class listenerType)
Returns an array of all the objects currently registered as FooListeners
upon this model. |
Object |
getRoot()
Returns the root of the tree. |
TreeModelListener[] |
getTreeModelListeners()
Returns an array of all the tree model listeners registered on this model. |
boolean |
isLeaf(Object node)
Returns true if node is a leaf. |
void |
removeTreeModelListener(TreeModelListener l)
Removes a listener previously added with addTreeModelListener(). |
void |
valueForPathChanged(TreePath path,
Object newValue)
Messaged when the user has altered the value for the item identified by path to newValue. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected EventListenerList listenerList
| Constructor Detail |
|---|
public XmlTreeModel(Node node)
node - the specified node| Method Detail |
|---|
public Object getRoot()
null
only if the tree has no nodes.
public Object getChild(Object parent,
int index)
parent at index index
in the parent's
child array. parent must be a node previously obtained
from this data source. This should not return null
if index
is a valid index for parent (that is index >= 0 &&
index < getChildCount(parent)).
parent - a node in the tree, obtained from this data source
parent at index indexpublic int getChildCount(Object parent)
parent.
Returns 0 if the node
is a leaf or if it has no children. parent must be a node
previously obtained from this data source.
parent - a node in the tree, obtained from this data source
parentpublic boolean isLeaf(Object node)
true if node is a leaf.
It is possible for this method to return false
even if node has no children.
A directory in a filesystem, for example,
may contain no files; the node representing
the directory is not a leaf, but it also has no children.
node - a node in the tree, obtained from this data source
node is a leaf
public void valueForPathChanged(TreePath path,
Object newValue)
path to newValue.
If newValue signifies a truly new value
the model should post a treeNodesChanged event.
path - path to the node that the user has alterednewValue - the new value from the TreeCellEditor
public int getIndexOfChild(Object parent,
Object child)
parent
is null or child is null,
returns -1.
parent - a note in the tree, obtained from this data sourcechild - the node we are interested in
child or parent are nullpublic void addTreeModelListener(TreeModelListener l)
addTreeModelListener in interface TreeModell - the listener to addremoveTreeModelListener(javax.swing.event.TreeModelListener)public void removeTreeModelListener(TreeModelListener l)
removeTreeModelListener in interface TreeModell - the listener to removeaddTreeModelListener(javax.swing.event.TreeModelListener)public TreeModelListener[] getTreeModelListeners()
TreeModelListeners
or an empty
array if no tree model listeners are currently registeredaddTreeModelListener(javax.swing.event.TreeModelListener),
removeTreeModelListener(javax.swing.event.TreeModelListener)
protected void fireTreeNodesChanged(Object source,
Object[] path,
int[] childIndices,
Object[] children)
source - the node being changedpath - the path to the root nodechildIndices - the indices of the changed elementschildren - the changed elementsEventListenerList
protected void fireTreeNodesInserted(Object source,
Object[] path,
int[] childIndices,
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
protected void fireTreeNodesRemoved(Object source,
Object[] path,
int[] childIndices,
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
protected void fireTreeStructureChanged(Object source,
Object[] path,
int[] childIndices,
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 elementsEventListenerListpublic EventListener[] getListeners(Class listenerType)
FooListeners
upon this model.
FooListeners 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
FooListeners on this component,
or an empty array if no such
listeners have been added
ClassCastException - if listenerType
doesn't specify a class or interface that implements
java.util.EventListenergetTreeModelListeners()
|
JComponentPack 1.3.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||