com.vaadin.ui
Class Grid.MultiSelectionModel

java.lang.Object
  extended by com.vaadin.server.AbstractClientConnector
      extended by com.vaadin.server.AbstractExtension
          extended by com.vaadin.ui.Grid.AbstractGridExtension
              extended by com.vaadin.ui.Grid.AbstractSelectionModel
                  extended by com.vaadin.ui.Grid.MultiSelectionModel
All Implemented Interfaces:
MethodEventSource, ClientConnector, DataGenerator, Extension, com.vaadin.shared.Connector, Grid.SelectionModel, Grid.SelectionModel.Multi, java.io.Serializable
Enclosing class:
Grid

public static class Grid.MultiSelectionModel
extends Grid.AbstractSelectionModel
implements Grid.SelectionModel.Multi

A default implementation of a Grid.SelectionModel.Multi

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.vaadin.ui.Grid.SelectionModel
Grid.SelectionModel.Multi, Grid.SelectionModel.None, Grid.SelectionModel.Single
 
Nested classes/interfaces inherited from interface com.vaadin.server.ClientConnector
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListener
 
Field Summary
static int DEFAULT_MAX_SELECTIONS
          The default selection size limit.
 
Fields inherited from class com.vaadin.ui.Grid.AbstractSelectionModel
selection
 
Constructor Summary
Grid.MultiSelectionModel()
           
 
Method Summary
 boolean deselect(java.util.Collection<?> itemIds)
          Marks items as deselected.
