Package com.inmethod.grid
Interface IGridColumn<M,I,S>
-
- Type Parameters:
M
- grid model object typeI
- row/item model object type
- All Superinterfaces:
IClusterable
,IDetachable
,Serializable
- All Known Implementing Classes:
AbstractColumn
,AbstractLightWeightColumn
,AbstractTreeColumn
,AddDeleteColumn
,BaseTreeColumn
,CheckBoxColumn
,DropDownChoiceColumn
,EditableCheckBoxColumn
,EditableLocalDateColumn
,EditablePropertyColumn
,EditablePropertyTreeColumn
,LinkColumn
,PageLinkColumn
,PropertyColumn
,PropertyTreeColumn
,SubmitCancelColumn
,WicketColumnAdapter
public interface IGridColumn<M,I,S> extends IDetachable
- Author:
- Matej Knopp
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
cellClicked(IModel<I> rowModel)
Allows to override default behavior when a row is clicked.String
getCellCssClass(IModel<I> rowModel, int rowNum)
Returns the cell specified by rowModel.int
getColSpan(IModel<I> rowModel)
Returns the spanning value for cell specified by rowModel.String
getHeaderCssClass()
Returns the CSS class for this column header.String
getId()
Returns the column id.int
getInitialSize()
Returns the initial size of column.int
getMaxSize()
Returns the maximal size of resizable column.int
getMinSize()
Returns the minimal size of resizable column.SizeUnit
getSizeUnit()
Returns the unit in which sizes are specified.S
getSortProperty()
Result of this method determines whether the column is sortable and in case it is, also determines the sort property.boolean
getWrapText()
Determines the behavior when there is more text in cell than it fits in it.boolean
isLightWeight(IModel<I> rowModel)
Returns whether this column is uses a component for cell in given row (not lightweight) or anIRenderable
implementation.boolean
isReorderable()
Returns whether user will be allowed to reorder this column (i.e.boolean
isResizable()
Returns whether user will be able to resize this column.Component
newCell(WebMarkupContainer parent, String componentId, IModel<I> rowModel)
Creates a new cell component.IRenderable<I>
newCell(IModel<I> rowModel)
Creates a newIRenderable
instance that is used to render to render the output of cell for given row.Component
newHeader(String componentId)
Creates a new component for column header.void
setGrid(AbstractGrid<M,I,S> grid)
Invoked before the first render of the grid.-
Methods inherited from interface org.apache.wicket.model.IDetachable
detach
-
-
-
-
Method Detail
-
getId
String getId()
Returns the column id. Each column must have a unique Id. The only allowed characters in a column id are alphanumeric characters, dash, dot and underscore.- Returns:
- column identifier
-
newHeader
Component newHeader(String componentId)
Creates a new component for column header.- Parameters:
componentId
- required id that the component must have- Returns:
- Component representing a column header
-
isLightWeight
boolean isLightWeight(IModel<I> rowModel)
Returns whether this column is uses a component for cell in given row (not lightweight) or anIRenderable
implementation. Generally, if the cell is non-interactive (label only), it's better to use anIRenderable
implementation, as it has zero memory footprint- Parameters:
rowModel
- model for given row- Returns:
true
if the cell is lightweight,false
otherwise
-
newCell
Component newCell(WebMarkupContainer parent, String componentId, IModel<I> rowModel)
Creates a new cell component. This method is called for rows that are not lightweight (isLightWeight(IModel)
returns false ).- 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
-
newCell
IRenderable<I> newCell(IModel<I> rowModel)
Creates a newIRenderable
instance that is used to render to render the output of cell for given row. This method is called for rows that are lightweight (isLightWeight(IModel)
returnstrue
).- Parameters:
rowModel
- model for given row- Returns:
IRenderable
instance
-
getSortProperty
S getSortProperty()
Result of this method determines whether the column is sortable and in case it is, also determines the sort property. If the column is sortable and user sorts by it, the sort property can then be obtained throughIGridSortState
.- Returns:
- sort property or
null
if the column is not sortable - See Also:
IGridSortState.ISortStateColumn.getPropertyName()
-
isResizable
boolean isResizable()
Returns whether user will be able to resize this column. If the column is resizable,getSizeUnit()
must returnSizeUnit.PX
, otherwise anIllegalStateException
will be thrown.- Returns:
true
if the column is resizable,false
otherwise.
-
getInitialSize
int getInitialSize()
Returns the initial size of column. The unit is determined bygetSizeUnit()
.- Returns:
- initial column size
-
getSizeUnit
SizeUnit getSizeUnit()
Returns the unit in which sizes are specified. If the column is resizable, this method must always returnSizeUnit.PX
.- Returns:
- size unit
-
getMinSize
int getMinSize()
Returns the minimal size of resizable column. Return values not greater than zero will be ignored.- Returns:
- minimal size
-
getMaxSize
int getMaxSize()
Returns the maximal size of resizable column. Return values not greater than zero will be ignored.- Returns:
- maximal size
-
isReorderable
boolean isReorderable()
Returns whether user will be allowed to reorder this column (i.e. change column position relative to other columns).- Returns:
true
if the column is reorderable,false
otherwise
-
getHeaderCssClass
String getHeaderCssClass()
Returns the CSS class for this column header. The class is applied to the appropriate <th> element in the grid.- Returns:
- CSS class for this column header or
null
-
getCellCssClass
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.
-
getColSpan
int getColSpan(IModel<I> rowModel)
Returns the spanning value for cell specified by rowModel. The cell can span over certain number of adjacent cells. The value determines how many cell will this column take. Values less than 2 mean that no extra spanning will be done.- Parameters:
rowModel
- model for given row- Returns:
- colspan value
-
setGrid
void setGrid(AbstractGrid<M,I,S> grid)
Invoked before the first render of the grid. Column that need grid reference can implement this method and store the reference.- Parameters:
grid
- grid that contains this column
-
getWrapText
boolean getWrapText()
Determines the behavior when there is more text in cell than it fits in it. If the method returnstrue
, the text will be wrapped and row height increased. If the method returnsfalse
, the remaining part of text will be hidden.- Returns:
- whether this colulmn's text should wrap or not
-
cellClicked
boolean cellClicked(IModel<I> rowModel)
Allows to override default behavior when a row is clicked. Depending on grid settings the default behavior can select the item. If this method returnstrue
the default behavior will be suppressed.- Parameters:
rowModel
- Model for clicked row- Returns:
true
if the default behavior when row is clicked should be supressed,false
otherwise.
-
-