Class SelectionModelMulti<T>
- java.lang.Object
-
- com.vaadin.v7.client.widget.grid.selection.AbstractRowHandleSelectionModel<T>
-
- com.vaadin.v7.client.widget.grid.selection.SelectionModelMulti<T>
-
- All Implemented Interfaces:
HasUserSelectionAllowed<T>,SelectionModel<T>,SelectionModel.Multi<T>,SelectionModel.Multi.Batched<T>
public class SelectionModelMulti<T> extends AbstractRowHandleSelectionModel<T> implements SelectionModel.Multi.Batched<T>, HasUserSelectionAllowed<T>
Multi-row selection model.- Since:
- 7.4
- Author:
- Vaadin Ltd
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.vaadin.v7.client.widget.grid.selection.SelectionModel
SelectionModel.Multi<T>, SelectionModel.None<T>, SelectionModel.Single<T>
-
Nested classes/interfaces inherited from interface com.vaadin.v7.client.widget.grid.selection.SelectionModel.Multi
SelectionModel.Multi.Batched<T>
-
-
Constructor Summary
Constructors Constructor Description SelectionModelMulti()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcommitBatchSelect()Commits and ends a batch selection.booleandeselect(Collection<T> rows)Deselect all rows in aCollection.booleandeselect(T... rows)Deselects one or more rows.booleandeselectAll()De-selects all rows.protected booleandeselectByHandle(DataSource.RowHandle<T> handle)Deselect a row, based on itsRowHandle.Collection<T>getDeselectedRowsBatch()Gets all the rows that would become deselected in this batch.Collection<T>getSelectedRows()Returns a Collection containing all selected rows.Collection<T>getSelectedRowsBatch()Gets all the rows that would become selected in this batch.Renderer<Boolean>getSelectionColumnRenderer()Return theRendererresponsible for rendering the selection column.booleanisBeingBatchSelected()Checks whether or not a batch has been started.booleanisSelected(T row)Return true if the provided row is considered selected under the implementing selection model.protected booleanisSelectedByHandle(DataSource.RowHandle<T> handle)booleanisUserSelectionAllowed()Checks if the user is allowed to change the selection.voidreset()Resets the SelectionModel to the initial state.booleanselect(Collection<T> rows)Select all rows in aCollection.booleanselect(T... rows)Selects one or more rows.protected booleanselectByHandle(DataSource.RowHandle<T> handle)Select a row, based on itsRowHandle.voidsetGrid(Grid<T> grid)Tells this SelectionModel which Grid it belongs to.voidsetUserSelectionAllowed(boolean userSelectionAllowed)Sets whether the user is allowed to change the selection.voidstartBatchSelect()Starts a batch selection.
-
-
-
Method Detail
-
isSelected
public boolean isSelected(T row)
Description copied from interface:SelectionModelReturn true if the provided row is considered selected under the implementing selection model.- Specified by:
isSelectedin interfaceSelectionModel<T>- Parameters:
row- row object instance- Returns:
true, if the row given as argument is considered selected.
-
getSelectionColumnRenderer
public Renderer<Boolean> getSelectionColumnRenderer()
Description copied from interface:SelectionModelReturn theRendererresponsible for rendering the selection column.- Specified by:
getSelectionColumnRendererin interfaceSelectionModel<T>- Returns:
- a renderer instance. If null is returned, a selection column will not be drawn.
-
setGrid
public void setGrid(Grid<T> grid)
Description copied from interface:SelectionModelTells this SelectionModel which Grid it belongs to.Implementations are free to have this be a no-op. This method is called internally by Grid.
- Specified by:
setGridin interfaceSelectionModel<T>- Parameters:
grid- aGridinstance;nullwhen removing from Grid
-
select
public boolean select(T... rows)
Description copied from interface:SelectionModel.MultiSelects one or more rows.- Specified by:
selectin interfaceSelectionModel.Multi<T>- Parameters:
rows-Gridrow objects- Returns:
- true, if the set of selected rows was changed.
-
deselect
public boolean deselect(T... rows)
Description copied from interface:SelectionModel.MultiDeselects one or more rows.- Specified by:
deselectin interfaceSelectionModel.Multi<T>- Parameters:
rows- Grid row objects- Returns:
- true, if the set of selected rows was changed.
-
deselectAll
public boolean deselectAll()
Description copied from interface:SelectionModel.MultiDe-selects all rows.- Specified by:
deselectAllin interfaceSelectionModel.Multi<T>- Returns:
- true, if any row was previously selected.
-
select
public boolean select(Collection<T> rows)
Description copied from interface:SelectionModel.MultiSelect all rows in aCollection.- Specified by:
selectin interfaceSelectionModel.Multi<T>- Parameters:
rows- a collection of Grid row objects- Returns:
- true, if the set of selected rows was changed.
-
deselect
public boolean deselect(Collection<T> rows)
Description copied from interface:SelectionModel.MultiDeselect all rows in aCollection.- Specified by:
deselectin interfaceSelectionModel.Multi<T>- Parameters:
rows- a collection of Grid row objects- Returns:
- true, if the set of selected rows was changed.
-
isSelectedByHandle
protected boolean isSelectedByHandle(DataSource.RowHandle<T> handle)
-
selectByHandle
protected boolean selectByHandle(DataSource.RowHandle<T> handle)
Description copied from class:AbstractRowHandleSelectionModelSelect a row, based on itsRowHandle.Note: this method may not fire selection change events.
- Specified by:
selectByHandlein classAbstractRowHandleSelectionModel<T>- Parameters:
handle- the handle to select by- Returns:
trueif the selection state was changed by this call
-
deselectByHandle
protected boolean deselectByHandle(DataSource.RowHandle<T> handle)
Description copied from class:AbstractRowHandleSelectionModelDeselect a row, based on itsRowHandle.Note: this method may not fire selection change events.
- Specified by:
deselectByHandlein classAbstractRowHandleSelectionModel<T>- Parameters:
handle- the handle to deselect by- Returns:
trueif the selection state was changed by this call
-
getSelectedRows
public Collection<T> getSelectedRows()
Description copied from interface:SelectionModelReturns a Collection containing all selected rows.- Specified by:
getSelectedRowsin interfaceSelectionModel<T>- Returns:
- a non-null collection.
-
reset
public void reset()
Description copied from interface:SelectionModelResets the SelectionModel to the initial state.This method can be called internally, for example, when the attached Grid's data source changes.
- Specified by:
resetin interfaceSelectionModel<T>
-
startBatchSelect
public void startBatchSelect()
Description copied from interface:SelectionModel.Multi.BatchedStarts a batch selection.Any commands to any select or deselect method will be batched into one, and a final selection event will be fired when
SelectionModel.Multi.Batched.commitBatchSelect()is called.Note:
SelectionChangeEventswill still be fired for each selection/deselection. You should check whether the event is a part of a batch or not withSelectionEvent.isBatchedSelection().- Specified by:
startBatchSelectin interfaceSelectionModel.Multi.Batched<T>
-
commitBatchSelect
public void commitBatchSelect()
Description copied from interface:SelectionModel.Multi.BatchedCommits and ends a batch selection.Any and all selections and deselections since the last invocation of
SelectionModel.Multi.Batched.startBatchSelect()will be fired at once as one collatedSelectionEvent.- Specified by:
commitBatchSelectin interfaceSelectionModel.Multi.Batched<T>
-
isBeingBatchSelected
public boolean isBeingBatchSelected()
Description copied from interface:SelectionModel.Multi.BatchedChecks whether or not a batch has been started.- Specified by:
isBeingBatchSelectedin interfaceSelectionModel.Multi.Batched<T>- Returns:
trueif a batch has been started
-
getSelectedRowsBatch
public Collection<T> getSelectedRowsBatch()
Description copied from interface:SelectionModel.Multi.BatchedGets all the rows that would become selected in this batch.- Specified by:
getSelectedRowsBatchin interfaceSelectionModel.Multi.Batched<T>- Returns:
- a collection of the rows that would become selected
-
getDeselectedRowsBatch
public Collection<T> getDeselectedRowsBatch()
Description copied from interface:SelectionModel.Multi.BatchedGets all the rows that would become deselected in this batch.- Specified by:
getDeselectedRowsBatchin interfaceSelectionModel.Multi.Batched<T>- Returns:
- a collection of the rows that would become deselected
-
isUserSelectionAllowed
public boolean isUserSelectionAllowed()
Description copied from interface:HasUserSelectionAllowedChecks if the user is allowed to change the selection.- Specified by:
isUserSelectionAllowedin interfaceHasUserSelectionAllowed<T>- Returns:
trueif the user is allowed to change the selection,falseotherwise
-
setUserSelectionAllowed
public void setUserSelectionAllowed(boolean userSelectionAllowed)
Description copied from interface:HasUserSelectionAllowedSets whether the user is allowed to change the selection.- Specified by:
setUserSelectionAllowedin interfaceHasUserSelectionAllowed<T>- Parameters:
userSelectionAllowed-trueif the user is allowed to change the selection,falseotherwise
-
-