public static class Grid.SingleSelectionModel extends Grid.AbstractSelectionModel implements Grid.SelectionModel.Single, Grid.SelectionModel.HasUserSelectionAllowed
Grid.SelectionModel.Single
Grid.SelectionModel.HasUserSelectionAllowed, Grid.SelectionModel.Multi, Grid.SelectionModel.None, Grid.SelectionModel.Single
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListener
selection
Constructor and Description |
---|
SingleSelectionModel() |
Modifier and Type | Method and Description |
---|---|
protected void |
extend(AbstractClientConnector target)
Add this extension to the target connector.
|
Object |
getSelectedRow()
Gets the item id of the currently selected item.
|
protected SingleSelectionModelState |
getState()
Returns the shared state for this connector.
|
protected SingleSelectionModelState |
getState(boolean markAsDirty)
Returns the shared state for this connector.
|
boolean |
isDeselectAllowed()
Sets whether it's allowed to deselect the selected row through
the UI.
|
boolean |
isUserSelectionAllowed()
Checks if the user is allowed to change the selection.
|
void |
reset()
Resets the selection state.
|
boolean |
select(Object itemId)
Marks an item as selected.
|
protected boolean |
select(Object itemId,
boolean refresh) |
void |
setDeselectAllowed(boolean deselectAllowed)
Sets whether it's allowed to deselect the selected row through
the UI.
|
void |
setUserSelectionAllowed(boolean userSelectionAllowed)
Sets whether the user is allowed to change the selection.
|
checkItemIdExists, checkItemIdsExist, destroyData, fireSelectionEvent, generateData, getItemId, getSelectedRows, isSelected, setGrid
addComponentToGrid, getColumn, getParentGrid, refreshRow, remove, removeComponentFromGrid
getParent, 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
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
getSelectedRows, isSelected, setGrid
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
protected void extend(AbstractClientConnector target)
AbstractExtension
extend
in class Grid.AbstractGridExtension
target
- the connector to attach this extension topublic boolean select(Object itemId)
Grid.SelectionModel.Single
select
in interface Grid.SelectionModel.Single
itemId
- the itemId to mark as selected; null
for
deselecttrue
if the selection state changed.
false
if the itemId already was selectedprotected boolean select(Object itemId, boolean refresh)
public Object getSelectedRow()
Grid.SelectionModel.Single
getSelectedRow
in interface Grid.SelectionModel.Single
null
if nothing is selectedpublic void reset()
If an item is selected, it will become deselected.
reset
in interface Grid.SelectionModel
public void setDeselectAllowed(boolean deselectAllowed)
Grid.SelectionModel.Single
setDeselectAllowed
in interface Grid.SelectionModel.Single
deselectAllowed
- true
if the selected row can be
deselected without selecting another row instead;
otherwise false
.public boolean isDeselectAllowed()
Grid.SelectionModel.Single
isDeselectAllowed
in interface Grid.SelectionModel.Single
true
if deselection is allowed; otherwise
false
protected SingleSelectionModelState 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 AbstractClientConnector
protected SingleSelectionModelState getState(boolean markAsDirty)
AbstractClientConnector
getState
in class AbstractClientConnector
markAsDirty
- true if the connector should automatically be marked dirty,
false otherwiseAbstractClientConnector.getState()
public boolean isUserSelectionAllowed()
Grid.SelectionModel.HasUserSelectionAllowed
isUserSelectionAllowed
in interface Grid.SelectionModel.HasUserSelectionAllowed
true
if the user is allowed to change the
selection, false
otherwisepublic void setUserSelectionAllowed(boolean userSelectionAllowed)
Grid.SelectionModel.HasUserSelectionAllowed
setUserSelectionAllowed
in interface Grid.SelectionModel.HasUserSelectionAllowed
userSelectionAllowed
- true
if the user is allowed to change the
selection, false
otherwiseCopyright © 2019 Vaadin Ltd. All rights reserved.