public static class Grid.MultiSelectionModel extends Grid.AbstractSelectionModel implements Grid.SelectionModel.Multi, Grid.SelectionModel.HasUserSelectionAllowed
Grid.SelectionModel.MultiGrid.SelectionModel.HasUserSelectionAllowed, Grid.SelectionModel.Multi, Grid.SelectionModel.None, Grid.SelectionModel.SingleClientConnector.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, setGridaddComponentToGrid, getColumn, getParentGrid, refreshRow, remove, removeComponentFromGridgetParent, getSupportedParentType, setParentaddAttachListener, 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, setResourceclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitisSelected, setGridaddAttachListener, addDetachListener, attach, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getParent, getRpcManager, getStateType, getUI, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandlergetConnectorIdpublic static final int DEFAULT_MAX_SELECTIONS
setSelectionLimit(int),
Constant Field Valuesprotected void extend(AbstractClientConnector target)
AbstractExtensionextend in class Grid.AbstractGridExtensiontarget - the connector to attach this extension topublic boolean select(Object... itemIds) throws IllegalArgumentException
Grid.SelectionModel.MultiThis method does not clear any previous selection state, only adds to it.
select in interface Grid.SelectionModel.MultiitemIds - 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.MultiitemIds - 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.Multideselect in interface Grid.SelectionModel.MultiitemIds - 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
nullGrid.SelectionModel.Multi.select(Object...)public boolean deselect(Collection<?> itemIds) throws IllegalArgumentException
Grid.SelectionModel.Multideselect in interface Grid.SelectionModel.MultiitemIds - 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 nullGrid.SelectionModel.Multi.select(Collection)protected boolean deselect(Collection<?> itemIds, boolean refresh)
public boolean selectAll()
Grid.SelectionModel.MultiselectAll in interface Grid.SelectionModel.Multitrue iff some items were previously not
selectedGrid.SelectionModel.Multi.deselectAll()protected boolean selectAll(boolean refresh)
public boolean deselectAll()
Grid.SelectionModel.MultideselectAll in interface Grid.SelectionModel.Multitrue 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.SelectionModelgetSelectedRows in class Grid.AbstractSelectionModelpublic void reset()
Equivalent to calling deselectAll()
reset in interface Grid.SelectionModelpublic boolean setSelected(Collection<?> itemIds) throws IllegalArgumentException
Grid.SelectionModel.MultisetSelected in interface Grid.SelectionModel.MultiitemIds - 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.MultisetSelected in interface Grid.SelectionModel.MultiitemIds - 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 AbstractClientConnectorprotected MultiSelectionModelState getState(boolean markAsDirty)
AbstractClientConnectorgetState in class AbstractClientConnectormarkAsDirty - true if the connector should automatically be marked dirty,
false otherwiseAbstractClientConnector.getState()public boolean isUserSelectionAllowed()
Grid.SelectionModel.HasUserSelectionAllowedisUserSelectionAllowed in interface Grid.SelectionModel.HasUserSelectionAllowedtrue if the user is allowed to change the
selection, false otherwisepublic void setUserSelectionAllowed(boolean userSelectionAllowed)
Grid.SelectionModel.HasUserSelectionAllowedsetUserSelectionAllowed in interface Grid.SelectionModel.HasUserSelectionAlloweduserSelectionAllowed - true if the user is allowed to change the
selection, false otherwiseCopyright © 2019 Vaadin Ltd. All rights reserved.