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
public class CheckBoxColumn<M,I,S> extends AbstractColumn<M,I,S>
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 inTreeGrid
). 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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CheckBoxColumn(String columnId)
Creates a new checkbox column.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getCellCssClass(IModel<I> rowModel, int rowNum)
Returns the cell specified by rowModel.String
getHeaderCssClass()
Returns the CSS class for this column header.protected IModel<String>
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)
Component
newCell(WebMarkupContainer parent, String componentId, IModel<I> rowModel)
Creates a new cell component.Component
newHeader(String componentId)
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 Detail
-
CheckBoxColumn
public CheckBoxColumn(String columnId)
Creates a new checkbox column.- Parameters:
columnId
- column id (must be unique within the grid)
-
-
Method Detail
-
newCell
public Component newCell(WebMarkupContainer parent, String componentId, IModel<I> rowModel)
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
public Component newHeader(String componentId)
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
-
getCellCssClass
public String getCellCssClass(IModel<I> rowModel, int rowNum)
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
public String 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
-
-