com.sun.lwuit.list
Class DefaultListModel

java.lang.Object
  extended by com.sun.lwuit.list.DefaultListModel
All Implemented Interfaces:
ListModel

public class DefaultListModel
extends java.lang.Object
implements ListModel

Default implementation of the list model based on a vector of elements


Constructor Summary
DefaultListModel()
          Creates a new instance of DefaultListModel
DefaultListModel(java.lang.Object[] items)
          Creates a new instance of DefaultListModel
DefaultListModel(java.util.Vector items)
          Creates a new instance of DefaultListModel
 
Method Summary
 void addDataChangedListener(DataChangedListener l)
          Invoked to indicate interest in future change events
 void addItem(java.lang.Object item)
          Adds the specified item to the end of this list.
 void addItemAtIndex(java.lang.Object item, int index)
          Adding an item to list at given index
 void addSelectionListener(SelectionListener l)
          Invoked to indicate interest in future selection events
 java.lang.Object getItemAt(int index)
          Returns the item at the given offset
 int getSelectedIndex()
          Returns the selected list offset
 int getSize()
          Returns the number of items in the list
 void removeAll()
          Removes all elements from the model
 void removeDataChangedListener(DataChangedListener l)
          Invoked to indicate no further interest in future change events
 void removeItem(int index)
          Removes the item at the specified position in this list.
 void removeSelectionListener(SelectionListener l)
          Invoked to indicate no further interest in future selection events
 void setItem(int index, java.lang.Object item)
          Change the item at the given index
 void setSelectedIndex(int index)
          Sets the selected list offset can be set to -1 to clear selection
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultListModel

public DefaultListModel()
Creates a new instance of DefaultListModel


DefaultListModel

public DefaultListModel(java.util.Vector items)
Creates a new instance of DefaultListModel

Parameters:
items - the items in the model

DefaultListModel

public DefaultListModel(java.lang.Object[] items)
Creates a new instance of DefaultListModel

Parameters:
items - the items in the model
Method Detail

getItemAt

public java.lang.Object getItemAt(int index)
Description copied from interface: ListModel
Returns the item at the given offset

Specified by:
getItemAt in interface ListModel
Parameters:
index - an index into this list
Returns:
the item at the specified index

getSize

public int getSize()
Description copied from interface: ListModel
Returns the number of items in the list

Specified by:
getSize in interface ListModel
Returns:
the number of items in the list

getSelectedIndex

public int getSelectedIndex()
Description copied from interface: ListModel
Returns the selected list offset

Specified by:
getSelectedIndex in interface ListModel
Returns:
the selected list index

addItem

public void addItem(java.lang.Object item)
Description copied from interface: ListModel
Adds the specified item to the end of this list. An optional operation for mutable lists, it can throw an unsupported operation exception if a list model is not mutable.

Specified by:
addItem in interface ListModel
Parameters:
item - the item to be added

setItem

public void setItem(int index,
                    java.lang.Object item)
Change the item at the given index

Parameters:
index - the offset for the item
item - the value to set

addItemAtIndex

public void addItemAtIndex(java.lang.Object item,
                           int index)
Adding an item to list at given index

Parameters:
item - - the item to add
index - - the index position in the list

removeItem

public void removeItem(int index)
Description copied from interface: ListModel
Removes the item at the specified position in this list.

Specified by:
removeItem in interface ListModel
Parameters:
index - the index of the item to removed

removeAll

public void removeAll()
Removes all elements from the model


setSelectedIndex

public void setSelectedIndex(int index)
Description copied from interface: ListModel
Sets the selected list offset can be set to -1 to clear selection

Specified by:
setSelectedIndex in interface ListModel
Parameters:
index - an index into this list

addDataChangedListener

public void addDataChangedListener(DataChangedListener l)
Description copied from interface: ListModel
Invoked to indicate interest in future change events

Specified by:
addDataChangedListener in interface ListModel
Parameters:
l - a data changed listener

removeDataChangedListener

public void removeDataChangedListener(DataChangedListener l)
Description copied from interface: ListModel
Invoked to indicate no further interest in future change events

Specified by:
removeDataChangedListener in interface ListModel
Parameters:
l - a data changed listener

addSelectionListener

public void addSelectionListener(SelectionListener l)
Description copied from interface: ListModel
Invoked to indicate interest in future selection events

Specified by:
addSelectionListener in interface ListModel
Parameters:
l - a selection listener

removeSelectionListener

public void removeSelectionListener(SelectionListener l)
Description copied from interface: ListModel
Invoked to indicate no further interest in future selection events

Specified by:
removeSelectionListener in interface ListModel
Parameters:
l - a selection listener