T
- the data type of the itemspublic class MultiSelectionModel<T> extends SelectionModel.AbstractSelectionModel<T> implements SetSelectionModel<T>
Modifier and Type | Class and Description |
---|---|
(package private) static class |
MultiSelectionModel.SelectionChange<T>
Stores an item and its pending selection state.
|
SelectionModel.AbstractSelectionModel<T>
Modifier and Type | Field and Description |
---|---|
(package private) java.util.Map<java.lang.Object,T> |
selectedSet |
Constructor and Description |
---|
MultiSelectionModel()
Constructs a MultiSelectionModel without a key provider.
|
MultiSelectionModel(ProvidesKey<T> keyProvider)
Constructs a MultiSelectionModel with the given key provider.
|
MultiSelectionModel(ProvidesKey<T> keyProvider,
java.util.Map<java.lang.Object,T> selectedSet,
java.util.Map<java.lang.Object,MultiSelectionModel.SelectionChange<T>> selectionChanges)
Construct a MultiSelectionModel with the given key provider and
implementations of selectedSet and selectionChanges.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Deselect all selected values.
|
protected void |
fireSelectionChangeEvent()
Fire a
SelectionChangeEvent . |
java.util.Set<T> |
getSelectedSet()
Get the set of selected items as a copy.
|
boolean |
isSelected(T item)
Check if an object is selected.
|
(package private) void |
resolveChanges() |
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
final java.util.Map<java.lang.Object,T> selectedSet
public MultiSelectionModel()
public MultiSelectionModel(ProvidesKey<T> keyProvider)
keyProvider
- an instance of ProvidesKeyMultiSelectionModel(ProvidesKey<T> keyProvider, java.util.Map<java.lang.Object,T> selectedSet, java.util.Map<java.lang.Object,MultiSelectionModel.SelectionChange<T>> selectionChanges)
keyProvider
- an instance of ProvidesKeyselectedSet
- an instance of MapselectionChanges
- an instance of Mappublic void clear()
clear
in interface SetSelectionModel<T>
public java.util.Set<T> getSelectedSet()
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>
void resolveChanges()