Package com.inmethod.grid.column
Class CheckBoxColumn<M,I,S>
java.lang.Object
com.inmethod.grid.column.AbstractColumn<M,I,S>
com.inmethod.grid.column.CheckBoxColumn<M,I,S>
- Type Parameters:
M
- grid model object typeI
- row/item model object type
- All Implemented Interfaces:
IGridColumn<M,
,I, S> Serializable
,IDetachable
,IClusterable
Column that allows a row in grid to be selected. The column cell contains a checkbox which
selects and deselects the row. When row selection state is changed, the entire row is updated
using Ajax.
If the grid is in single selection mode, the column header will remain empty. If the column is in
multi selection mode, the column header will contain a checkbox which selects all displayed rows
(i.e. the rows on current page for DataGrid
and visible rows in TreeGrid
). When
the header checkbox is deselected, it deselects all rows (on all pages). This is to ensure that
when user deselects one page, no invisible rows are left selected.
- Author:
- Matej Knopp
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetCellCssClass
(IModel<I> rowModel, int rowNum) Returns the cell specified by rowModel.Returns the CSS class for this column header.getRowTooltipModel
(IModel<I> itemModel) Overriding this method allows to specify a tooltip for checkbox in each row.protected boolean
isCheckBoxEnabled
(IModel<I> model) protected boolean
isCheckBoxVisible
(IModel<I> model) newCell
(WebMarkupContainer parent, String componentId, IModel<I> rowModel) Creates a new cell component.Creates a new component for column header.Methods inherited from class com.inmethod.grid.column.AbstractColumn
cellClicked, detach, getColSpan, getGrid, getHeaderModel, getHeaderTooltipModel, getId, getInitialSize, getMaxSize, getMinSize, getSizeUnit, getSortProperty, getWrapText, isLightWeight, isReorderable, isResizable, newCell, setGrid, setHeaderTooltipModel, setInitialSize, setMaxSize, setMinSize, setReorderable, setResizable, setSizeUnit, setWrapText
-
Constructor Details
-
CheckBoxColumn
Creates a new checkbox column.- Parameters:
columnId
- column id (must be unique within the grid)
-
-
Method Details
-
newCell
Creates a new cell component. This method is called for rows that are not lightweight (IGridColumn.isLightWeight(IModel)
returns false ).- Specified by:
newCell
in interfaceIGridColumn<M,
I, S> - Specified by:
newCell
in classAbstractColumn<M,
I, S> - Parameters:
parent
- Parent component. This is passed in only for convenience, the method implementation is not supposed to add the newly created component to the parent.componentId
- required id of newly created componentsrowModel
- model for given row- Returns:
- new cell component
-
newHeader
Creates a new component for column header.- Specified by:
newHeader
in interfaceIGridColumn<M,
I, S> - Overrides:
newHeader
in classAbstractColumn<M,
I, S> - Parameters:
componentId
- required id that the component must have- Returns:
- Component representing a column header
-
isCheckBoxEnabled
-
isCheckBoxVisible
-
getCellCssClass
Returns the cell specified by rowModel. The class is applied to the appropriate <td> element in the grid.- Specified by:
getCellCssClass
in interfaceIGridColumn<M,
I, S> - Overrides:
getCellCssClass
in classAbstractColumn<M,
I, S> - Parameters:
rowModel
- model for given rowrowNum
- index of row forDataGrid
, -1 forTreeGrid
- Returns:
- cell style class or
null
-
getHeaderCssClass
Description copied from class:AbstractColumn
Returns the CSS class for this column header. The class is applied to the appropriate <th> element in the grid.- Specified by:
getHeaderCssClass
in interfaceIGridColumn<M,
I, S> - Overrides:
getHeaderCssClass
in classAbstractColumn<M,
I, S> - Returns:
- CSS class for this column header or
null
-
getRowTooltipModel
Overriding this method allows to specify a tooltip for checkbox in each row.- Parameters:
itemModel
- model for item in given row- Returns:
- tooltip model or
null
-