Package com.vaadin.featurepack.ui
Class FGrid.AbstractSelectionModel
java.lang.Object
com.vaadin.featurepack.ui.FGrid.AbstractSelectionModel
- All Implemented Interfaces:
FGrid.SelectionModel,Serializable
- Direct Known Subclasses:
FGrid.MultiSelectionModel,FGrid.NoSelectionModel,FGrid.SingleSelectionModel
- Enclosing class:
FGrid
public abstract static class FGrid.AbstractSelectionModel
extends Object
implements FGrid.SelectionModel
A base class for SelectionModels that contains some of the logic that is
reusable.
- 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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckItemIdExists(Object itemId) Sanity check for existence of item id.protected voidcheckItemIdsExist(Collection<?> itemIds) Sanity check for existence of item ids in given collection.protected voidfireSelectionEvent(Collection<Object> oldSelection, Collection<Object> newSelection) Fires aSelectionEventto all theSelectionListenerscurrently added to the Grid in which this SelectionModel is.protected FGridReturns a collection of all the currently selected itemIds.booleanisSelected(Object itemId) Checks whether an item is selected or not.voidInjects the currentGridinstance into the SelectionModel.Methods 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
reset
-
Field Details
-
selection
-
parentGrid
-
-
Constructor Details
-
AbstractSelectionModel
public AbstractSelectionModel()
-
-
Method Details
-
isSelected
Description copied from interface:FGrid.SelectionModelChecks whether an item is selected or not.- Specified by:
isSelectedin interfaceFGrid.SelectionModel- Parameters:
itemId- the item id to check for- Returns:
trueiff the item is selected
-
getSelectedRows
Description copied from interface:FGrid.SelectionModelReturns a collection of all the currently selected itemIds.- Specified by:
getSelectedRowsin interfaceFGrid.SelectionModel- Returns:
- a collection of all the currently selected itemIds
-
setGrid
Description copied from interface:FGrid.SelectionModelInjects the currentGridinstance into the SelectionModel.Note: This method should not be called manually.
- Specified by:
setGridin interfaceFGrid.SelectionModel- Parameters:
grid- the Grid in which the SelectionModel currently is, ornullwhen a selection model is being detached from a Grid.
-
getParentGrid
-
checkItemIdExists
Sanity check for existence of item id.- Parameters:
itemId- item id to be selected / deselected- Throws:
IllegalArgumentException- if item Id doesn't exist in the container of Grid
-
checkItemIdsExist
Sanity check for existence of item ids in given collection.- Parameters:
itemIds- item id collection to be selected / deselected- Throws:
IllegalArgumentException- if at least one item id doesn't exist in the container of Grid
-
fireSelectionEvent
Fires aSelectionEventto all theSelectionListenerscurrently added to the Grid in which this SelectionModel is.Note that this is only a helper method, and routes the call all the way to Grid. A
FGrid.SelectionModelis not aSelectionEvent.SelectionNotifier- Parameters:
oldSelection- the completeCollectionof the itemIds that were selected before this event happenednewSelection- the completeCollectionof the itemIds that are selected after this event happened
-