public class SelectionModelSingle<T> extends AbstractRowHandleSelectionModel<T> implements SelectionModel.Single<T>
SelectionModel.Multi<T>, SelectionModel.None<T>, SelectionModel.Single<T>| Constructor and Description |
|---|
SelectionModelSingle() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
deselect(T row)
Deselects a row.
|
protected boolean |
deselectByHandle(DataSource.RowHandle<T> handle)
Deselect a row, based on its
RowHandle. |
T |
getSelectedRow()
Returns the currently selected row.
|
Collection<T> |
getSelectedRows()
Returns a Collection containing all selected rows.
|
Renderer<Boolean> |
getSelectionColumnRenderer()
Return the
Renderer responsible for rendering the selection
column. |
boolean |
isDeselectAllowed()
Sets whether it's allowed to deselect the selected row through the
UI.
|
boolean |
isSelected(T row)
Return true if the provided row is considered selected under the
implementing selection model.
|
void |
reset()
Resets the SelectionModel to the initial state.
|
boolean |
select(T row)
Selects a row.
|
protected boolean |
selectByHandle(DataSource.RowHandle<T> handle)
Select a row, based on its
RowHandle. |
void |
setDeselectAllowed(boolean deselectAllowed)
Sets whether it's allowed to deselect the selected row through the
UI.
|
void |
setGrid(Grid<T> grid)
Tells this SelectionModel which Grid it belongs to.
|
public boolean isSelected(T row)
SelectionModelisSelected in interface SelectionModel<T>row - row object instancetrue, if the row given as argument is considered
selected.public Renderer<Boolean> getSelectionColumnRenderer()
SelectionModelRenderer responsible for rendering the selection
column.getSelectionColumnRenderer in interface SelectionModel<T>public void setGrid(Grid<T> grid)
SelectionModelImplementations are free to have this be a no-op. This method is called internally by Grid.
setGrid in interface SelectionModel<T>grid - a Grid instance; null when removing from
Gridpublic boolean select(T row)
SelectionModel.Singleselect in interface SelectionModel.Single<T>row - a Grid row objectpublic boolean deselect(T row)
SelectionModel.Single
This is a no-op unless row is the currently selected row.
deselect in interface SelectionModel.Single<T>row - a Grid row objectpublic T getSelectedRow()
SelectionModel.SinglegetSelectedRow in interface SelectionModel.Single<T>Grid row object or null, if nothing is selected.public void reset()
SelectionModelThis method can be called internally, for example, when the attached Grid's data source changes.
reset in interface SelectionModel<T>public Collection<T> getSelectedRows()
SelectionModelgetSelectedRows in interface SelectionModel<T>protected boolean selectByHandle(DataSource.RowHandle<T> handle)
AbstractRowHandleSelectionModelRowHandle.
Note: this method may not fire selection change events.
selectByHandle in class AbstractRowHandleSelectionModel<T>handle - the handle to select bytrue iff the selection state was changed by this
callprotected boolean deselectByHandle(DataSource.RowHandle<T> handle)
AbstractRowHandleSelectionModelRowHandle.
Note: this method may not fire selection change events.
deselectByHandle in class AbstractRowHandleSelectionModel<T>handle - the handle to deselect bytrue iff the selection state was changed by this
callpublic void setDeselectAllowed(boolean deselectAllowed)
SelectionModel.SinglesetDeselectAllowed in interface SelectionModel.Single<T>deselectAllowed - true if the selected row can be deselected
without selecting another row instead; otherwise
false.public boolean isDeselectAllowed()
SelectionModel.SingleisDeselectAllowed in interface SelectionModel.Single<T>true if deselection is allowed; otherwise
falseCopyright © 2016 Vaadin Ltd. All rights reserved.