com.vaadin.client.connectors.
Class MultiSelectionModelConnector.MultiSelectionModel
- java.lang.Object
-
- com.vaadin.client.connectors.AbstractSelectionModelConnector.AbstractSelectionModel
-
- com.vaadin.client.connectors.MultiSelectionModelConnector.MultiSelectionModel
-
All Implemented Interfaces:
HasUserSelectionAllowed<JsonObject>
,SelectionModel<JsonObject>
,SelectionModel.Multi<JsonObject>
,SelectionModel.Multi.Batched<JsonObject>
Enclosing class:
protected class MultiSelectionModelConnector.MultiSelectionModel extends AbstractSelectionModelConnector.AbstractSelectionModel implements SelectionModel.Multi.Batched<JsonObject>, HasUserSelectionAllowed<JsonObject>
The default multi selection model used for this connector.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.vaadin.client.widget.grid.selection.SelectionModel
SelectionModel.Multi<T>, SelectionModel.None<T>, SelectionModel.Single<T>
-
Nested classes/interfaces inherited from interface com.vaadin.client.widget.grid.selection.SelectionModel.Multi
SelectionModel.Multi.Batched<T>
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
MultiSelectionModel()
-
Method Summary
All Methods Modifier and Type Method Description void
commitBatchSelect()
Commits and ends a batch selection.
protected ComplexRenderer<Boolean>
createSelectionColumnRenderer(Grid<JsonObject> grid)
Creates a selection column renderer.
boolean
deselect(JsonObject... rows)
Deselects one or more rows.
boolean
deselect(Collection<JsonObject> rows)
Deselect all rows in a
Collection
.boolean
deselectAll()
De-selects all rows.
Collection<JsonObject>
getDeselectedRowsBatch()
Gets all the rows that would become deselected in this batch.
Collection<JsonObject>
getSelectedRowsBatch()
Gets all the rows that would become selected in this batch.
Renderer<Boolean>
getSelectionColumnRenderer()
Return the
Renderer
responsible for rendering the selection column.boolean
isBeingBatchSelected()
Checks whether or not a batch has been started.
boolean
isUserSelectionAllowed()
Checks if the user is allowed to change the selection.
protected boolean
markAsSelected(DataSource.RowHandle<JsonObject> row, boolean selected)
Marks the given row to be selected or deselected.
boolean
select(JsonObject... rows)
Selects one or more rows.
boolean
select(Collection<JsonObject> rows)
Select all rows in a
Collection
.void
selectAll()
Selects all available rows, sends request to server to select everything.
void
setGrid(Grid<JsonObject> grid)
Tells this SelectionModel which Grid it belongs to.
void
setUserSelectionAllowed(boolean userSelectionAllowed)
Sets whether the user is allowed to change the selection.
void
startBatchSelect()
Starts a batch selection.
-
Methods inherited from class com.vaadin.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.client.widget.grid.selection.SelectionModel
getSelectedRows, isSelected, reset
-
-
-
-
Method Detail
-
setGrid
public void setGrid(Grid<JsonObject> grid)
Description copied from interface:
SelectionModel
Tells 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:
setGrid
in interfaceSelectionModel<JsonObject>
Overrides:
setGrid
in classAbstractSelectionModelConnector.AbstractSelectionModel
Parameters:
grid
- aGrid
instance;null
when removing from Grid
-
createSelectionColumnRenderer
protected ComplexRenderer<Boolean> createSelectionColumnRenderer(Grid<JsonObject> grid)
Creates a selection column renderer. This method can be overridden to use a custom renderer or use
null
to disable the selection column.Parameters:
grid
- the grid for this selection modelReturns:
selection column renderer or
null
if 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:
SelectionModel
Return the
Renderer
responsible for rendering the selection column.Specified by:
getSelectionColumnRenderer
in interfaceSelectionModel<JsonObject>
Returns:
a renderer instance. If null is returned, a selection column will not be drawn.
-
select
public boolean select(JsonObject... rows)
Selects one or more rows.
Specified by:
select
in interfaceSelectionModel.Multi<JsonObject>
Parameters:
rows
-Grid
row objectsReturns:
false
if rows is empty, elsetrue
-
deselect
public boolean deselect(JsonObject... rows)
Deselects one or more rows.
Specified by:
deselect
in interfaceSelectionModel.Multi<JsonObject>
Parameters:
rows
- Grid row objectsReturns:
false
if rows is empty, elsetrue
-
deselectAll
public boolean deselectAll()
De-selects all rows.
Specified by:
deselectAll
in interfaceSelectionModel.Multi<JsonObject>
Returns:
always
true
-
select
public boolean select(Collection<JsonObject> rows)
Select all rows in a
Collection
.Specified by:
select
in interfaceSelectionModel.Multi<JsonObject>
Parameters:
rows
- a collection of Grid row objectsReturns:
false
if rows is empty, elsetrue
-
markAsSelected
protected boolean markAsSelected(DataSource.RowHandle<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
-true
if row should be selected;false
if notReturns:
true
if selected status changed;false
if not
-
deselect
public boolean deselect(Collection<JsonObject> rows)
Deselect all rows in a
Collection
.Specified by:
deselect
in interfaceSelectionModel.Multi<JsonObject>
Parameters:
rows
- a collection of Grid row objectsReturns:
false
if rows is empty, elsetrue
-
startBatchSelect
public void startBatchSelect()
Description copied from interface:
SelectionModel.Multi.Batched
Starts 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:
SelectionChangeEvents
will 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:
startBatchSelect
in interfaceSelectionModel.Multi.Batched<JsonObject>
-
commitBatchSelect
public void commitBatchSelect()
Description copied from interface:
SelectionModel.Multi.Batched
Commits 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:
commitBatchSelect
in interfaceSelectionModel.Multi.Batched<JsonObject>
-
isBeingBatchSelected
public boolean isBeingBatchSelected()
Description copied from interface:
SelectionModel.Multi.Batched
Checks whether or not a batch has been started.
Specified by:
isBeingBatchSelected
in interfaceSelectionModel.Multi.Batched<JsonObject>
Returns:
true
iff a batch has been started
-
getSelectedRowsBatch
public Collection<JsonObject> getSelectedRowsBatch()
Description copied from interface:
SelectionModel.Multi.Batched
Gets all the rows that would become selected in this batch.
Specified by:
getSelectedRowsBatch
in interfaceSelectionModel.Multi.Batched<JsonObject>
Returns:
a collection of the rows that would become selected
-
getDeselectedRowsBatch
public Collection<JsonObject> getDeselectedRowsBatch()
Description copied from interface:
SelectionModel.Multi.Batched
Gets all the rows that would become deselected in this batch.
Specified by:
getDeselectedRowsBatch
in interfaceSelectionModel.Multi.Batched<JsonObject>
Returns:
a collection of the rows that would become deselected
-
isUserSelectionAllowed
public boolean isUserSelectionAllowed()
Description copied from interface:
HasUserSelectionAllowed
Checks if the user is allowed to change the selection.
Specified by:
isUserSelectionAllowed
in interfaceHasUserSelectionAllowed<JsonObject>
Returns:
true
if the user is allowed to change the selection,false
otherwise
-
setUserSelectionAllowed
public void setUserSelectionAllowed(boolean userSelectionAllowed)
Description copied from interface:
HasUserSelectionAllowed
Sets whether the user is allowed to change the selection.
Specified by:
setUserSelectionAllowed
in interfaceHasUserSelectionAllowed<JsonObject>
Parameters:
userSelectionAllowed
-true
if the user is allowed to change the selection,false
otherwise
-
-