T - the grid typepublic abstract class AbstractGridMultiSelectionModel<T> extends Grid.AbstractGridExtension<T> implements GridMultiSelectionModel<T>
GridMultiSelectionModel.SelectAllCheckboxVisibilitySelectionModel.Multi<C extends Component,T>, SelectionModel.Single<C extends Component,T>| Constructor and Description |
|---|
AbstractGridMultiSelectionModel(Grid<T> grid)
Constructor for passing a reference of the grid to this implementation.
|
| Modifier and Type | Method and Description |
|---|---|
Registration |
addMultiSelectionListener(MultiSelectionListener<Grid<T>,T> listener)
Adds a selection listener that will be called when the selection is
changed either by the user or programmatically.
|
Registration |
addSelectionListener(SelectionListener<Grid<T>,T> listener)
Adds a generic listener to this selection model, accepting both single
and multiselection events.
|
MultiSelect<Grid<T>,T> |
asMultiSelect()
Gets a wrapper to use this multiselection model as a multiselect in
Binder. |
void |
deselect(T item)
Deselects the given item.
|
void |
deselectAll()
Deselects all currently selected items, if any.
|
void |
deselectFromClient(T item)
Handles the deselection of an item that originates from the client.
|
protected abstract void |
fireSelectionEvent(SelectionEvent<Grid<T>,T> event)
Method for handling the firing of selection events.
|
void |
generateData(T item,
elemental.json.JsonObject jsonObject)
Adds custom data for the given item to its serialized
JsonObject
representation. |
Optional<T> |
getFirstSelectedItem()
Get first selected data item.
|
GridMultiSelectionModel.SelectAllCheckboxVisibility |
getSelectAllCheckboxVisibility()
Gets the current mode for the select all checkbox visibility.
|
Set<T> |
getSelectedItems()
Returns an immutable set of the currently selected items.
|
boolean |
isSelectAllCheckboxVisible()
Returns whether the select all checkbox will be visible with the current
setting of
GridMultiSelectionModel.setSelectAllCheckboxVisibility(SelectAllCheckboxVisibility) and
the type of data set to the Grid (in-memory or lazy). |
boolean |
isSelected(T item)
Returns whether the given item is currently selected.
|
boolean |
isSelectionColumnFrozen()
Gets the the selection column's frozen state.
|
protected void |
remove()
Remove this extension from its target.
|
void |
select(T item)
Selects the given item.
|
void |
selectAll()
Selects all available the items.
|
void |
selectFromClient(T item)
Handles the selection of an item that originates from the client.
|
void |
setSelectAllCheckboxVisibility(GridMultiSelectionModel.SelectAllCheckboxVisibility selectAllCheckBoxVisibility)
Sets the select all checkbox visibility mode.
|
void |
setSelectionColumnFrozen(boolean frozen)
Sets the selection column's frozen state.
|
void |
updateSelection(Set<T> addedItems,
Set<T> removedItems)
Updates the selection by adding and removing the given items from it.
|
extend, getGrid, refreshclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdeselectItems, selectItemsdestroyAllData, destroyData, refreshDataprotected void remove()
Grid.AbstractGridExtensionremove in class Grid.AbstractGridExtension<T>public void selectFromClient(T item)
GridSelectionModelselectFromClient in interface GridSelectionModel<T>item - the item being selectedpublic void deselectFromClient(T item)
GridSelectionModeldeselectFromClient in interface GridSelectionModel<T>item - the item being deselectedpublic Set<T> getSelectedItems()
SelectionModelSelectionModel methods while iterating over the set.
Implementation note: the iteration order of the items in the returned set should be well-defined and documented by the implementing class.
getSelectedItems in interface SelectionModel<Grid<T>,T>public Optional<T> getFirstSelectedItem()
SelectionModel
This is the same as SelectionModel.Single.getSelectedItem() in case of single
selection and the first selected item from
SelectionModel.getSelectedItems() in case of multiselection.
getFirstSelectedItem in interface SelectionModel<Grid<T>,T>getFirstSelectedItem in interface SelectionModel.Multi<Grid<T>,T>public void select(T item)
SelectionModelselect in interface SelectionModel<Grid<T>,T>select in interface SelectionModel.Multi<Grid<T>,T>item - the item to select, not nullpublic void deselect(T item)
SelectionModeldeselect in interface SelectionModel<Grid<T>,T>deselect in interface SelectionModel.Multi<Grid<T>,T>item - the item to deselect, not nullpublic void selectAll()
SelectionModel.MultiselectAll in interface SelectionModel.Multi<Grid<T>,T>public void deselectAll()
SelectionModeldeselectAll in interface SelectionModel<Grid<T>,T>public void updateSelection(Set<T> addedItems, Set<T> removedItems)
SelectionModel.MultiIf all the added items were already selected and the removed items were not selected, this is a NO-OP.
Duplicate items (in both add & remove sets) are ignored.
updateSelection in interface SelectionModel.Multi<Grid<T>,T>addedItems - the items to add, not nullremovedItems - the items to remove, not nullpublic boolean isSelected(T item)
SelectionModelisSelected in interface SelectionModel<Grid<T>,T>item - the item to check, not nulltrue if the item is selected, false otherwisepublic MultiSelect<Grid<T>,T> asMultiSelect()
GridMultiSelectionModelBinder.asMultiSelect in interface GridMultiSelectionModel<T>public Registration addSelectionListener(SelectionListener<Grid<T>,T> listener)
SelectionModeladdSelectionListener in interface SelectionModel<Grid<T>,T>listener - the listener to add, not nullpublic Registration addMultiSelectionListener(MultiSelectionListener<Grid<T>,T> listener)
GridMultiSelectionModeladdMultiSelectionListener in interface GridMultiSelectionModel<T>listener - the multi selection listener, not nullpublic void setSelectAllCheckboxVisibility(GridMultiSelectionModel.SelectAllCheckboxVisibility selectAllCheckBoxVisibility)
GridMultiSelectionModel
The default value is GridMultiSelectionModel.SelectAllCheckboxVisibility.DEFAULT, which
means that the checkbox is only visible if the grid's data provider is
in-memory.
The select all checkbox will never be shown if the Grid uses lazy loading
with unknown item count, i.e. no items count query provided to it, and
even setting GridMultiSelectionModel.SelectAllCheckboxVisibility.VISIBLE won't make it
visible.
setSelectAllCheckboxVisibility in interface GridMultiSelectionModel<T>selectAllCheckBoxVisibility - the visiblity mode to useGridMultiSelectionModel.SelectAllCheckboxVisibilitypublic GridMultiSelectionModel.SelectAllCheckboxVisibility getSelectAllCheckboxVisibility()
GridMultiSelectionModelgetSelectAllCheckboxVisibility in interface GridMultiSelectionModel<T>GridMultiSelectionModel.SelectAllCheckboxVisibility,
GridMultiSelectionModel.isSelectAllCheckboxVisible()public boolean isSelectAllCheckboxVisible()
GridMultiSelectionModelGridMultiSelectionModel.setSelectAllCheckboxVisibility(SelectAllCheckboxVisibility) and
the type of data set to the Grid (in-memory or lazy).
The select all checkbox will never be shown if the Grid uses lazy loading with unknown item count, meaning that no count callback has been provided.
isSelectAllCheckboxVisible in interface GridMultiSelectionModel<T>true if the checkbox will be visible with the current
settingsGridMultiSelectionModel.SelectAllCheckboxVisibility,
GridMultiSelectionModel.setSelectAllCheckboxVisibility(SelectAllCheckboxVisibility)public void generateData(T item, elemental.json.JsonObject jsonObject)
DataGeneratorJsonObject
representation. This JSON object will be sent to client-side
DataProvider.generateData in interface DataGenerator<T>item - the data item being serializedjsonObject - the JSON object being sent to the clientpublic void setSelectionColumnFrozen(boolean frozen)
GridMultiSelectionModelsetSelectionColumnFrozen in interface GridMultiSelectionModel<T>frozen - whether to freeze or unfreeze the selection columnpublic boolean isSelectionColumnFrozen()
GridMultiSelectionModelisSelectionColumnFrozen in interface GridMultiSelectionModel<T>protected abstract void fireSelectionEvent(SelectionEvent<Grid<T>,T> event)
event - the selection event to fireCopyright © 2022. All rights reserved.