T - the grid typepublic abstract class AbstractGridSingleSelectionModel<T> extends Grid.AbstractGridExtension<T> implements GridSingleSelectionModel<T>
SelectionModel.Multi<C extends Component,T>, SelectionModel.Single<C extends Component,T>| Constructor and Description |
|---|
AbstractGridSingleSelectionModel(Grid<T> grid)
Constructor for passing a reference of the grid to this implementation.
|
| Modifier and Type | Method and Description |
|---|---|
Registration |
addSelectionListener(SelectionListener<Grid<T>,T> listener)
Adds a generic listener to this selection model, accepting both single
and multiselection events.
|
Registration |
addSingleSelectionListener(SingleSelectionListener<Grid<T>,T> listener)
Adds a selection listener that will be called when the selection is
changed either by the user or programmatically.
|
SingleSelect<Grid<T>,T> |
asSingleSelect()
Gets a wrapper to use this single selection model as a single select in
Binder. |
void |
deselect(T item)
Deselects the given item.
|
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> |
getSelectedItem()
Returns the currently selected item, or an empty optional if no item
is selected.
|
boolean |
isDeselectAllowed()
Gets whether it's allowed to deselect the selected row through the
UI.
|
protected void |
remove()
Remove this extension from its target.
|
void |
select(T item)
Selects the given item.
|
void |
selectFromClient(T item)
Handles the selection of an item that originates from the client.
|
void |
setDeselectAllowed(boolean deselectAllowed)
Sets whether it's allowed to deselect the selected row through the
UI.
|
extend, getGrid, refreshclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdeselectAll, getFirstSelectedItem, getSelectedItems, setSelectedItemisSelecteddestroyAllData, destroyData, refreshDatapublic void selectFromClient(T item)
GridSelectionModelselectFromClient in interface GridSelectionModel<T>item - the item being selectedpublic void select(T item)
SelectionModelselect in interface SelectionModel<Grid<T>,T>select in interface SelectionModel.Single<Grid<T>,T>item - the item to select, not nullpublic void deselectFromClient(T item)
GridSelectionModeldeselectFromClient in interface GridSelectionModel<T>item - the item beign deselectedpublic void deselect(T item)
SelectionModeldeselect in interface SelectionModel<Grid<T>,T>item - the item to deselect, not nullpublic Optional<T> getSelectedItem()
SelectionModel.SinglegetSelectedItem in interface SelectionModel.Single<Grid<T>,T>public void setDeselectAllowed(boolean deselectAllowed)
SelectionModel.SinglesetDeselectAllowed in interface SelectionModel.Single<Grid<T>,T>deselectAllowed - true if the selected row can be deselected
without selecting another row instead; otherwise
false.public boolean isDeselectAllowed()
SelectionModel.SingleisDeselectAllowed in interface SelectionModel.Single<Grid<T>,T>true if deselection is allowed; otherwise
falsepublic SingleSelect<Grid<T>,T> asSingleSelect()
GridSingleSelectionModelBinder.asSingleSelect in interface GridSingleSelectionModel<T>public Registration addSelectionListener(SelectionListener<Grid<T>,T> listener)
SelectionModeladdSelectionListener in interface SelectionModel<Grid<T>,T>listener - the listener to add, not nullpublic Registration addSingleSelectionListener(SingleSelectionListener<Grid<T>,T> listener)
GridSingleSelectionModeladdSingleSelectionListener in interface GridSingleSelectionModel<T>listener - the single selection listener, not nullpublic 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 clientprotected void remove()
Grid.AbstractGridExtensionremove in class Grid.AbstractGridExtension<T>protected abstract void fireSelectionEvent(SelectionEvent<Grid<T>,T> event)
event - the selection event to fireCopyright © 2021. All rights reserved.