nextapp.echo
Class DefaultListModel

java.lang.Object
  extended by nextapp.echo.AbstractListModel
      extended by nextapp.echo.DefaultListModel
All Implemented Interfaces:
java.io.Serializable, ListModel

public class DefaultListModel
extends AbstractListModel
implements ListModel

The default implementation of a ListBox's data model.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class nextapp.echo.AbstractListModel
listenerList
 
Constructor Summary
DefaultListModel()
          Creates a new DefaultSelectListModel with the given content.
DefaultListModel(java.lang.Object[] itemArray)
          Creates a new DefaultSelectListModel containing the specified data.
 
Method Summary
 void add(int index, java.lang.Object item)
          Inserts an item into the model at the specified index.
 void add(java.lang.Object item)
          Adds an item at the end of the model.
 java.lang.Object get(int index)
          Returns the item at the specified position in the list.
 int indexOf(java.lang.Object item)
          Returns the index of the specified item within the model.
 void remove(int index)
          Removes the item at the specified index from the model.
 void remove(java.lang.Object item)
          Removes the specified item from the model.
 int size()
          Returns the length of the list.
 
Methods inherited from class nextapp.echo.AbstractListModel
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, removeListDataListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface nextapp.echo.ListModel
addListDataListener, removeListDataListener
 

Constructor Detail

DefaultListModel

public DefaultListModel()
Creates a new DefaultSelectListModel with the given content.


DefaultListModel

public DefaultListModel(java.lang.Object[] itemArray)
Creates a new DefaultSelectListModel containing the specified data.

Parameters:
itemArray - An array of the initial items to be displayed in the ListBox.
Method Detail

add

public void add(java.lang.Object item)
Adds an item at the end of the model.

Parameters:
item - The item to add.

add

public void add(int index,
                java.lang.Object item)
Inserts an item into the model at the specified index.

Parameters:
item - The item to insert.
index - The index at which to insert the item.

get

public java.lang.Object get(int index)
Returns the item at the specified position in the list.

Specified by:
get in interface ListModel
Parameters:
index - The index of the item to return.
Returns:
The item at the specified index.

indexOf

public int indexOf(java.lang.Object item)
Returns the index of the specified item within the model.

Parameters:
item - An item in the model.
Returns:
The index of the item within the model.

remove

public void remove(int index)
Removes the item at the specified index from the model.

Parameters:
index - The index of the item to remove.

remove

public void remove(java.lang.Object item)
Removes the specified item from the model.

Parameters:
item - The item to remove from the model.

size

public int size()
Returns the length of the list.

Specified by:
size in interface ListModel
Returns:
The length of the list.