T
- the record data typepublic class SingleSelectionModel<T> extends SelectionModel.AbstractSelectionModel<T> implements SetSelectionModel<T>
SelectionModel.AbstractSelectionModel<T>
Constructor and Description |
---|
SingleSelectionModel()
Constructs a SingleSelectionModel without a key provider.
|
SingleSelectionModel(ProvidesKey<T> keyProvider)
Constructs a SingleSelectionModel with the given key provider.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears the current selection.
|
protected void |
fireSelectionChangeEvent()
Fire a
SelectionChangeEvent . |
T |
getSelectedObject()
Gets the currently-selected item.
|
java.util.Set<T> |
getSelectedSet()
Get the set of selected items.
|
boolean |
isSelected(T item)
Check if an object is selected.
|
void |
setSelected(T item,
boolean selected)
Set the selected state of an object and fire a
SelectionChangeEvent if the selection has
changed. |
addSelectionChangeHandler, fireEvent, getKey, getKeyProvider, isEventCancelled, isEventScheduled, scheduleSelectionChangeEvent, setEventCancelled, setEventScheduled
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addSelectionChangeHandler
fireEvent
getKey
public SingleSelectionModel()
public SingleSelectionModel(ProvidesKey<T> keyProvider)
keyProvider
- an instance of ProvidesKeypublic void clear()
SetSelectionModel
clear
in interface SetSelectionModel<T>
public T getSelectedObject()
public java.util.Set<T> getSelectedSet()
SetSelectionModel
getSelectedSet
in interface SetSelectionModel<T>
public boolean isSelected(T item)
SelectionModel
isSelected
in interface SelectionModel<T>
item
- the objectpublic void setSelected(T item, boolean selected)
SelectionModel
SelectionChangeEvent
if the selection has
changed. Subclasses should not fire an event in the case where
selected is true and the object was already selected, or selected
is false and the object was not previously selected.setSelected
in interface SelectionModel<T>
item
- the object to select or deselectselected
- true to select, false to deselectprotected void fireSelectionChangeEvent()
SelectionModel.AbstractSelectionModel
SelectionChangeEvent
. Multiple firings may be coalesced.fireSelectionChangeEvent
in class SelectionModel.AbstractSelectionModel<T>