com.vaadin.ui
Class Grid.MultiSelectionModel

java.lang.Object
  extended by com.vaadin.ui.Grid.AbstractSelectionModel
      extended by com.vaadin.ui.Grid.MultiSelectionModel
All Implemented Interfaces:
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
 
Field Summary
static int DEFAULT_MAX_SELECTIONS
          The default selection size limit.
 
Fields inherited from class com.vaadin.ui.Grid.AbstractSelectionModel
grid, selection
 
Constructor Summary
Grid.MultiSelectionModel()
           
 
Method Summary
 boolean deselect(java.util.Collection<?> itemIds)
          Marks items as deselected.
 boolean deselect(java.lang.Object... itemIds)
          Marks items as deselected.
 boolean deselectAll()
          Marks all the items in the current Container as deselected
 java.util.Collection<java.lang.Object> getSelectedRows()
          Returns a collection of all the currently selected itemIds.
 int getSelectionLimit()
          Gets the selection limit.
 void reset()
          Resets the selection model.
 boolean select(java.util.Collection<?> itemIds)
          Marks items as selected.
 boolean select(java.lang.Object... itemIds)
          Marks items as selected.
 boolean selectAll()
          Marks all the items in the current Container as selected
 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, fireSelectionEvent, isSelected, setGrid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.vaadin.ui.Grid.SelectionModel
isSelected, setGrid
 

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

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)

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)

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()

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()

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


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