Package com.vaadin.v7.client.connectors
Class MultiSelectionModelConnector.MultiSelectionModel
- java.lang.Object
-
- com.vaadin.v7.client.connectors.AbstractSelectionModelConnector.AbstractSelectionModel
-
- com.vaadin.v7.client.connectors.MultiSelectionModelConnector.MultiSelectionModel
-
- All Implemented Interfaces:
HasUserSelectionAllowed<elemental.json.JsonObject>,SelectionModel<elemental.json.JsonObject>,SelectionModel.Multi<elemental.json.JsonObject>,SelectionModel.Multi.Batched<elemental.json.JsonObject>
- Enclosing class:
- MultiSelectionModelConnector
protected class MultiSelectionModelConnector.MultiSelectionModel extends AbstractSelectionModelConnector.AbstractSelectionModel implements SelectionModel.Multi.Batched<elemental.json.JsonObject>, HasUserSelectionAllowed<elemental.json.JsonObject>
The default multi selection model used for this connector.
-
-
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 Modifier Constructor Description protectedMultiSelectionModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcommitBatchSelect()Commits and ends a batch selection.protected ComplexRenderer<Boolean>createSelectionColumnRenderer(Grid<elemental.json.JsonObject> grid)Creates a selection column renderer.booleandeselect(elemental.json.JsonObject... rows)Deselects one or more rows.booleandeselect(Collection<elemental.json.JsonObject> rows)Deselect all rows in aCollection.booleandeselectAll()De-selects all rows.Collection<elemental.json.JsonObject>getDeselectedRowsBatch()Gets all the rows that would become deselected in this batch.Collection<elemental.json.JsonObject>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.booleanisUserSelectionAllowed()Checks if the user is allowed to change the selection.protected booleanmarkAsSelected(DataSource.RowHandle<elemental.json.JsonObject> row, boolean selected)Marks the given row to be selected or deselected.booleanselect(elemental.json.JsonObject... rows)Selects one or more rows.booleanselect(Collection<elemental.json.JsonObject> rows)Select all rows in aCollection.voidselectAll()Selects all available rows, sends request to server to select everything.voidsetGrid(Grid<elemental.json.JsonObject> 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.-
Methods inherited from class com.vaadin.v7.client.connectors.AbstractSelectionModelConnector.AbstractSelectionModel
getSelectedRows, isSelected, reset
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vaadin.v7.client.widget.grid.selection.SelectionModel
getSelectedRows, isSelected, reset
-
-
-
-
Method Detail
-
setGrid
public void setGrid(Grid<elemental.json.JsonObject> 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<elemental.json.JsonObject>- Overrides:
setGridin classAbstractSelectionModelConnector.AbstractSelectionModel- Parameters:
grid- aGridinstance;nullwhen removing from Grid
-
createSelectionColumnRenderer
protected ComplexRenderer<Boolean> createSelectionColumnRenderer(Grid<elemental.json.JsonObject> grid)
Creates a selection column renderer. This method can be overridden to use a custom renderer or usenullto disable the selection column.- Parameters:
grid- the grid for this selection model- Returns:
- selection column renderer or
nullif not needed
-
selectAll
public void selectAll()
Selects all available rows, sends request to server to select everything.
-
getSelectionColumnRenderer
public Renderer<Boolean> getSelectionColumnRenderer()
Description copied from interface:SelectionModelReturn theRendererresponsible for rendering the selection column.- Specified by:
getSelectionColumnRendererin interfaceSelectionModel<elemental.json.JsonObject>- Returns:
- a renderer instance. If null is returned, a selection column will not be drawn.
-
select
public boolean select(elemental.json.JsonObject... rows)
Selects one or more rows.- Specified by:
selectin interfaceSelectionModel.Multi<elemental.json.JsonObject>- Parameters:
rows-Gridrow objects- Returns:
falseif rows is empty, elsetrue
-
deselect
public boolean deselect(elemental.json.JsonObject... rows)
Deselects one or more rows.- Specified by:
deselectin interfaceSelectionModel.Multi<elemental.json.JsonObject>- Parameters:
rows- Grid row objects- Returns:
falseif rows is empty, elsetrue
-
deselectAll
public boolean deselectAll()
De-selects all rows.- Specified by:
deselectAllin interfaceSelectionModel.Multi<elemental.json.JsonObject>- Returns:
- always
true
-
select
public boolean select(Collection<elemental.json.JsonObject> rows)
Select all rows in aCollection.- Specified by:
selectin interfaceSelectionModel.Multi<elemental.json.JsonObject>- Parameters:
rows- a collection of Grid row objects- Returns:
falseif rows is empty, elsetrue
-
markAsSelected
protected boolean markAsSelected(DataSource.RowHandle<elemental.json.JsonObject> row, boolean selected)
Marks the given row to be selected or deselected. Returns true if the value actually changed.Note: If selection model is in batch select state, the row will be pinned on select.
- Parameters:
row- row handleselected-trueif row should be selected;falseif not- Returns:
trueif selected status changed;falseif not
-
deselect
public boolean deselect(Collection<elemental.json.JsonObject> rows)
Deselect all rows in aCollection.- Specified by:
deselectin interfaceSelectionModel.Multi<elemental.json.JsonObject>- Parameters:
rows- a collection of Grid row objects- Returns:
falseif rows is empty, elsetrue
-
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<elemental.json.JsonObject>
-
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<elemental.json.JsonObject>
-
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<elemental.json.JsonObject>- Returns:
trueif a batch has been started
-
getSelectedRowsBatch
public Collection<elemental.json.JsonObject> getSelectedRowsBatch()
Description copied from interface:SelectionModel.Multi.BatchedGets all the rows that would become selected in this batch.- Specified by:
getSelectedRowsBatchin interfaceSelectionModel.Multi.Batched<elemental.json.JsonObject>- Returns:
- a collection of the rows that would become selected
-
getDeselectedRowsBatch
public Collection<elemental.json.JsonObject> getDeselectedRowsBatch()
Description copied from interface:SelectionModel.Multi.BatchedGets all the rows that would become deselected in this batch.- Specified by:
getDeselectedRowsBatchin interfaceSelectionModel.Multi.Batched<elemental.json.JsonObject>- 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<elemental.json.JsonObject>- 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<elemental.json.JsonObject>- Parameters:
userSelectionAllowed-trueif the user is allowed to change the selection,falseotherwise
-
-