Package com.inmethod.grid.column
Class AbstractLightWeightColumn<M,I,S>
java.lang.Object
com.inmethod.grid.column.AbstractColumn<M,I,S>
com.inmethod.grid.column.AbstractLightWeightColumn<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
- Direct Known Subclasses:
PropertyColumn
Convenience implementation of
IGridColumn
. This class should be used as base for
lightweight columns.
Contains getters and setters for most properties and takes care of the header component. The only
method necessary to implement is newCell(IModel)
.
- Author:
- Matej Knopp
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractLightWeightColumn
(String columnId, IModel<String> headerModel) Creates instance with specified column id and header modelAbstractLightWeightColumn
(String columnId, IModel<String> headerModel, S sortProperty) Creates instance with specified column id, header model and sort property. -
Method Summary
Modifier and TypeMethodDescriptionboolean
isLightWeight
(IModel<I> rowModel) Returns whether this column is uses a component for cell in given row (not lightweight) or anIRenderable
implementation.newCell
(WebMarkupContainer parent, String componentId, IModel<I> rowModel) Creates a new cell component.abstract IRenderable<I>
Creates a newIRenderable
instance that is used to render to render the output of cell for given row.Methods inherited from class com.inmethod.grid.column.AbstractColumn
cellClicked, detach, getCellCssClass, getColSpan, getGrid, getHeaderCssClass, getHeaderModel, getHeaderTooltipModel, getId, getInitialSize, getMaxSize, getMinSize, getSizeUnit, getSortProperty, getWrapText, isReorderable, isResizable, newHeader, setGrid, setHeaderTooltipModel, setInitialSize, setMaxSize, setMinSize, setReorderable, setResizable, setSizeUnit, setWrapText
-
Constructor Details
-
AbstractLightWeightColumn
Creates instance with specified column id, header model and sort property.- Parameters:
columnId
- column identifier - must be unique within the gridheaderModel
- model for column titlesortProperty
- optional string that will be returned byISortState
to indicate that the column is being sorted
-
AbstractLightWeightColumn
Creates instance with specified column id and header model- Parameters:
columnId
- column identifier - must be unique within the gridheaderModel
- model for column title
-
-
Method Details
-
isLightWeight
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- Specified by:
isLightWeight
in interfaceIGridColumn<M,
I, S> - Overrides:
isLightWeight
in classAbstractColumn<M,
I, S> - Parameters:
rowModel
- model for given row- Returns:
true
if the cell is lightweight,false
otherwise
-
newCell
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 (IGridColumn.isLightWeight(IModel)
returnstrue
).- Specified by:
newCell
in interfaceIGridColumn<M,
I, S> - Overrides:
newCell
in classAbstractColumn<M,
I, S> - Parameters:
rowModel
- model for given row- Returns:
IRenderable
instance
-
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
-