com.vaadin.client.connectors
Class MultiSelectionModelConnector.MultiSelectionModel

java.lang.Object
  extended by com.vaadin.client.connectors.AbstractSelectionModelConnector.AbstractSelectionModel
      extended by com.vaadin.client.connectors.MultiSelectionModelConnector.MultiSelectionModel
All Implemented Interfaces:
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>


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.vaadin.client.widget.grid.selection.SelectionModel.Multi
SelectionModel.Multi.Batched<T>
 
Nested classes/interfaces inherited from interface com.vaadin.client.widget.grid.selection.SelectionModel
SelectionModel.Multi<T>, SelectionModel.None<T>, SelectionModel.Single<T>
 
Constructor Summary
protected MultiSelectionModelConnector.MultiSelectionModel()
           
 
Method Summary
 void commitBatchSelect()
          Commits and ends a batch selection.
protected  ComplexRenderer<java.lang.Boolean> createSelectionColumnRenderer(Grid<elemental.json.JsonObject> grid)
          Creates a selection column renderer.
 boolean deselect(java.util.Collection<elemental.json.JsonObject> rows)
          Deselect all rows in a Collection.
 boolean deselect(elemental.json.JsonObject... rows)
          Deselects one or more rows.
 boolean deselectAll()
          De-selects all rows.
 java.util.Collection<elemental.json.JsonObject> getDeselectedRowsBatch()
          Gets all the rows that would become deselected in this batch.
 java.util.Collection<elemental.json.JsonObject> getSelectedRowsBatch()
          Gets all the rows that would become selected in this batch.
 Renderer<java.lang.Boolean> getSelectionColumnRenderer()
          Return the Renderer responsible for rendering the selection column.
 boolean isBeingBatchSelected()
          Checks whether or not a batch has been started.
protected  boolean markAsSelected(DataSource.RowHandle<elemental.json.JsonObject> row, boolean selected)
          Marks the given row to be selected or deselected.
 boolean select(java.util.Collection<elemental.json.JsonObject> rows)
          Select all rows in a Collection.
 boolean select(elemental.json.JsonObject... rows)
          Selects one or more rows.
 void selectAll()
          Selects all available rows, sends request to server to select everything.
 void setGrid(Grid<elemental.json.JsonObject> grid)
          Tells this SelectionModel which Grid it belongs to.
 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
 

Constructor Detail

MultiSelectionModelConnector.MultiSelectionModel

protected MultiSelectionModelConnector.MultiSelectionModel()
Method Detail

setGrid

public void setGrid(Grid<elemental.json.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 interface SelectionModel<elemental.json.JsonObject>
Overrides:
setGrid in class AbstractSelectionModelConnector.AbstractSelectionModel
Parameters:
grid - a Grid instance; null when removing from Grid

createSelectionColumnRenderer

protected ComplexRenderer<java.lang.Boolean> createSelectionColumnRenderer(Grid<elemental.json.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 model
Returns:
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<java.lang.Boolean> getSelectionColumnRenderer()
Description copied from interface: SelectionModel
Return the Renderer responsible for rendering the selection column.

Specified by:
getSelectionColumnRenderer in interface SelectionModel<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:
select in interface SelectionModel.Multi<elemental.json.JsonObject>
Parameters:
rows - Grid row objects
Returns:
false if rows is empty, else true

deselect

public boolean deselect(elemental.json.JsonObject... rows)
Deselects one or more rows.

Specified by:
deselect in interface SelectionModel.Multi<elemental.json.JsonObject>
Parameters:
rows - Grid row objects
Returns:
false if rows is empty, else true

deselectAll

public boolean deselectAll()
De-selects all rows.

Specified by:
deselectAll in interface SelectionModel.Multi<elemental.json.JsonObject>
Returns:
always true

select

public boolean select(java.util.Collection<elemental.json.JsonObject> rows)
Select all rows in a Collection.

Specified by:
select in interface SelectionModel.Multi<elemental.json.JsonObject>
Parameters:
rows - a collection of Grid row objects
Returns:
false if rows is empty, else true

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 handle
selected - true if row should be selected; false if not
Returns:
true if selected status changed; false if not

deselect

public boolean deselect(java.util.Collection<elemental.json.JsonObject> rows)
Deselect all rows in a Collection.

Specified by:
deselect in interface SelectionModel.Multi<elemental.json.JsonObject>
Parameters:
rows - a collection of Grid row objects
Returns:
false if rows is empty, else true

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 with SelectionEvent.isBatchedSelection().

Specified by:
startBatchSelect in interface SelectionModel.Multi.Batched<elemental.json.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 collated SelectionEvent.

Specified by:
commitBatchSelect in interface SelectionModel.Multi.Batched<elemental.json.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 interface SelectionModel.Multi.Batched<elemental.json.JsonObject>
Returns:
true iff a batch has been started

getSelectedRowsBatch

public java.util.Collection<elemental.json.JsonObject> getSelectedRowsBatch()
Description copied from interface: SelectionModel.Multi.Batched
Gets all the rows that would become selected in this batch.

Specified by:
getSelectedRowsBatch in interface SelectionModel.Multi.Batched<elemental.json.JsonObject>
Returns:
a collection of the rows that would become selected

getDeselectedRowsBatch

public java.util.Collection<elemental.json.JsonObject> getDeselectedRowsBatch()
Description copied from interface: SelectionModel.Multi.Batched
Gets all the rows that would become deselected in this batch.

Specified by:
getDeselectedRowsBatch in interface SelectionModel.Multi.Batched<elemental.json.JsonObject>
Returns:
a collection of the rows that would become deselected


Copyright © 2000-2014 Vaadin Ltd. All Rights Reserved.