public static class Grid.MultiSelectionModel extends Grid.AbstractSelectionModel implements Grid.SelectionModel.Multi, Grid.SelectionModel.HasUserSelectionAllowed
Grid.SelectionModel.Multi
Grid.SelectionModel.HasUserSelectionAllowed, Grid.SelectionModel.Multi, Grid.SelectionModel.None, Grid.SelectionModel.Single
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListener
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAX_SELECTIONS
The default selection size limit.
|
selection
Constructor and Description |
---|
MultiSelectionModel() |
Modifier and Type | Method and Description |
---|---|
boolean |
deselect(Collection<?> itemIds)
Marks items as deselected.
|
protected boolean |
deselect(Collection<?> itemIds,
boolean refresh) |
boolean |
deselect(Object... itemIds)
Marks items as deselected.
|
boolean |
deselectAll()
Marks all the items in the current Container as deselected
|
protected boolean |
deselectAll(boolean refresh) |
protected void |
extend(AbstractClientConnector target)
Add this extension to the target connector.
|
Collection<Object> |
getSelectedRows()
Returns a collection of all the currently selected itemIds.
|
int |
getSelectionLimit()
Gets the selection limit.
|
protected MultiSelectionModelState |
getState()
Returns the shared state for this connector.
|
protected MultiSelectionModelState |
getState(boolean markAsDirty)
Returns the shared state for this connector.
|
boolean |
isUserSelectionAllowed()
Checks if the user is allowed to change the selection.
|
void |
reset()
Resets the selection model.
|
boolean |
select(Collection<?> itemIds)
Marks items as selected.
|
protected boolean |
select(Collection<?> itemIds,
boolean refresh) |
boolean |
select(Object... itemIds)
Marks items as selected.
|
boolean |
selectAll()
Marks all the items in the current Container as selected
|
protected boolean |
selectAll(boolean refresh) |
boolean |
setSelected(Collection<?> itemIds)
Marks items as selected while deselecting all items not in the
given Collection.
|
boolean |
setSelected(Object... itemIds)
Marks items as selected while deselecting all items not in the
varargs array.
|
void |
setSelectionLimit(int selectionLimit)
Sets the maximum number of rows that can be selected at once.
|
void |
setUserSelectionAllowed(boolean userSelectionAllowed)
Sets whether the user is allowed to change the selection.
|
checkItemIdExists, checkItemIdsExist, destroyData, fireSelectionEvent, generateData, getItemId, 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
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
public static final int DEFAULT_MAX_SELECTIONS
setSelectionLimit(int)
,
Constant Field Valuesprotected void extend(AbstractClientConnector target)
AbstractExtension
extend
in class Grid.AbstractGridExtension
target
- the connector to attach this extension topublic boolean select(Object... itemIds) throws IllegalArgumentException
Grid.SelectionModel.Multi
This method does not clear any previous selection state, only adds to it.
select
in interface Grid.SelectionModel.Multi
itemIds
- the itemId(s) to mark as selectedtrue
if the selection state changed.
false
if all the given itemIds already were
selectedIllegalArgumentException
- if the itemIds
varargs array is
null
or given itemIds don't exist in the
container of GridGrid.SelectionModel.Multi.deselect(Object...)
public boolean select(Collection<?> itemIds) throws IllegalArgumentException
This method does not clear any previous selection state, only adds to it.
All items might not be selected if the limit set using
setSelectionLimit(int)
is exceeded.
select
in interface Grid.SelectionModel.Multi
itemIds
- the itemIds to mark as selectedtrue
if the selection state changed.
false
if all the given itemIds already were
selectedIllegalArgumentException
- if itemIds
is null
or given
itemIds don't exist in the container of GridGrid.SelectionModel.Multi.deselect(Collection)
protected boolean select(Collection<?> itemIds, boolean refresh)
public void setSelectionLimit(int selectionLimit)
Old selections are not discarded if the current number of selected row exceeds the new limit.
The default limit is 1000 rows.
selectionLimit
- the non-negative selection limit to setIllegalArgumentException
- if the limit is negativepublic int getSelectionLimit()
setSelectionLimit(int)
public boolean deselect(Object... itemIds) throws IllegalArgumentException
Grid.SelectionModel.Multi
deselect
in interface Grid.SelectionModel.Multi
itemIds
- the itemId(s) to remove from being selectedtrue
if the selection state changed.
false
if none the given itemIds were
selected previouslyIllegalArgumentException
- if the itemIds
varargs array is
null
Grid.SelectionModel.Multi.select(Object...)
public boolean deselect(Collection<?> itemIds) throws IllegalArgumentException
Grid.SelectionModel.Multi
deselect
in interface Grid.SelectionModel.Multi
itemIds
- the itemId(s) to remove from being selectedtrue
if the selection state changed.
false
if none the given itemIds were
selected previouslyIllegalArgumentException
- if itemIds
is null
Grid.SelectionModel.Multi.select(Collection)
protected boolean deselect(Collection<?> itemIds, boolean refresh)
public boolean selectAll()
Grid.SelectionModel.Multi
selectAll
in interface Grid.SelectionModel.Multi
true
iff some items were previously not
selectedGrid.SelectionModel.Multi.deselectAll()
protected boolean selectAll(boolean refresh)
public boolean deselectAll()
Grid.SelectionModel.Multi
deselectAll
in interface Grid.SelectionModel.Multi
true
iff some items were previously selectedGrid.SelectionModel.Multi.selectAll()
protected boolean deselectAll(boolean refresh)
public Collection<Object> getSelectedRows()
The returned Collection is in order of selection – the item that was first selected will be first in the collection, and so on. Should an item have been selected twice without being deselected in between, it will have remained in its original position.
getSelectedRows
in interface Grid.SelectionModel
getSelectedRows
in class Grid.AbstractSelectionModel
public void reset()
Equivalent to calling deselectAll()
reset
in interface Grid.SelectionModel
public boolean setSelected(Collection<?> itemIds) throws IllegalArgumentException
Grid.SelectionModel.Multi
setSelected
in interface Grid.SelectionModel.Multi
itemIds
- the itemIds to mark as selectedtrue
if the selection state changed.
false
if all the given itemIds already were
selectedIllegalArgumentException
- if itemIds
is null
or given
itemIds don't exist in the container of Gridpublic boolean setSelected(Object... itemIds) throws IllegalArgumentException
Grid.SelectionModel.Multi
setSelected
in interface Grid.SelectionModel.Multi
itemIds
- the itemIds to mark as selectedtrue
if the selection state changed.
false
if all the given itemIds already were
selectedIllegalArgumentException
- if the itemIds
varargs array is
null
or given itemIds don't exist in the
container of Gridprotected MultiSelectionModelState 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 MultiSelectionModelState 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.