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 booleancellClicked(IModel<I> rowModel)Allows to override default behavior when a row is clicked.StringgetCellCssClass(IModel<I> rowModel, int rowNum)Returns the cell specified by rowModel.intgetColSpan(IModel<I> rowModel)Returns the spanning value for cell specified by rowModel.StringgetHeaderCssClass()Returns the CSS class for this column header.StringgetId()Returns the column id.intgetInitialSize()Returns the initial size of column.intgetMaxSize()Returns the maximal size of resizable column.intgetMinSize()Returns the minimal size of resizable column.SizeUnitgetSizeUnit()Returns the unit in which sizes are specified.SgetSortProperty()Result of this method determines whether the column is sortable and in case it is, also determines the sort property.booleangetWrapText()Determines the behavior when there is more text in cell than it fits in it.booleanisLightWeight(IModel<I> rowModel)Returns whether this column is uses a component for cell in given row (not lightweight) or anIRenderableimplementation.booleanisReorderable()Returns whether user will be allowed to reorder this column (i.e. change column position relative to other columns).booleanisResizable()Returns whether user will be able to resize this column.ComponentnewCell(WebMarkupContainer parent, String componentId, IModel<I> rowModel)Creates a new cell component.IRenderable<I>newCell(IModel<I> rowModel)Creates a newIRenderableinstance that is used to render to render the output of cell for given row.ComponentnewHeader(String componentId)Creates a new component for column header.voidsetGrid(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 anIRenderableimplementation. Generally, if the cell is non-interactive (label only), it's better to use anIRenderableimplementation, as it has zero memory footprint- Parameters:
rowModel- model for given row- Returns:
trueif the cell is lightweight,falseotherwise
-
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 newIRenderableinstance 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:
IRenderableinstance
-
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
nullif 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 anIllegalStateExceptionwill be thrown.- Returns:
trueif the column is resizable,falseotherwise.
-
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:
trueif the column is reorderable,falseotherwise
-
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 returnstruethe default behavior will be suppressed.- Parameters:
rowModel- Model for clicked row- Returns:
trueif the default behavior when row is clicked should be supressed,falseotherwise.
-
-