nextapp.echo
Interface ListSelectionModel

All Known Implementing Classes:
DefaultListSelectionModel, TreeListSelectionModel

public interface ListSelectionModel

A representation of the selected items in a ListBox.


Field Summary
static int MULTIPLE_SELECTION
           
static int SINGLE_SELECTION
           
 
Method Summary
 void addListSelectionListener(ListSelectionListener l)
          Adds a ListSelectionListener to the selection model.
 void clearSelection()
          Deselects all items.
 int getMaxSelectedIndex()
          Returns the maximum selected index.
 int getMinSelectedIndex()
          Returns the minimum selected index.
 int getSelectionMode()
          Returns the selection mode.
 boolean isSelectedIndex(int index)
          Determines whether an index is selected.
 boolean isSelectionEmpty()
          Determines if any items are selected.
 void removeListSelectionListener(ListSelectionListener l)
          Removes a ListSelectionListener from the selection model.
 void setSelectedIndex(int index, boolean selected)
          Sets the selection state of the given index.
 void setSelectionMode(int selectionMode)
          Sets the selection mode.
 

Field Detail

SINGLE_SELECTION

static final int SINGLE_SELECTION
See Also:
Constant Field Values

MULTIPLE_SELECTION

static final int MULTIPLE_SELECTION
See Also:
Constant Field Values
Method Detail

addListSelectionListener

void addListSelectionListener(ListSelectionListener l)
Adds a ListSelectionListener to the selection model.

Parameters:
l - The ListSelectionListener to be added.

clearSelection

void clearSelection()
Deselects all items.


getMaxSelectedIndex

int getMaxSelectedIndex()
Returns the maximum selected index.

Returns:
the maximum selected index.

getMinSelectedIndex

int getMinSelectedIndex()
Returns the minimum selected index.

Returns:
The minimum selected index.

getSelectionMode

int getSelectionMode()
Returns the selection mode.

Returns:
The selection mode, one of the following values:
  • ListSelectionModel.SINGLE_SELECTION: only one list element may be selected.
  • ListSelectionModel.MULTIPLE_SELECTION: multiple list elements may be selected.

isSelectedIndex

boolean isSelectedIndex(int index)
Determines whether an index is selected.

Parameters:
index - The index to test for selection.
Returns:
True if the given index is selected.

isSelectionEmpty

boolean isSelectionEmpty()
Determines if any items are selected.

Returns:
True if no items are selected.

removeListSelectionListener

void removeListSelectionListener(ListSelectionListener l)
Removes a ListSelectionListener from the selection model.

Parameters:
l - The ListSelectionListener to be removed.

setSelectedIndex

void setSelectedIndex(int index,
                      boolean selected)
Sets the selection state of the given index.

Parameters:
index - The index to select.

setSelectionMode

void setSelectionMode(int selectionMode)
Sets the selection mode.

Parameters:
selectionMode - The selection mode, one of the following values:
  • ListSelectionModel.SINGLE_SELECTION: only one list element may be selected.
  • ListSelectionModel.MULTIPLE_SELECTION: multiple list elements may be selected.