nextapp.echo
Class DefaultListSelectionModel

java.lang.Object
  extended by nextapp.echo.DefaultListSelectionModel
All Implemented Interfaces:
java.io.Serializable, ListSelectionModel

public class DefaultListSelectionModel
extends java.lang.Object
implements ListSelectionModel, java.io.Serializable

The default implementation of ListSelectionModel, the model used by ListBoxes.

See Also:
Serialized Form

Field Summary
static java.lang.String SELECTION_MODE_CHANGED_PROPERTY
           
 
Fields inherited from interface nextapp.echo.ListSelectionModel
MULTIPLE_SELECTION, SINGLE_SELECTION
 
Constructor Summary
DefaultListSelectionModel()
           
 
Method Summary
 void addListSelectionListener(ListSelectionListener l)
          Adds a ListSelectionListener to the selection model.
 void clearSelection()
          Deselects all items.
protected  void fireValueChanged()
          Notifies ListSelectionListeners that the state of this ListSelectionModel has changed.
 int getMaxSelectedIndex()
          Returns the maximum selected index.
 int getMinSelectedIndex()
          Returns the maximum 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 newValue)
          Sets the selection state of the given index.
 void setSelectionMode(int selectionMode)
          Sets the selection mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SELECTION_MODE_CHANGED_PROPERTY

public static final java.lang.String SELECTION_MODE_CHANGED_PROPERTY
See Also:
Constant Field Values
Constructor Detail

DefaultListSelectionModel

public DefaultListSelectionModel()
Method Detail

addListSelectionListener

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

Specified by:
addListSelectionListener in interface ListSelectionModel
Parameters:
l - The ListSelectionListener to be added.

clearSelection

public void clearSelection()
Deselects all items.

Specified by:
clearSelection in interface ListSelectionModel

fireValueChanged

protected void fireValueChanged()
Notifies ListSelectionListeners that the state of this ListSelectionModel has changed.


getMaxSelectedIndex

public int getMaxSelectedIndex()
Returns the maximum selected index.

Specified by:
getMaxSelectedIndex in interface ListSelectionModel
Returns:
the maximum selected index.

getMinSelectedIndex

public int getMinSelectedIndex()
Returns the maximum selected index.

Specified by:
getMinSelectedIndex in interface ListSelectionModel
Returns:
the maximum selected index.

getSelectionMode

public int getSelectionMode()
Returns the selection mode.

Specified by:
getSelectionMode in interface ListSelectionModel
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

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

Specified by:
isSelectedIndex in interface ListSelectionModel
Parameters:
index - The index to test for selection.
Returns:
True if the given index is selected.

isSelectionEmpty

public boolean isSelectionEmpty()
Determines if any items are selected.

Specified by:
isSelectionEmpty in interface ListSelectionModel
Returns:
True if no items are selected.

removeListSelectionListener

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

Specified by:
removeListSelectionListener in interface ListSelectionModel
Parameters:
l - The ListSelectionListener to be removed.

setSelectedIndex

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

Specified by:
setSelectedIndex in interface ListSelectionModel
Parameters:
index - The index to select.
newValue - The new selection state of the item at the given index.

setSelectionMode

public void setSelectionMode(int selectionMode)
Sets the selection mode.

Specified by:
setSelectionMode in interface ListSelectionModel
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.