com.fullspan.util.swing
Class TreeNodeListModel

java.lang.Object
  extended byjavax.swing.AbstractListModel
      extended bycom.fullspan.util.swing.TreeNodeListModel
All Implemented Interfaces:
javax.swing.ListModel, java.io.Serializable

public class TreeNodeListModel
extends javax.swing.AbstractListModel

This class represents the child nodes of a TreeNode as elements in a ListModel.

In a user interface, it is common to have a left pane with a tree and a right pane with a list. When the user clicks on a node in the tree, the children of that node are shown as a list in the right pane. This class allows the children of the TreeNode to be easily represented as a ListModel.

Version:
$Revision: 1.4 $, $Date: 2004/11/20 08:14:06 $
Author:
Mitch Stuart
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.AbstractListModel
listenerList
 
Constructor Summary
TreeNodeListModel(javax.swing.tree.TreeNode treeNode)
           
 
Method Summary
 void fireContentsChanged(java.lang.Object source, int index0, int index1)
          Override base class to make this method public
 java.lang.Object getElementAt(int index)
          Returns the value at the specified index.
 int getSize()
          Returns the number of elements in the list.
 void setNode(javax.swing.tree.TreeNode treeNode)
          Reset this ListModel to represent a new list of treeNode children.
 
Methods inherited from class javax.swing.AbstractListModel
addListDataListener, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeNodeListModel

public TreeNodeListModel(javax.swing.tree.TreeNode treeNode)
Parameters:
treeNode - the treeNode whose children will be represented by this ListModel
Method Detail

setNode

public void setNode(javax.swing.tree.TreeNode treeNode)
Reset this ListModel to represent a new list of treeNode children.

Parameters:
treeNode - the treeNode whose children will be represented by this ListModel

getSize

public int getSize()
Returns the number of elements in the list.

Returns:
the number of elements in the list

getElementAt

public java.lang.Object getElementAt(int index)
Returns the value at the specified index.

Parameters:
index - the requested index
Returns:
the value at the requested index

fireContentsChanged

public void fireContentsChanged(java.lang.Object source,
                                int index0,
                                int index1)
Override base class to make this method public

See Also:
AbstractListModel.fireContentsChanged(java.lang.Object, int, int)