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> CharSequenceconvertToString(C object)protected <C> IConverter<C>getConverter(Class<C> type)protected LocalegetLocale()protected IgetModelObject(IModel<I> rowModel)protected PgetProperty(Object object, String propertyExpression)StringgetPropertyExpression()Returns the property expression.booleanisEscapeMarkup()Returns whether the markup will be escaped.IRenderable<I>newCell(IModel<I> rowModel)Creates a newIRenderableinstance 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 byISortStateto 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 byISortStateto 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 tofalseif 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,falseotherwise
-
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 newIRenderableinstance 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:
newCellin interfaceIGridColumn<M,I,P>- Specified by:
newCellin classAbstractLightWeightColumn<M,I,S>- Parameters:
rowModel- model for given row- Returns:
IRenderableinstance
-
getPropertyExpression
public String getPropertyExpression()
Returns the property expression.- Returns:
- property expression
-
-