com.vaadin.ui.components.grid.
Class AbstractSelectionModel<T>
- java.lang.Object
-
- com.vaadin.server.AbstractClientConnector
-
- com.vaadin.server.AbstractExtension
-
- com.vaadin.ui.AbstractListing.AbstractListingExtension<T>
-
- com.vaadin.ui.Grid.AbstractGridExtension<T>
-
- com.vaadin.ui.components.grid.AbstractSelectionModel<T>
-
Type Parameters:
T
- the type of the items in grid.All Implemented Interfaces:
DataGenerator<T>
,SelectionModel<T>
,MethodEventSource
,ClientConnector
,Extension
,Connector
,GridSelectionModel<T>
,Serializable
Direct Known Subclasses:
public abstract class AbstractSelectionModel<T> extends Grid.AbstractGridExtension<T> implements GridSelectionModel<T>
Abstract selection model for grid.
Since:
8.0
Author:
Vaadin Ltd
See Also:
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.vaadin.server.ClientConnector
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListener
-
Nested classes/interfaces inherited from interface com.vaadin.data.SelectionModel
SelectionModel.Multi<T>, SelectionModel.Single<T>
-
-
Constructor Summary
Constructors Constructor Description AbstractSelectionModel()
-
Method Summary
All Methods Modifier and Type Method Description void
destroyAllData()
Informs the
DataGenerator
that all data has been dropped.void
extend(AbstractListing<T> grid)
Adds this extension to the given parent listing.
void
generateData(T item, elemental.json.JsonObject jsonObject)
Adds custom data for the given item to its serialized
JsonObject
representation.protected Grid<T>
getGrid()
Returns the grid this selection model is attached to using, or throws
IllegalStateException
if not attached to any selection model.protected AbstractSelectionModelState
getState()
Returns the shared state for this connector.
protected AbstractSelectionModelState
getState(boolean markAsDirty)
Returns the shared state for this connector.
protected abstract void
init()
Initializes the selection model after it has been attached to a grid.
boolean
isUserSelectionAllowed()
Checks if the user is allowed to change the selection.
void
remove()
Remove this extension from its target.
void
setUserSelectionAllowed(boolean allowed)
Sets whether the user is allowed to change the selection.
-
Methods inherited from class com.vaadin.ui.Grid.AbstractGridExtension
addComponentToGrid, getInternalIdForColumn, getParent, removeComponentFromGrid
-
Methods inherited from class com.vaadin.ui.AbstractListing.AbstractListingExtension
getData, refresh
-
Methods inherited from class com.vaadin.server.AbstractExtension
extend, getSupportedParentType, setParent
-
Methods inherited from class com.vaadin.server.AbstractClientConnector
addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addListener, addListener, addListener, addMethodInvocationToQueue, attach, beforeClientResponse, createState, detach, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, handleConnectorRequest, hashCode, hasListeners, isAttached, isConnectorEnabled, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource, updateDiffstate
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vaadin.server.ClientConnector
addAttachListener, addDetachListener, attach, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getParent, getRpcManager, getStateType, getUI, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
-
Methods inherited from interface com.vaadin.shared.Connector
getConnectorId
-
Methods inherited from interface com.vaadin.data.provider.DataGenerator
destroyData, refreshData
-
Methods inherited from interface com.vaadin.data.SelectionModel
addSelectionListener, deselect, deselectAll, getFirstSelectedItem, getSelectedItems, isSelected, select
-
-
-
-
Method Detail
-
generateData
public void generateData(T item, elemental.json.JsonObject jsonObject)
Description copied from interface:
DataGenerator
Adds custom data for the given item to its serialized
JsonObject
representation. This JSON object will be sent to client-side DataProvider.Specified by:
generateData
in interfaceDataGenerator<T>
Parameters:
item
- the data item being serializedjsonObject
- the JSON object being sent to the client
-
destroyAllData
public void destroyAllData()
Description copied from interface:
DataGenerator
Informs the
DataGenerator
that all data has been dropped. This method should clean up any unneeded information stored for items.Specified by:
destroyAllData
in interfaceDataGenerator<T>
-
getState
protected AbstractSelectionModelState getState()
Description copied from class:
AbstractClientConnector
Returns the shared state for this connector. The shared state object is shared between the server connector and the client connector. Changes are only communicated from the server to the client and not in the other direction.
As a side effect, marks the connector dirty so any changes done to the state will be sent to the client. Use
getState(false)
to avoid marking the connector as dirty.Overrides:
getState
in classGrid.AbstractGridExtension<T>
Returns:
The shared state for this connector. Never null.
-
getState
protected AbstractSelectionModelState getState(boolean markAsDirty)
Description copied from class:
AbstractClientConnector
Returns the shared state for this connector.
Overrides:
getState
in classGrid.AbstractGridExtension<T>
Parameters:
markAsDirty
- true if the connector should automatically be marked dirty, false otherwiseReturns:
The shared state for this connector. Never null.
See Also:
-
getGrid
protected Grid<T> getGrid() throws IllegalStateException
Returns the grid this selection model is attached to using, or throws
IllegalStateException
if not attached to any selection model.Returns:
the grid this selection model is attached to
Throws:
IllegalStateException
- if this selection mode is not attached to any grid
-
extend
public void extend(AbstractListing<T> grid)
Description copied from class:
AbstractListing.AbstractListingExtension
Adds this extension to the given parent listing.
Overrides:
extend
in classGrid.AbstractGridExtension<T>
Parameters:
grid
- the parent component to add to
-
init
protected abstract void init()
Initializes the selection model after it has been attached to a grid.
-
remove
public void remove()
Description copied from interface:
Extension
Remove this extension from its target. After an extension has been removed, it cannot be attached again.
Specified by:
Specified by:
remove
in interfaceGridSelectionModel<T>
Overrides:
remove
in classAbstractListing.AbstractListingExtension<T>
-
isUserSelectionAllowed
public boolean isUserSelectionAllowed()
Description copied from interface:
GridSelectionModel
Checks if the user is allowed to change the selection.
The check is done only for the client side actions. It doesn't affect selection requests sent from the server side.
Specified by:
isUserSelectionAllowed
in interfaceGridSelectionModel<T>
Returns:
true
if the user is allowed to change the selection,false
otherwise
-
setUserSelectionAllowed
public void setUserSelectionAllowed(boolean allowed)
Description copied from interface:
GridSelectionModel
Sets whether the user is allowed to change the selection.
The check is done only for the client side actions. It doesn't affect selection requests sent from the server side.
Specified by:
setUserSelectionAllowed
in interfaceGridSelectionModel<T>
Parameters:
allowed
-true
if the user is allowed to change the selection,false
otherwise
-
-