Java DTV API 1.3
18-Nov-2009

com.sun.dtv.lwuit.list
Class DefaultListModel

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

public class DefaultListModel
extends 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(Object[] items)
          Creates a new instance of DefaultListModel.
DefaultListModel(Vector items)
          Creates a new instance of DefaultListModel.
 
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 addItemAtIndex(Object item, int index)
          Adding an item to list at given index.
 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 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, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultListModel

public DefaultListModel()
Creates a new instance of DefaultListModel.


DefaultListModel

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

Parameters:
items - the list items

DefaultListModel

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

Parameters:
items - the list items
Method Detail

getItemAt

public 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
See Also:
ListModel.setSelectedIndex(int)

addItem

public void addItem(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
See Also:
ListModel.removeItem(int)

setItem

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

Parameters:
index - the index
item - the object to be inserted as the new item at the specified position

addItemAtIndex

public void addItemAtIndex(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
See Also:
ListModel.addItem(java.lang.Object)

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
See Also:
ListModel.getSelectedIndex()

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
See Also:
ListModel.removeDataChangedListener(com.sun.dtv.lwuit.events.DataChangedListener)

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
See Also:
ListModel.addDataChangedListener(com.sun.dtv.lwuit.events.DataChangedListener)

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
See Also:
ListModel.removeSelectionListener(com.sun.dtv.lwuit.events.SelectionListener)

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
See Also:
ListModel.addSelectionListener(com.sun.dtv.lwuit.events.SelectionListener)

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.