com.yospace.yae.yogi
Interface SelectionModel

All Known Implementing Classes:
DefaultSelectionModel

public interface SelectionModel

The interface for all selection models.


Field Summary
static int SELECTION_MODE_MULTIPLE_INTERVAL
          Any number of intervals may be selected in this mode
static int SELECTION_MODE_NONE
          No selections may be made in this mode
static int SELECTION_MODE_SINGLE
          A single selection may be made in this mode
static int SELECTION_MODE_SINGLE_INTERVAL
          A single interval ( range ) may be selected in this mode
 
Method Summary
 int[] clearSelections()
          Clears all selections in the selection model.
 int getMaxSelectionIndex()
          Gets the highest index currently selected.
 int getMinSelectionIndex()
          Gets the lowest index currently selected.
 int getSelectedIndex()
          Returns an int denoting the index currently selected, or -1 if none are selected.
 int[] getSelectedIndices()
          Returns an int array containing all currently selected elements.
 int getSelectionMode()
          Gets the current selection mode, will be one of: SELECTION_MODE_NONE, SELECTION_MODE_SINGLE, SELECTION_MODE_SINGLE_INTERVAL.
 boolean isSelected(int index)
          Returns the selection status of a specified element.
 void removeSelection(int index)
          Removes a specified selection from the selection model.
 int[] setSelectedIndex(int index, boolean selected, int listSize)
          Sets the specified element to the specified state.
 int[] setSelectedIndices(int[] indices, boolean selected, int listSize)
          Sets the specified elements to the specified state.
 void setSelectionMode(int selectionMode)
          Sets the selection mode.
 

Field Detail

SELECTION_MODE_NONE

public static final int SELECTION_MODE_NONE
No selections may be made in this mode

SELECTION_MODE_SINGLE

public static final int SELECTION_MODE_SINGLE
A single selection may be made in this mode

SELECTION_MODE_SINGLE_INTERVAL

public static final int SELECTION_MODE_SINGLE_INTERVAL
A single interval ( range ) may be selected in this mode

SELECTION_MODE_MULTIPLE_INTERVAL

public static final int SELECTION_MODE_MULTIPLE_INTERVAL
Any number of intervals may be selected in this mode
Method Detail

getSelectionMode

public int getSelectionMode()
Gets the current selection mode, will be one of: SELECTION_MODE_NONE, SELECTION_MODE_SINGLE, SELECTION_MODE_SINGLE_INTERVAL. SELECTION_MODE_MULTIPLE_INTERVAL.
Returns:
selection mode.

setSelectionMode

public void setSelectionMode(int selectionMode)
Sets the selection mode. Must be one of: SELECTION_MODE_NONE, SELECTION_MODE_SINGLE, SELECTION_MODE_SINGLE_INTERVAL. SELECTION_MODE_MULTIPLE_INTERVAL. NB. Calling this method may alter the contents of the selection model. For example, if multiple intervals are selected and the mode then set to single selection, all the intervals other than that at index 0 will be deleted.
Parameters:
selectionMode - the new selection mode.

getMinSelectionIndex

public int getMinSelectionIndex()
Gets the lowest index currently selected.
Returns:
the lowest index currently selected.

getMaxSelectionIndex

public int getMaxSelectionIndex()
Gets the highest index currently selected.
Returns:
the highest index currently selected.

getSelectedIndex

public int getSelectedIndex()
Returns an int denoting the index currently selected, or -1 if none are selected. If this method is called and multiple values have been selected, only the first element is returned.
Returns:
the index that is currently selected.

getSelectedIndices

public int[] getSelectedIndices()
Returns an int array containing all currently selected elements. Will return an array of 0 elements if no elements are selected.
Returns:
an array of the selected indices.

setSelectedIndex

public int[] setSelectedIndex(int index,
                              boolean selected,
                              int listSize)
Sets the specified element to the specified state.
Parameters:
index - the index of the element to set.
selected - the state to set the element to.
listSize - size of the AbstractTable. Allows implementing classes to bounds check the index they have been passed.
Returns:
an array of the items that have been updated as a result of this operation.

setSelectedIndices

public int[] setSelectedIndices(int[] indices,
                                boolean selected,
                                int listSize)
Sets the specified elements to the specified state.
Parameters:
indices - an array of the elements to set.
selected - the new selection state for all of the specified elements.
listSize - the size of the AbstractTable. Allows implementing classes to bounds check the indices they have been passed.
Returns:
an array of the items that have been updated as a result of this operation.

clearSelections

public int[] clearSelections()
Clears all selections in the selection model.
Returns:
an array of the items that have been updated as a result of this operation.

isSelected

public boolean isSelected(int index)
Returns the selection status of a specified element.
Parameters:
index - the specified element.
Returns:
true if the element is currently selected, false if not.

removeSelection

public void removeSelection(int index)
Removes a specified selection from the selection model.
Parameters:
index - the index of the selection being removed.

Copyright 2002 Yospace Holdings Ltd. All Rights Reserved.