ewe.data
Interface IndexSelectable

All Known Subinterfaces:
IList, ISimpleList
All Known Implementing Classes:
BasicList

public interface IndexSelectable

ISelectable is an interface that represents an Object that contains some sort of list of which various items can be selected.


Method Summary
 int countSelectedIndexes()
          Returns the number of items that are currently selected.
 int getSelectedIndex(int indexOfSelectedIndex)
          This returns one of the selected index.
 int[] getSelectedIndexes()
          Get a list of all the currently selected items as an array of indexes.
 boolean isSelected(int index)
          Checks if an item is selected.
 void select(int index, boolean chosen)
          Select or deselect a single item.
 void setSelectedIndexes(int[] chosen)
          Set which indexes should be selected.
 

Method Detail

getSelectedIndexes

public int[] getSelectedIndexes()
Get a list of all the currently selected items as an array of indexes. If no items are selected this will return an integer array with zero elements.

Returns:
a list of all the currently selected items as an array of indexes.

setSelectedIndexes

public void setSelectedIndexes(int[] chosen)
Set which indexes should be selected. Any items not in this array will be deselected if they are currently selected. So if you call this with an int array of zero elements, this will have the effect of deselecting all indexes.

Parameters:
chosen - an array of integer indexes to be set as the selection.

select

public void select(int index,
                   boolean chosen)
Select or deselect a single item.

Parameters:
index - the index of the item.
chosen - true to select the item, false to deselect it.

isSelected

public boolean isSelected(int index)
Checks if an item is selected.

Parameters:
index - the index of the item.
Returns:
true if the item is selected, false if not.

countSelectedIndexes

public int countSelectedIndexes()
Returns the number of items that are currently selected.

Returns:
the number of items that are currently selected.

getSelectedIndex

public int getSelectedIndex(int indexOfSelectedIndex)
This returns one of the selected index. Say a list has items 2, 5 and 11 selected. Then calling countSelectedIndexes() will return a value of 3 - indicating 3 items are selected. Calling this method with indexOfSelectedIndex being 0 will return the value 2 which is the index of the first selected item. Calling this method with indexOfSelectedIndex being 1 will return the value 5 and calling with a parameter of 2 will return the value 11.

Parameters:
indexOfSelectedIndex - which of the selected indexes to return.
Returns:
one of the selected indexes.