Package com.vaadin.featurepack.ui
Class FGrid.MultiSelectionModel
java.lang.Object
com.vaadin.featurepack.ui.FGrid.AbstractSelectionModel
com.vaadin.featurepack.ui.FGrid.MultiSelectionModel
- All Implemented Interfaces:
FGrid.SelectionModel,FGrid.SelectionModel.HasUserSelectionAllowed,FGrid.SelectionModel.Multi,Serializable
- Enclosing class:
FGrid
public static class FGrid.MultiSelectionModel
extends FGrid.AbstractSelectionModel
implements FGrid.SelectionModel.Multi, FGrid.SelectionModel.HasUserSelectionAllowed
A default implementation of a
FGrid.SelectionModel.Multi- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.vaadin.featurepack.ui.FGrid.SelectionModel
FGrid.SelectionModel.HasUserSelectionAllowed, FGrid.SelectionModel.Multi, FGrid.SelectionModel.None, FGrid.SelectionModel.Single -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe default selection size limit.Fields inherited from class com.vaadin.featurepack.ui.FGrid.AbstractSelectionModel
parentGrid, selection -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanMarks items as deselected.booleandeselect(Collection<?> itemIds) Marks items as deselected.protected booleandeselect(Collection<?> itemIds, boolean refresh) booleanMarks all the items in the current Container as deselectedprotected booleandeselectAll(boolean refresh) Returns a collection of all the currently selected itemIds.intGets the selection limit.booleanChecks if the user is allowed to change the selection.voidreset()Resets the selection model.booleanMarks items as selected.booleanselect(Collection<?> itemIds) Marks items as selected.protected booleanselect(Collection<?> itemIds, boolean refresh) booleanMarks all the items in the current Container as selectedprotected booleanselectAll(boolean refresh) booleansetSelected(Object... itemIds) Marks items as selected while deselecting all items not in the varargs array.booleansetSelected(Collection<?> itemIds) Marks items as selected while deselecting all items not in the given Collection.voidsetSelectionLimit(int selectionLimit) Sets the maximum number of rows that can be selected at once.voidsetUserSelectionAllowed(boolean userSelectionAllowed) Sets whether the user is allowed to change the selection.Methods inherited from class com.vaadin.featurepack.ui.FGrid.AbstractSelectionModel
checkItemIdExists, checkItemIdsExist, fireSelectionEvent, getParentGrid, isSelected, setGridMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.featurepack.ui.FGrid.SelectionModel
isSelected, setGrid
-
Field Details
-
DEFAULT_MAX_SELECTIONS
public static final int DEFAULT_MAX_SELECTIONSThe default selection size limit.- See Also:
-
-
Constructor Details
-
MultiSelectionModel
public MultiSelectionModel()
-
-
Method Details
-
select
Description copied from interface:FGrid.SelectionModel.MultiMarks items as selected.This method does not clear any previous selection state, only adds to it.
- Specified by:
selectin interfaceFGrid.SelectionModel.Multi- Parameters:
itemIds- the itemId(s) to mark as selected- Returns:
trueif the selection state changed.falseif all the given itemIds already were selected- Throws:
IllegalArgumentException- if theitemIdsvarargs array isnullor given itemIds don't exist in the container of Grid- See Also:
-
select
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:
selectin interfaceFGrid.SelectionModel.Multi- Parameters:
itemIds- the itemIds to mark as selected- Returns:
trueif the selection state changed.falseif all the given itemIds already were selected- Throws:
IllegalArgumentException- ifitemIdsisnullor given itemIds don't exist in the container of Grid- See Also:
-
select
-
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:
IllegalArgumentException- if the limit is negative
-
getSelectionLimit
public int getSelectionLimit()Gets the selection limit.- Returns:
- the selection limit
- See Also:
-
deselect
Description copied from interface:FGrid.SelectionModel.MultiMarks items as deselected.- Specified by:
deselectin interfaceFGrid.SelectionModel.Multi- Parameters:
itemIds- the itemId(s) to remove from being selected- Returns:
trueif the selection state changed.falseif none the given itemIds were selected previously- Throws:
IllegalArgumentException- if theitemIdsvarargs array isnull- See Also:
-
deselect
Description copied from interface:FGrid.SelectionModel.MultiMarks items as deselected.- Specified by:
deselectin interfaceFGrid.SelectionModel.Multi- Parameters:
itemIds- the itemId(s) to remove from being selected- Returns:
trueif the selection state changed.falseif none the given itemIds were selected previously- Throws:
IllegalArgumentException- ifitemIdsisnull- See Also:
-
deselect
-
selectAll
public boolean selectAll()Description copied from interface:FGrid.SelectionModel.MultiMarks all the items in the current Container as selected- Specified by:
selectAllin interfaceFGrid.SelectionModel.Multi- Returns:
trueiff some items were previously not selected- See Also:
-
selectAll
protected boolean selectAll(boolean refresh) -
deselectAll
public boolean deselectAll()Description copied from interface:FGrid.SelectionModel.MultiMarks all the items in the current Container as deselected- Specified by:
deselectAllin interfaceFGrid.SelectionModel.Multi- Returns:
trueiff some items were previously selected- See Also:
-
deselectAll
protected boolean deselectAll(boolean refresh) -
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:
getSelectedRowsin interfaceFGrid.SelectionModel- Overrides:
getSelectedRowsin classFGrid.AbstractSelectionModel- Returns:
- a collection of all the currently selected itemIds
-
reset
public void reset()Resets the selection model.Equivalent to calling
deselectAll()- Specified by:
resetin interfaceFGrid.SelectionModel
-
setSelected
Description copied from interface:FGrid.SelectionModel.MultiMarks items as selected while deselecting all items not in the given Collection.- Specified by:
setSelectedin interfaceFGrid.SelectionModel.Multi- Parameters:
itemIds- the itemIds to mark as selected- Returns:
trueif the selection state changed.falseif all the given itemIds already were selected- Throws:
IllegalArgumentException- ifitemIdsisnullor given itemIds don't exist in the container of Grid
-
setSelected
Description copied from interface:FGrid.SelectionModel.MultiMarks items as selected while deselecting all items not in the varargs array.- Specified by:
setSelectedin interfaceFGrid.SelectionModel.Multi- Parameters:
itemIds- the itemIds to mark as selected- Returns:
trueif the selection state changed.falseif all the given itemIds already were selected- Throws:
IllegalArgumentException- if theitemIdsvarargs array isnullor given itemIds don't exist in the container of Grid
-
isUserSelectionAllowed
public boolean isUserSelectionAllowed()Description copied from interface:FGrid.SelectionModel.HasUserSelectionAllowedChecks if the user is allowed to change the selection.- Specified by:
isUserSelectionAllowedin interfaceFGrid.SelectionModel.HasUserSelectionAllowed- Returns:
trueif the user is allowed to change the selection,falseotherwise
-
setUserSelectionAllowed
public void setUserSelectionAllowed(boolean userSelectionAllowed) Description copied from interface:FGrid.SelectionModel.HasUserSelectionAllowedSets whether the user is allowed to change the selection.- Specified by:
setUserSelectionAllowedin interfaceFGrid.SelectionModel.HasUserSelectionAllowed- Parameters:
userSelectionAllowed-trueif the user is allowed to change the selection,falseotherwise
-