Java DTV API 1.3
18-Nov-2009

com.sun.dtv.lwuit.list
Interface ListModel

All Known Implementing Classes:
DefaultListModel

public interface ListModel

Represents the data structure of the list, thus allowing a list to represent any potential data source by referencing different implementations of this interface. E.g. a list model can be implemented in such a way that it retrieves data directly from storage (although caching would be recommended).

It is the responsibility of the list to notify observers (specifically the view List of any changes to its state (items removed/added/changed etc.) thus the data would get updated on the view.


Method Summary
 void addDataChangedListener(DataChangedListener l)
          Invoked to indicate interest in future change events.
 void addItem(Object item)
          Adds the specified item to the end of this list.
 void addSelectionListener(SelectionListener l)
          Invoked to indicate interest in future selection events.
 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 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 setSelectedIndex(int index)
          Sets the selected list offset can be set to -1 to clear selection.
 

Method Detail

getItemAt

Object getItemAt(int index)
Returns the item at the given offset.

Parameters:
index - an index into this list
Returns:
the item at the specified index

getSize

int getSize()
Returns the number of items in the list.

Returns:
the number of items in the list

getSelectedIndex

int getSelectedIndex()
Returns the selected list offset.

Returns:
the selected list index
See Also:
setSelectedIndex(int)

setSelectedIndex

void setSelectedIndex(int index)
Sets the selected list offset can be set to -1 to clear selection.

Parameters:
index - an index into this list
See Also:
getSelectedIndex()

addDataChangedListener

void addDataChangedListener(DataChangedListener l)
Invoked to indicate interest in future change events.

Parameters:
l - a data changed listener
See Also:
removeDataChangedListener(com.sun.dtv.lwuit.events.DataChangedListener)

removeDataChangedListener

void removeDataChangedListener(DataChangedListener l)
Invoked to indicate no further interest in future change events.

Parameters:
l - a data changed listener
See Also:
addDataChangedListener(com.sun.dtv.lwuit.events.DataChangedListener)

addSelectionListener

void addSelectionListener(SelectionListener l)
Invoked to indicate interest in future selection events.

Parameters:
l - a selection listener
See Also:
removeSelectionListener(com.sun.dtv.lwuit.events.SelectionListener)

removeSelectionListener

void removeSelectionListener(SelectionListener l)
Invoked to indicate no further interest in future selection events.

Parameters:
l - a selection listener
See Also:
addSelectionListener(com.sun.dtv.lwuit.events.SelectionListener)

addItem

void addItem(Object item)
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.

Parameters:
item - the item to be added
See Also:
removeItem(int)

removeItem

void removeItem(int index)
Removes the item at the specified position in this list.

Parameters:
index - the index of the item to removed
See Also:
addItem(java.lang.Object)

Java DTV API 1.3
18-Nov-2009

Copyright © 2008-2009 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A. All rights reserved.

U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements. Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.Products covered by and information contained in this service manual are controlled by U.S. Export Control laws and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited. Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.

DOCUMENTATION IS PROVIDED AS IS AND ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD TO BE LEGALLY INVALID.

Use of this document is subject to license terms.