Package com.vaadin.ui
Class Grid.SingleSelectionModel
- java.lang.Object
-
- com.vaadin.server.AbstractClientConnector
-
- com.vaadin.server.AbstractExtension
-
- com.vaadin.ui.Grid.AbstractGridExtension
-
- com.vaadin.ui.Grid.AbstractSelectionModel
-
- com.vaadin.ui.Grid.SingleSelectionModel
-
- All Implemented Interfaces:
MethodEventSource
,ClientConnector
,DataGenerator
,Extension
,Connector
,Grid.SelectionModel
,Grid.SelectionModel.HasUserSelectionAllowed
,Grid.SelectionModel.Single
,Serializable
- Enclosing class:
- Grid
public static class Grid.SingleSelectionModel extends Grid.AbstractSelectionModel implements Grid.SelectionModel.Single, Grid.SelectionModel.HasUserSelectionAllowed
A default implementation of aGrid.SelectionModel.Single
- 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.ui.Grid.SelectionModel
Grid.SelectionModel.HasUserSelectionAllowed, Grid.SelectionModel.Multi, Grid.SelectionModel.None, Grid.SelectionModel.Single
-
-
Field Summary
-
Fields inherited from class com.vaadin.ui.Grid.AbstractSelectionModel
selection
-
-
Constructor Summary
Constructors Constructor Description SingleSelectionModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.-
Methods inherited from class com.vaadin.ui.Grid.AbstractSelectionModel
checkItemIdExists, checkItemIdsExist, destroyData, fireSelectionEvent, generateData, getItemId, getSelectedRows, isSelected, setGrid
-
Methods inherited from class com.vaadin.ui.Grid.AbstractGridExtension
addComponentToGrid, getColumn, getParentGrid, refreshRow, remove, removeComponentFromGrid
-
Methods inherited from class com.vaadin.server.AbstractExtension
getParent, getSupportedParentType, setParent
-
Methods inherited from class com.vaadin.server.AbstractClientConnector
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
-
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.ui.Grid.SelectionModel
getSelectedRows, isSelected, setGrid
-
-
-
-
Method Detail
-
extend
protected void extend(AbstractClientConnector target)
Description copied from class:AbstractExtension
Add this extension to the target connector. This method is protected to allow subclasses to require a more specific type of target.- Overrides:
extend
in classGrid.AbstractGridExtension
- Parameters:
target
- the connector to attach this extension to
-
select
public boolean select(Object itemId)
Description copied from interface:Grid.SelectionModel.Single
Marks an item as selected.- Specified by:
select
in interfaceGrid.SelectionModel.Single
- Parameters:
itemId
- the itemId to mark as selected;null
for deselect- Returns:
true
if the selection state changed.false
if the itemId already was selected
-
select
protected boolean select(Object itemId, boolean refresh)
-
getSelectedRow
public Object getSelectedRow()
Description copied from interface:Grid.SelectionModel.Single
Gets the item id of the currently selected item.- Specified by:
getSelectedRow
in interfaceGrid.SelectionModel.Single
- Returns:
- the item id of the currently selected item, or
null
if nothing is selected
-
reset
public void reset()
Resets the selection state.If an item is selected, it will become deselected.
- Specified by:
reset
in interfaceGrid.SelectionModel
-
setDeselectAllowed
public void setDeselectAllowed(boolean deselectAllowed)
Description copied from interface:Grid.SelectionModel.Single
Sets whether it's allowed to deselect the selected row through the UI. Deselection is allowed by default.- Specified by:
setDeselectAllowed
in interfaceGrid.SelectionModel.Single
- Parameters:
deselectAllowed
-true
if the selected row can be deselected without selecting another row instead; otherwisefalse
.
-
isDeselectAllowed
public boolean isDeselectAllowed()
Description copied from interface:Grid.SelectionModel.Single
Sets whether it's allowed to deselect the selected row through the UI.- Specified by:
isDeselectAllowed
in interfaceGrid.SelectionModel.Single
- Returns:
true
if deselection is allowed; otherwisefalse
-
getState
protected SingleSelectionModelState 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 classAbstractClientConnector
- Returns:
- The shared state for this connector. Never null.
-
getState
protected SingleSelectionModelState getState(boolean markAsDirty)
Description copied from class:AbstractClientConnector
Returns the shared state for this connector.- Overrides:
getState
in classAbstractClientConnector
- 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()
-
isUserSelectionAllowed
public boolean isUserSelectionAllowed()
Description copied from interface:Grid.SelectionModel.HasUserSelectionAllowed
Checks if the user is allowed to change the selection.- Specified by:
isUserSelectionAllowed
in interfaceGrid.SelectionModel.HasUserSelectionAllowed
- Returns:
true
if the user is allowed to change the selection,false
otherwise
-
setUserSelectionAllowed
public void setUserSelectionAllowed(boolean userSelectionAllowed)
Description copied from interface:Grid.SelectionModel.HasUserSelectionAllowed
Sets whether the user is allowed to change the selection.- Specified by:
setUserSelectionAllowed
in interfaceGrid.SelectionModel.HasUserSelectionAllowed
- Parameters:
userSelectionAllowed
-true
if the user is allowed to change the selection,false
otherwise
-
-