T
- the type of the items in grid.public abstract class AbstractSelectionModel<T> extends Grid.AbstractGridExtension<T> implements GridSelectionModel<T>
SelectionModel.Multi<T>, SelectionModel.Single<T>
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListener
Constructor and Description |
---|
AbstractSelectionModel() |
Modifier and Type | Method and 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,
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.
|
addComponentToGrid, getInternalIdForColumn, getParent, removeComponentFromGrid
getData, refresh
extend, getSupportedParentType, setParent
addAttachListener, addDetachListener, addExtension, 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, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource, updateDiffstate
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
addSelectionListener, deselect, deselectAll, getFirstSelectedItem, getSelectedItems, isSelected, select
addAttachListener, addDetachListener, attach, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getParent, getRpcManager, getStateType, getUI, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
getConnectorId
destroyData, refreshData
public void generateData(T item, 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 clientpublic void destroyAllData()
DataGenerator
DataGenerator
that all data has been dropped. This
method should clean up any unneeded information stored for items.destroyAllData
in interface DataGenerator<T>
protected AbstractSelectionModelState getState()
AbstractClientConnector
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.
getState
in class Grid.AbstractGridExtension<T>
protected AbstractSelectionModelState getState(boolean markAsDirty)
AbstractClientConnector
getState
in class Grid.AbstractGridExtension<T>
markAsDirty
- true if the connector should automatically be marked dirty,
false otherwiseAbstractClientConnector.getState()
protected Grid<T> getGrid() throws IllegalStateException
IllegalStateException
if not attached to any selection model.IllegalStateException
- if this selection mode is not attached to any gridpublic void extend(AbstractListing<T> grid)
AbstractListing.AbstractListingExtension
extend
in class Grid.AbstractGridExtension<T>
grid
- the parent component to add toprotected abstract void init()
public void remove()
Extension
remove
in interface Extension
remove
in interface GridSelectionModel<T>
remove
in class AbstractListing.AbstractListingExtension<T>
public boolean isUserSelectionAllowed()
GridSelectionModel
The check is done only for the client side actions. It doesn't affect selection requests sent from the server side.
isUserSelectionAllowed
in interface GridSelectionModel<T>
true
if the user is allowed to change the selection,
false
otherwisepublic void setUserSelectionAllowed(boolean allowed)
GridSelectionModel
The check is done only for the client side actions. It doesn't affect selection requests sent from the server side.
setUserSelectionAllowed
in interface GridSelectionModel<T>
allowed
- true
if the user is allowed to change the
selection, false
otherwiseCopyright © 2020 Vaadin Ltd. All rights reserved.