com.vaadin.client.connectors.grid.
Class MultiSelectionModelConnector
- java.lang.Object
-
- com.vaadin.client.ui.AbstractConnector
-
- com.vaadin.client.extensions.AbstractExtensionConnector
-
- com.vaadin.client.connectors.grid.AbstractSelectionModelConnector
-
- com.vaadin.client.connectors.grid.MultiSelectionModelConnector
-
All Implemented Interfaces:
com.google.gwt.event.shared.EventHandler
,StateChangeEvent.StateChangeHandler
,ServerConnector
,Connector
,Serializable
Direct Known Subclasses:
public class MultiSelectionModelConnector extends AbstractSelectionModelConnector
Connector for server side multiselection model implementation.
This selection model displays a selection column
Grid.SelectionColumn
as the first column of the grid.Implementation detail: The Grid selection is updated immediately on client side, without waiting for the server response.
Since:
8.0
Author:
Vaadin Ltd
See Also:
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
MultiSelectionModelConnector.MultiSelectionModel
Client side multiselection model implementation.
-
Constructor Summary
Constructors Constructor Description MultiSelectionModelConnector()
-
Method Summary
All Methods Modifier and Type Method Description protected MultiSelectionModelConnector.MultiSelectionModel
createSelectionModel()
Creates an instance of MultiSelectionModel.
MultiSelectionModelState
getState()
Returns the shared state object for this connector.
protected void
initSelectionModel()
Initializes the selection model and sets it to the grid.
protected boolean
isAllSelected()
Returns whether all items are selected or not.
protected boolean
isSelected(elemental.json.JsonObject item)
Returns whether the given item selected in grid or not.
protected void
onSelectAllEvent(SelectAllEvent<elemental.json.JsonObject> event)
Handler for selecting / deselecting all grid rows.
void
onUnregister()
Event called when connector has been unregistered.
protected void
updateAllRowsSelected(boolean selected)
Update selection for all grid rows.
protected void
updateRowSelected(DataSource.RowHandle<elemental.json.JsonObject> row, boolean selected)
Marks the given row to be selected or deselected.
protected void
updateSelectAllCheckBox()
Called whenever there has been a state update for select all checkbox visibility or all have been selected or deselected.
-
Methods inherited from class com.vaadin.client.connectors.grid.AbstractSelectionModelConnector
extend, getGrid, getParent, getSpaceSelectionHandler
-
Methods inherited from class com.vaadin.client.extensions.AbstractExtensionConnector
setParent
-
Methods inherited from class com.vaadin.client.ui.AbstractConnector
addStateChangeHandler, addStateChangeHandler, createState, doInit, ensureHandlerManager, fireEvent, forceStateChange, getChildren, getConnection, getConnectorId, getResourceUrl, getRpcImplementations, getRpcProxy, getStateType, getTag, hasEventListener, init, isEnabled, onStateChanged, registerRpc, removeStateChangeHandler, removeStateChangeHandler, setChildren, setTag, unregisterRpc, updateEnabledState
-
-
-
-
Method Detail
-
initSelectionModel
protected void initSelectionModel()
Description copied from class:
AbstractSelectionModelConnector
Initializes the selection model and sets it to the grid.
This method is only invoked once by
AbstractSelectionModelConnector.extend(ServerConnector)
inAbstractSelectionModelConnector
when the grid is available viaAbstractSelectionModelConnector.getGrid()
and the selection model should be taken into use.Specified by:
-
createSelectionModel
protected MultiSelectionModelConnector.MultiSelectionModel createSelectionModel()
Creates an instance of MultiSelectionModel. Method provided overriding features of the selection model without copying all logic.
Returns:
selection model instance, not
null
Since:
8.1
-
onUnregister
public void onUnregister()
Description copied from interface:
ServerConnector
Event called when connector has been unregistered.
Specified by:
onUnregister
in interfaceServerConnector
Overrides:
-
getState
public MultiSelectionModelState getState()
Description copied from class:
AbstractConnector
Returns the shared state object for this connector. Override this method to define the shared state type for your connector.
Specified by:
getState
in interfaceServerConnector
Overrides:
getState
in classAbstractSelectionModelConnector
Returns:
the current shared state (never null)
-
updateSelectAllCheckBox
protected void updateSelectAllCheckBox()
Called whenever there has been a state update for select all checkbox visibility or all have been selected or deselected.
-
isAllSelected
protected boolean isAllSelected()
Returns whether all items are selected or not.
Returns:
true
if all items are selected,false
if not
-
onSelectAllEvent
protected void onSelectAllEvent(SelectAllEvent<elemental.json.JsonObject> event)
Handler for selecting / deselecting all grid rows.
Parameters:
event
- the select all event from grid
-
updateAllRowsSelected
protected void updateAllRowsSelected(boolean selected)
Update selection for all grid rows.
Parameters:
selected
-true
for marking all rows selected,false
for not selected
-
isSelected
protected boolean isSelected(elemental.json.JsonObject item)
Description copied from class:
AbstractSelectionModelConnector
Returns whether the given item selected in grid or not.
Overrides:
isSelected
in classAbstractSelectionModelConnector
Parameters:
item
- the item to checkReturns:
true
if selectedfalse
if not
-
updateRowSelected
protected void updateRowSelected(DataSource.RowHandle<elemental.json.JsonObject> row, boolean selected)
Marks the given row to be selected or deselected. Returns true if the value actually changed.
Note: If selection model is in batch select state, the row will be pinned on select.
Parameters:
row
- row handleselected
-true
if row should be selected;false
if not
-
-