org.openide.explorer.view
Class NodeListModel

java.lang.Object
  |
  +--javax.swing.AbstractListModel
        |
        +--org.openide.explorer.view.NodeListModel
All Implemented Interfaces:
ComboBoxModel, ListModel, Serializable

public class NodeListModel
extends AbstractListModel
implements ComboBoxModel

Model for displaying the nodes in list and choice.

See Also:
Serialized Form

Fields inherited from class javax.swing.AbstractListModel
listenerList
 
Constructor Summary
NodeListModel()
          Creates new NodeTreeModel
NodeListModel(Node root)
          Creates new NodeTreeModel
 
Method Summary
 int getDepth()
          Getter for depth.
 Object getElementAt(int i)
          Child at given index.
 int getIndex(Object o)
          Finds index of given object.
 Object getSelectedItem()
           
 int getSize()
          Number of elements in the model.
 void setDepth(int depth)
          Depth of nodes to display.
 void setNode(Node root)
          Changes the root of the model.
 void setSelectedItem(Object anObject)
          Currently selected item.
 
Methods inherited from class javax.swing.AbstractListModel
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListeners, removeListDataListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.ListModel
addListDataListener, removeListDataListener
 

Constructor Detail

NodeListModel

public NodeListModel()
Creates new NodeTreeModel

NodeListModel

public NodeListModel(Node root)
Creates new NodeTreeModel
Parameters:
root - the root of the model
Method Detail

setNode

public void setNode(Node root)
Changes the root of the model. This is thread safe method.
Parameters:
root - the root of the model

setDepth

public void setDepth(int depth)
Depth of nodes to display.
Parameters:
depth - the depth

getDepth

public int getDepth()
Getter for depth.
Returns:
number of levels to display

getSize

public int getSize()
Number of elements in the model.
Specified by:
getSize in interface ListModel
Overrides:
getSize in class AbstractListModel

getElementAt

public Object getElementAt(int i)
Child at given index.
Specified by:
getElementAt in interface ListModel
Overrides:
getElementAt in class AbstractListModel

getIndex

public int getIndex(Object o)
Finds index of given object.
Parameters:
obj - object produced by this model
Returns:
if the object is not in the list, then return -1

setSelectedItem

public void setSelectedItem(Object anObject)
Currently selected item.
Specified by:
setSelectedItem in interface ComboBoxModel

getSelectedItem

public Object getSelectedItem()
Specified by:
getSelectedItem in interface ComboBoxModel


Built on December 12 2001.  |  Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.