M
- the model data typepublic class CheckBoxSelectionModel<M> extends GridSelectionModel<M>
getColumn()
and assign as
the grid's selection model via Grid.setSelectionModel(GridSelectionModel)
.
This selection mode defaults to SelectionMode.MULTI and also supports SelectionMode.SIMPLE. With SIMPLE, the control and shift keys do not need to be pressed for multiple selections.
Modifier and Type | Class and Description |
---|---|
static interface |
CheckBoxSelectionModel.CheckBoxColumnAppearance |
GridSelectionModel.SelectionModelCallback
Modifier and Type | Field and Description |
---|---|
protected ColumnConfig<M,M> |
config |
deselectOnSimpleClick, enableNavKeys, grid, keyNav, listStore
fireSelectionChangeOnClick, lastSelected, locked, mouseDown, selected, selectionMode, store
Constructor and Description |
---|
CheckBoxSelectionModel()
Creates a CheckBoxSelectionModel that will operate on the row itself.
|
CheckBoxSelectionModel(CheckBoxSelectionModel.CheckBoxColumnAppearance appearance)
Creates a CheckBoxSelectionModel with a custom appearance instance.
|
CheckBoxSelectionModel(ValueProvider<M,M> valueProvider)
Creates a CheckBoxSelectionModel with a custom ValueProvider instance.
|
CheckBoxSelectionModel(ValueProvider<M,M> valueProvider,
CheckBoxSelectionModel.CheckBoxColumnAppearance appearance)
Creates a CheckBoxSelectionModel with a custom ValueProvider and appearance.
|
Modifier and Type | Method and Description |
---|---|
void |
bindGrid(Grid<M> grid)
Binds the given grid to this selection model.
|
CheckBoxSelectionModel.CheckBoxColumnAppearance |
getAppearance()
Returns the check box column appearance.
|
ColumnConfig<M,M> |
getColumn()
Returns the column config.
|
protected void |
handleHeaderClick(HeaderClickEvent event) |
boolean |
isSelectAllChecked()
Returns true if the header checkbox is rendered and selected.
|
boolean |
isShowSelectAll()
Returns true if this column header contains a checkbox that the user can interact with.
|
protected ColumnConfig<M,M> |
newColumnConfig(ValueProvider<M,M> valueProvider) |
protected void |
onAdd(List<? extends M> models) |
protected void |
onClear(StoreClearEvent<M> event) |
protected void |
onRefresh(RefreshEvent event) |
protected void |
onRemove(M model) |
protected void |
onRowClick(RowClickEvent event)
Handles a row click event.
|
protected void |
onRowMouseDown(RowMouseDownEvent event)
Handles a row mouse down event.
|
protected void |
onSelectChange(M model,
boolean select) |
protected void |
render(Context context,
M value,
SafeHtmlBuilder sb) |
protected void |
setChecked(boolean checked) |
void |
setSelectAllChecked(boolean select)
Sets the select all checkbox in the grid header and selects / deselects all rows.
|
void |
setShowSelectAll(boolean showSelectAll)
True to show the select all checkbox in the grid header, false to hide it and prevent select all behavior.
|
protected void |
updateHeaderCheckBox() |
bind, getGrid, hasNext, hasPrevious, isSelectable, onKeyDown, onKeyLeft, onKeyPress, onKeyRight, onKeyUp, onLastFocusChanged, onRecordChange, onUpdate, selectNext, selectPrevious
addBeforeSelectionHandler, addSelectionChangedHandler, addSelectionHandler, deselect, deselect, deselect, deselect, deselect, deselectAll, doDeselect, doMultiSelect, doSelect, doSingleSelect, ensureHandlers, fireEvent, fireSelectionChange, getLastFocused, getSelectedItem, getSelectedItems, getSelection, getSelectionMode, isLocked, isSelected, refresh, select, select, select, select, select, selectAll, setLastFocused, setLocked, setSelection, setSelectionMode
protected ColumnConfig<M,M> config
public CheckBoxSelectionModel()
public CheckBoxSelectionModel(ValueProvider<M,M> valueProvider)
valueProvider
- the ValueProvider to use when constructing a ColumnConfigpublic CheckBoxSelectionModel(CheckBoxSelectionModel.CheckBoxColumnAppearance appearance)
appearance
- the appearance that should be used to render and update the checkboxpublic CheckBoxSelectionModel(ValueProvider<M,M> valueProvider, CheckBoxSelectionModel.CheckBoxColumnAppearance appearance)
valueProvider
- the ValueProvider to use when constructing a ColumnConfigappearance
- the appearance that should be used to render and update the checkboxpublic CheckBoxSelectionModel.CheckBoxColumnAppearance getAppearance()
public void bindGrid(Grid<M> grid)
GridSelectionModel
bindGrid
in class GridSelectionModel<M>
grid
- the grid to bind to this selection modelpublic ColumnConfig<M,M> getColumn()
public boolean isSelectAllChecked()
public boolean isShowSelectAll()
public void setSelectAllChecked(boolean select)
setShowSelectAll(boolean)
), this will only update the visible row checkboxes.select
- true to select allpublic void setShowSelectAll(boolean showSelectAll)
GridView.refresh(boolean)
, passing true
to get the header to refresh).showSelectAll
- true to show a header checkbox, false to hide itprotected void handleHeaderClick(HeaderClickEvent event)
protected void onRowClick(RowClickEvent event)
GridSelectionModel
onRowClick
in class GridSelectionModel<M>
event
- the row click eventprotected void onRowMouseDown(RowMouseDownEvent event)
GridSelectionModel
onRowMouseDown
in class GridSelectionModel<M>
event
- the row mouse down eventprotected ColumnConfig<M,M> newColumnConfig(ValueProvider<M,M> valueProvider)
protected void onAdd(List<? extends M> models)
onAdd
in class AbstractStoreSelectionModel<M>
protected void onClear(StoreClearEvent<M> event)
onClear
in class AbstractStoreSelectionModel<M>
protected void onRefresh(RefreshEvent event)
protected void onRemove(M model)
onRemove
in class AbstractStoreSelectionModel<M>
protected void onSelectChange(M model, boolean select)
onSelectChange
in class GridSelectionModel<M>
protected void render(Context context, M value, SafeHtmlBuilder sb)
protected void setChecked(boolean checked)
protected void updateHeaderCheckBox()
Copyright © 2018. All rights reserved.