T
- the type of items in the gridpublic class NoSelectionModel<T> extends AbstractExtension implements GridSelectionModel<T>
SelectionModel.Multi<T>, SelectionModel.Single<T>
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListener
Constructor and Description |
---|
NoSelectionModel() |
Modifier and Type | Method and Description |
---|---|
Registration |
addSelectionListener(SelectionListener<T> listener)
Adds a generic listener to this selection model, accepting both single
and multiselection events.
|
void |
deselect(T item)
Deselects the given item.
|
void |
deselectAll()
Deselects all currently selected items, if any.
|
Optional<T> |
getFirstSelectedItem()
Get first selected data item.
|
Set<T> |
getSelectedItems()
Returns an immutable set of the currently selected items.
|
boolean |
isUserSelectionAllowed()
Checks if the user is allowed to change the selection.
|
void |
select(T item)
Selects the given item.
|
void |
setUserSelectionAllowed(boolean allowed)
Sets whether the user is allowed to change the selection.
|
extend, getParent, getSupportedParentType, remove, setParent
addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addMethodInvocationToQueue, attach, beforeClientResponse, createState, detach, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getState, getState, 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
remove
isSelected
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
public Set<T> getSelectedItems()
SelectionModel
SelectionModel
methods while iterating over the set.
Implementation note: the iteration order of the items in the returned set should be well-defined and documented by the implementing class.
getSelectedItems
in interface SelectionModel<T>
public Optional<T> getFirstSelectedItem()
SelectionModel
This is the same as SelectionModel.Single.getSelectedItem()
in case of single
selection and the first selected item from
SelectionModel.getSelectedItems()
in case of multiselection.
getFirstSelectedItem
in interface SelectionModel<T>
public void select(T item)
SelectionModel
select
in interface SelectionModel<T>
item
- the item to select, not nullpublic void deselect(T item)
SelectionModel
deselect
in interface SelectionModel<T>
item
- the item to deselect, not nullpublic void deselectAll()
SelectionModel
deselectAll
in interface SelectionModel<T>
public Registration addSelectionListener(SelectionListener<T> listener)
SelectionModel
addSelectionListener
in interface SelectionModel<T>
listener
- the listener to addpublic 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
otherwisepublic 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
otherwiseCopyright © 2020 Vaadin Ltd. All rights reserved.