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, refresh
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
deselectAll, getFirstSelectedItem, getSelectedItems, setSelectedItem
isSelected
destroyAllData, destroyData, refreshData
public void selectFromClient(T item)
GridSelectionModel
selectFromClient
in interface GridSelectionModel<T>
item
- the item being selectedpublic void select(T item)
SelectionModel
select
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)
GridSelectionModel
deselectFromClient
in interface GridSelectionModel<T>
item
- the item beign deselectedpublic void deselect(T item)
SelectionModel
deselect
in interface SelectionModel<Grid<T>,T>
item
- the item to deselect, not nullpublic Optional<T> getSelectedItem()
SelectionModel.Single
getSelectedItem
in interface SelectionModel.Single<Grid<T>,T>
public void setDeselectAllowed(boolean deselectAllowed)
SelectionModel.Single
setDeselectAllowed
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.Single
isDeselectAllowed
in interface SelectionModel.Single<Grid<T>,T>
true
if deselection is allowed; otherwise
false
public SingleSelect<Grid<T>,T> asSingleSelect()
GridSingleSelectionModel
Binder
.asSingleSelect
in interface GridSingleSelectionModel<T>
public Registration addSelectionListener(SelectionListener<Grid<T>,T> listener)
SelectionModel
addSelectionListener
in interface SelectionModel<Grid<T>,T>
listener
- the listener to add, not null
public Registration addSingleSelectionListener(SingleSelectionListener<Grid<T>,T> listener)
GridSingleSelectionModel
addSingleSelectionListener
in interface GridSingleSelectionModel<T>
listener
- the single selection listener, not null
public void generateData(T item, elemental.json.JsonObject jsonObject)
DataGenerator
JsonObject
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.AbstractGridExtension
remove
in class Grid.AbstractGridExtension<T>
protected abstract void fireSelectionEvent(SelectionEvent<Grid<T>,T> event)
event
- the selection event to fireCopyright © 2019. All rights reserved.