de.matthiasmann.twl.model
Interface ListSelectionModel<T>

Type Parameters:
T - the data type of the list model
All Superinterfaces:
IntegerModel, WithRunnableCallback
All Known Implementing Classes:
SimpleListSelectionModel

public interface ListSelectionModel<T>
extends IntegerModel

Represents the selection of a list box or combo box. Implementation should not register callbacks on the list model.


Field Summary
static int NO_SELECTION
          The index when nothing is selected
 
Method Summary
 ListModel<T> getListModel()
           
 T getSelectedEntry()
          Returns the selected entry in the list or null if nothing is selected.
 boolean setSelectedEntry(T entry)
          Selects the specified entry or nothing if the entry was not found.
 boolean setSelectedEntry(T entry, int defaultIndex)
          Selects the specified entry or the default index if the entry was not found
 
Methods inherited from interface de.matthiasmann.twl.model.IntegerModel
getMaxValue, getMinValue, getValue, setValue
 
Methods inherited from interface de.matthiasmann.twl.utils.WithRunnableCallback
addCallback, removeCallback
 

Field Detail

NO_SELECTION

static final int NO_SELECTION
The index when nothing is selected

See Also:
Constant Field Values
Method Detail

getListModel

ListModel<T> getListModel()

getSelectedEntry

T getSelectedEntry()
Returns the selected entry in the list or null if nothing is selected.

Returns:
the selected entry or null.

setSelectedEntry

boolean setSelectedEntry(T entry)
Selects the specified entry or nothing if the entry was not found. This method behaves like setSelectedEntry(entry, NO_SELECTION)

Parameters:
entry - the entry to select - can be null.
Returns:
true if the entry was found
See Also:
setSelectedEntry(java.lang.Object, int), NO_SELECTION

setSelectedEntry

boolean setSelectedEntry(T entry,
                         int defaultIndex)
Selects the specified entry or the default index if the entry was not found

Parameters:
entry - the entry to select - can be null.
defaultIndex - the index to select when the entry was not found
Returns:
true if the entry was found
See Also:
NO_SELECTION