Package com.inmethod.grid.column
Class PropertyColumn<M,I,P,S>
- java.lang.Object
-
- com.inmethod.grid.column.AbstractColumn<M,I,S>
-
- com.inmethod.grid.column.AbstractLightWeightColumn<M,I,S>
-
- com.inmethod.grid.column.PropertyColumn<M,I,P,S>
-
- Type Parameters:
M
- grid model object typeI
- row/item model object typeP
- type of the property
- All Implemented Interfaces:
IGridColumn<M,I,S>
,Serializable
,IDetachable
,IClusterable
- Direct Known Subclasses:
EditablePropertyColumn
public class PropertyColumn<M,I,P,S> extends AbstractLightWeightColumn<M,I,S>
A lightweight column that displays a property of row object specified by an property expression.- Author:
- Matej Knopp
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PropertyColumn(String columnId, IModel<String> headerModel, String propertyExpression)
Constructor.PropertyColumn(String columnId, IModel<String> headerModel, String propertyExpression, S sortProperty)
Constructor.PropertyColumn(IModel<String> headerModel, String propertyExpression)
Constructor.PropertyColumn(IModel<String> headerModel, String propertyExpression, S sortProperty)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <C> CharSequence
convertToString(C object)
protected <C> IConverter<C>
getConverter(Class<C> type)
protected Locale
getLocale()
protected I
getModelObject(IModel<I> rowModel)
protected P
getProperty(Object object, String propertyExpression)
String
getPropertyExpression()
Returns the property expression.boolean
isEscapeMarkup()
Returns whether the markup will be escaped.IRenderable<I>
newCell(IModel<I> rowModel)
Creates a newIRenderable
instance that is used to render to render the output of cell for given row.PropertyColumn<M,I,P,S>
setEscapeMarkup(boolean escape)
Sets whether the markup will be escaped.-
Methods inherited from class com.inmethod.grid.column.AbstractLightWeightColumn
isLightWeight, newCell
-
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 Detail
-
PropertyColumn
public PropertyColumn(String columnId, IModel<String> headerModel, String propertyExpression, S sortProperty)
Constructor.- Parameters:
columnId
- column identified (must be unique within the grid)headerModel
- model for column headerpropertyExpression
- property expression used to get the displayed value for row objectsortProperty
- optional string that will be returned byISortState
to indicate that the column is being sorted
-
PropertyColumn
public PropertyColumn(String columnId, IModel<String> headerModel, String propertyExpression)
Constructor.- Parameters:
columnId
- column identified (must be unique within the grid)headerModel
- model for column headerpropertyExpression
- property expression used to get the displayed value for row object
-
PropertyColumn
public PropertyColumn(IModel<String> headerModel, String propertyExpression, S sortProperty)
Constructor. The column id is omitted in this constructor, because the property expression is used as column id.- Parameters:
headerModel
- model for column headerpropertyExpression
- property expression used to get the displayed value for row objectsortProperty
- optional string that will be returned byISortState
to indicate that the column is being sorted
-
PropertyColumn
public PropertyColumn(IModel<String> headerModel, String propertyExpression)
Constructor. The column id is omitted in this constructor, because the property expression is used as column id.- Parameters:
headerModel
- model for column headerpropertyExpression
- property expression used to get the displayed value for row object
-
-
Method Detail
-
setEscapeMarkup
public PropertyColumn<M,I,P,S> setEscapeMarkup(boolean escape)
Sets whether the markup will be escaped. Set tofalse
if the property contains html snippets that need to be rendered as html (without being escaped).- Parameters:
escape
-- Returns:
this
(useful for method chaining)
-
isEscapeMarkup
public boolean isEscapeMarkup()
Returns whether the markup will be escaped.- Returns:
true
. if the markup will be escaped,false
otherwise
-
getConverter
protected <C> IConverter<C> getConverter(Class<C> type)
-
getLocale
protected Locale getLocale()
-
convertToString
protected <C> CharSequence convertToString(C object)
-
newCell
public 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 (IGridColumn.isLightWeight(IModel)
returnstrue
).- Specified by:
newCell
in interfaceIGridColumn<M,I,P>
- Specified by:
newCell
in classAbstractLightWeightColumn<M,I,S>
- Parameters:
rowModel
- model for given row- Returns:
IRenderable
instance
-
getPropertyExpression
public String getPropertyExpression()
Returns the property expression.- Returns:
- property expression
-
-