Package 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:
MultiSelectionModelImpl,SingleSelectionModelImpl
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:
- Serialized Form
-
-
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 Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voiddestroyAllData()Informs theDataGeneratorthat all data has been dropped.voidextend(AbstractListing<T> grid)Adds this extension to the given parent listing.voidgenerateData(T item, elemental.json.JsonObject jsonObject)Adds custom data for the given item to its serializedJsonObjectrepresentation.protected Grid<T>getGrid()Returns the grid this selection model is attached to using, or throwsIllegalStateExceptionif not attached to any selection model.protected AbstractSelectionModelStategetState()Returns the shared state for this connector.protected AbstractSelectionModelStategetState(boolean markAsDirty)Returns the shared state for this connector.protected abstract voidinit()Initializes the selection model after it has been attached to a grid.booleanisUserSelectionAllowed()Checks if the user is allowed to change the selection.voidremove()Remove this extension from its target.voidsetUserSelectionAllowed(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:DataGeneratorAdds custom data for the given item to its serializedJsonObjectrepresentation. This JSON object will be sent to client-side DataProvider.- Specified by:
generateDatain 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:DataGeneratorInforms theDataGeneratorthat all data has been dropped. This method should clean up any unneeded information stored for items.- Specified by:
destroyAllDatain interfaceDataGenerator<T>
-
getState
protected AbstractSelectionModelState getState()
Description copied from class:AbstractClientConnectorReturns 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:
getStatein classGrid.AbstractGridExtension<T>- Returns:
- The shared state for this connector. Never null.
-
getState
protected AbstractSelectionModelState getState(boolean markAsDirty)
Description copied from class:AbstractClientConnectorReturns the shared state for this connector.- Overrides:
getStatein classGrid.AbstractGridExtension<T>- Parameters:
markAsDirty- true if the connector should automatically be marked dirty, false otherwise- Returns:
- The shared state for this connector. Never null.
- See Also:
AbstractClientConnector.getState()
-
getGrid
protected Grid<T> getGrid() throws IllegalStateException
Returns the grid this selection model is attached to using, or throwsIllegalStateExceptionif 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.AbstractListingExtensionAdds this extension to the given parent listing.- Overrides:
extendin 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:ExtensionRemove this extension from its target. After an extension has been removed, it cannot be attached again.- Specified by:
removein interfaceExtension- Specified by:
removein interfaceGridSelectionModel<T>- Overrides:
removein classAbstractListing.AbstractListingExtension<T>
-
isUserSelectionAllowed
public boolean isUserSelectionAllowed()
Description copied from interface:GridSelectionModelChecks 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:
isUserSelectionAllowedin interfaceGridSelectionModel<T>- Returns:
trueif the user is allowed to change the selection,falseotherwise
-
setUserSelectionAllowed
public void setUserSelectionAllowed(boolean allowed)
Description copied from interface:GridSelectionModelSets 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:
setUserSelectionAllowedin interfaceGridSelectionModel<T>- Parameters:
allowed-trueif the user is allowed to change the selection,falseotherwise
-
-