com.vaadin.client.widget.grid.selection
Class SelectionModelMulti<T>

java.lang.Object
  extended by com.vaadin.client.widget.grid.selection.AbstractRowHandleSelectionModel<T>
      extended by com.vaadin.client.widget.grid.selection.SelectionModelMulti<T>
All Implemented Interfaces:
SelectionModel<T>, SelectionModel.Multi<T>, SelectionModel.Multi.Batched<T>

public class SelectionModelMulti<T>
extends AbstractRowHandleSelectionModel<T>
implements SelectionModel.Multi.Batched<T>

Multi-row selection model.

Since:
7.4
Author:
Vaadin Ltd

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
SelectionModelMulti()
           
 
Method Summary
 void commitBatchSelect()
          Commits and ends a batch selection.
 boolean deselect(java.util.Collection<T> rows)
          Deselect all rows in a Collection.
 boolean deselect(T... rows)
          Deselects one or more rows.
 boolean deselectAll()
          De-selects all rows.
protected  boolean deselectByHandle(DataSource.RowHandle<T> handle)
          Deselect a row, based on its RowHandle.
 java.util.Collection<T> getDeselectedRowsBatch()
          Gets all the rows that would become deselected in this batch.
 java.util.Collection<T> getSelectedRows()
          Returns a Collection containing all selected rows.
 java.util.Collection<T> 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.
 boolean isSelected(T row)
          Return true if the provided row is considered selected under the implementing selection model.
protected  boolean isSelectedByHandle(DataSource.RowHandle<T> handle)
           
 void reset()
          Resets the SelectionModel to the initial state.
 boolean select(java.util.Collection<T> rows)
          Select all rows in a Collection.
 boolean select(T... rows)
          Selects one or more rows.
protected  boolean selectByHandle(DataSource.RowHandle<T> handle)
          Select a row, based on its RowHandle.
 void setGrid(Grid<T> grid)
          Tells this SelectionModel which Grid it belongs to.
 void startBatchSelect()
          Starts a batch selection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SelectionModelMulti

public SelectionModelMulti()
Method Detail

isSelected

public boolean isSelected(T row)
Description copied from interface: SelectionModel
Return true if the provided row is considered selected under the implementing selection model.

Specified by:
isSelected in interface SelectionModel<T>
Parameters:
row - row object instance
Returns:
true, if the row given as argument is considered selected.

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<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: 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<T>
Parameters:
grid - a Grid instance; null when removing from Grid

select

public boolean select(T... rows)
Description copied from interface: SelectionModel.Multi
Selects one or more rows.

Specified by:
select in interface SelectionModel.Multi<T>
Parameters:
rows - Grid row objects
Returns:
true, if the set of selected rows was changed.

deselect

public boolean deselect(T... rows)
Description copied from interface: SelectionModel.Multi
Deselects one or more rows.

Specified by:
deselect in interface SelectionModel.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.Multi
De-selects all rows.

Specified by:
deselectAll in interface SelectionModel.Multi<T>
Returns:
true, if any row was previously selected.

select

public boolean select(java.util.Collection<T> rows)
Description copied from interface: SelectionModel.Multi
Select all rows in a Collection.

Specified by:
select in interface SelectionModel.Multi<T>
Parameters:
rows - a collection of Grid row objects
Returns:
true, if the set of selected rows was changed.

deselect

public boolean deselect(java.util.Collection<T> rows)
Description copied from interface: SelectionModel.Multi
Deselect all rows in a Collection.

Specified by:
deselect in interface SelectionModel.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: AbstractRowHandleSelectionModel
Select a row, based on its RowHandle.

Note: this method may not fire selection change events.

Specified by:
selectByHandle in class AbstractRowHandleSelectionModel<T>
Parameters:
handle - the handle to select by
Returns:
true iff the selection state was changed by this call

deselectByHandle

protected boolean deselectByHandle(DataSource.RowHandle<T> handle)
Description copied from class: AbstractRowHandleSelectionModel
Deselect a row, based on its RowHandle.

Note: this method may not fire selection change events.

Specified by:
deselectByHandle in class AbstractRowHandleSelectionModel<T>
Parameters:
handle - the handle to deselect by
Returns:
true iff the selection state was changed by this call

getSelectedRows

public java.util.Collection<T> getSelectedRows()
Description copied from interface: SelectionModel
Returns a Collection containing all selected rows.

Specified by:
getSelectedRows in interface SelectionModel<T>
Returns:
a non-null collection.

reset

public void reset()
Description copied from interface: SelectionModel
Resets the SelectionModel to the initial state.

This method can be called internally, for example, when the attached Grid's data source changes.

Specified by:
reset in interface SelectionModel<T>

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<T>

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<T>

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<T>
Returns:
true iff a batch has been started

getSelectedRowsBatch

public java.util.Collection<T> 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<T>
Returns:
a collection of the rows that would become selected

getDeselectedRowsBatch

public java.util.Collection<T> 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<T>
Returns:
a collection of the rows that would become deselected


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