com.algosome.common.event
Interface IndexSelectionModel

All Known Implementing Classes:
IndexSelectionModelImpl

public interface IndexSelectionModel

Model for selections of a single or multiple (discontiguous) indexes.

Author:
Greg Cope

Field Summary
static int MULTI_SELECTION_MODE
           
static int SINGLE_SELECTION_MODE
           
 
Method Summary
 void addSelectionListener(IndexSelectionListener listener)
          Adds the parameter listener
 java.util.List<IndexSelectionListener> getListeners()
          Retrieves all Listeners.
 int[] getSelectedIndeces()
          Retrieves the selected indeces, or {-1}.
 int getSelectedIndex()
          Retrieves the selected index.
 int getSelectionMode()
          Retrieves the mode.
 void removeSelectionListener(IndexSelectionListener listener)
          Removes the parameter listener.
 void setSelection(int... sel)
          Sets the selection.
 void setSelectionMode(int mode)
          Sets the mode.
 

Field Detail

SINGLE_SELECTION_MODE

static final int SINGLE_SELECTION_MODE
See Also:
Constant Field Values

MULTI_SELECTION_MODE

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

getSelectedIndex

int getSelectedIndex()
Retrieves the selected index. If selection mode is MULTI_SELECTION_MODE, this retrieves the first value of the list. If no selection is available, -1 should be returned.

Returns:

getSelectedIndeces

int[] getSelectedIndeces()
Retrieves the selected indeces, or {-1}.

Returns:

getSelectionMode

int getSelectionMode()
Retrieves the mode.

Returns:
One of SINGLE_SELECTION_MODE or MULTI_SELECTION_MODE

setSelectionMode

void setSelectionMode(int mode)
Sets the mode.

Parameters:
mode - On of SINGLE_SELECTION_MODE or MULTI_SELECTION_MODE
Throws:
java.lang.IllegalArgumentException - if parameter is not one of SINGLE_SELECTION_MODE or MULTI_SELECTION_MODE

addSelectionListener

void addSelectionListener(IndexSelectionListener listener)
Adds the parameter listener

Parameters:
listener -

removeSelectionListener

void removeSelectionListener(IndexSelectionListener listener)
Removes the parameter listener.

Parameters:
listener -

getListeners

java.util.List<IndexSelectionListener> getListeners()
Retrieves all Listeners.

Returns:

setSelection

void setSelection(int... sel)
Sets the selection.

Parameters:
sel -