protected  boolean deselect(java.util.Collection<?> itemIds, boolean refresh)
           
 boolean deselect(java.lang.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.
 java.util.Collection<java.lang.Object> getSelectedRows()
          Returns a collection of all the currently selected itemIds.
 int getSelectionLimit()
          Gets the selection limit.
protected  com.vaadin.shared.ui.grid.selection.MultiSelectionModelState getState()
          Returns the shared state for this connector.
 void reset()
          Resets the selection model.
 boolean select(java.util.Collection<?> itemIds)
          Marks items as selected.
protected  boolean select(java.util.Collection<?> itemIds, boolean refresh)
           
 boolean select(java.lang.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(java.util.Collection<?> itemIds)
          Marks items as selected while deselecting all items not in the given Collection.
 boolean setSelected(java.lang.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.
 
Methods inherited from class com.vaadin.ui.Grid.AbstractSelectionModel
checkItemIdExists, checkItemIdsExist, destroyData, fireSelectionEvent, generateData, getItemId, 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, 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
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.vaadin.ui.Grid.SelectionModel
isSelected, setGrid
 
Methods inherited from interface com.vaadin.server.Extension
remove, setParent
 
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
 

Field Detail

DEFAULT_MAX_SELECTIONS

public static final int DEFAULT_MAX_SELECTIONS
The default selection size limit.

See Also:
setSelectionLimit(int), Constant Field Values
Constructor Detail

Grid.MultiSelectionModel

public Grid.MultiSelectionModel()
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 class Grid.AbstractGridExtension
Parameters:
target - the connector to attach this extension to

select

public boolean select(java.lang.Object... itemIds)
               throws java.lang.IllegalArgumentException
Description copied from interface: Grid.SelectionModel.Multi
Marks items as selected.

This method does not clear any previous selection state, only adds to it.

Specified by:
select in interface Grid.SelectionModel.Multi
Parameters:
itemIds - the itemId(s) to mark as selected
Returns:
true if the selection state changed. false if all the given itemIds already were selected
Throws:
java.lang.IllegalArgumentException - if the itemIds varargs array is null or given itemIds don't exist in the container of Grid
See Also:
Grid.SelectionModel.Multi.deselect(Object...)

select

public boolean select(java.util.Collection<?> itemIds)
               throws java.lang.IllegalArgumentException
Marks items as selected.

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.

Specified by:
select in interface Grid.SelectionModel.Multi
Parameters:
itemIds - the itemIds to mark as selected
Returns:
true if the selection state changed. false if all the given itemIds already were selected
Throws:
java.lang.IllegalArgumentException - if itemIds is null or given itemIds don't exist in the container of Grid
See Also:
Grid.SelectionModel.Multi.deselect(Collection)

select

protected boolean select(java.util.Collection<?> itemIds,
                         boolean refresh)

setSelectionLimit

public void setSelectionLimit(int selectionLimit)
Sets the maximum number of rows that can be selected at once. This is a mechanism to prevent exhausting server memory in situations where users select lots of rows. If the limit is reached, newly selected rows will not become recorded.

Old selections are not discarded if the current number of selected row exceeds the new limit.

The default limit is 1000 rows.

Parameters:
selectionLimit - the non-negative selection limit to set
Throws:
java.lang.IllegalArgumentException - if the limit is negative

getSelectionLimit

public int getSelectionLimit()
Gets the selection limit.

Returns:
the selection limit
See Also:
setSelectionLimit(int)

deselect

public boolean deselect(java.lang.Object... itemIds)
                 throws java.lang.IllegalArgumentException
Description copied from interface: Grid.SelectionModel.Multi
Marks items as deselected.

Specified by:
deselect in interface Grid.SelectionModel.Multi
Parameters:
itemIds - the itemId(s) to remove from being selected
Returns:
true if the selection state changed. false if none the given itemIds were selected previously
Throws:
java.lang.IllegalArgumentException - if the itemIds varargs array is null
See Also:
Grid.SelectionModel.Multi.select(Object...)

deselect

public boolean deselect(java.util.Collection<?> itemIds)
                 throws java.lang.IllegalArgumentException
Description copied from interface: Grid.SelectionModel.Multi
Marks items as deselected.

Specified by:
deselect in interface Grid.SelectionModel.Multi
Parameters:
itemIds - the itemId(s) to remove from being selected
Returns:
true if the selection state changed. false if none the given itemIds were selected previously
Throws:
java.lang.IllegalArgumentException - if itemIds is null
See Also:
Grid.SelectionModel.Multi.select(Collection)

deselect

protected boolean deselect(java.util.Collection<?> itemIds,
                           boolean refresh)

selectAll

public boolean selectAll()
Description copied from interface: Grid.SelectionModel.Multi
Marks all the items in the current Container as selected

Specified by:
selectAll in interface Grid.SelectionModel.Multi
Returns:
true iff some items were previously not selected
See Also:
Grid.SelectionModel.Multi.deselectAll()

selectAll

protected boolean selectAll(boolean refresh)

deselectAll

public boolean deselectAll()
Description copied from interface: Grid.SelectionModel.Multi
Marks all the items in the current Container as deselected

Specified by:
deselectAll in interface Grid.SelectionModel.Multi
Returns:
true iff some items were previously selected
See Also:
Grid.SelectionModel.Multi.selectAll()

deselectAll

protected boolean deselectAll(boolean refresh)

getSelectedRows

public java.util.Collection<java.lang.Object> getSelectedRows()
Returns a collection of all the currently selected itemIds.

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.

Specified by:
getSelectedRows in interface Grid.SelectionModel
Overrides:
getSelectedRows in class Grid.AbstractSelectionModel
Returns:
a collection of all the currently selected itemIds

reset

public void reset()
Resets the selection model.

Equivalent to calling deselectAll()

Specified by:
reset in interface Grid.SelectionModel

setSelected

public boolean setSelected(java.util.Collection<?> itemIds)
                    throws java.lang.IllegalArgumentException
Description copied from interface: Grid.SelectionModel.Multi
Marks items as selected while deselecting all items not in the given Collection.

Specified by:
setSelected in interface Grid.SelectionModel.Multi
Parameters:
itemIds - the itemIds to mark as selected
Returns:
true if the selection state changed. false if all the given itemIds already were selected
Throws:
java.lang.IllegalArgumentException - if itemIds is null or given itemIds don't exist in the container of Grid

setSelected

public boolean setSelected(java.lang.Object... itemIds)
                    throws java.lang.IllegalArgumentException
Description copied from interface: Grid.SelectionModel.Multi
Marks items as selected while deselecting all items not in the varargs array.

Specified by:
setSelected in interface Grid.SelectionModel.Multi
Parameters:
itemIds - the itemIds to mark as selected
Returns:
true if the selection state changed. false if all the given itemIds already were selected
Throws:
java.lang.IllegalArgumentException - if the itemIds varargs array is null or given itemIds don't exist in the container of Grid

getState

protected com.vaadin.shared.ui.grid.selection.MultiSelectionModelState 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 class AbstractClientConnector
Returns:
The shared state for this connector. Never null.


Copyright © 2000-2014 Vaadin Ltd. All Rights Reserved.