com.inmethod.grid.column
Class PropertyColumn<M,I,P>

java.lang.Object
  extended by com.inmethod.grid.column.AbstractColumn<M,I>
      extended by com.inmethod.grid.column.AbstractLightWeightColumn<M,I>
          extended by com.inmethod.grid.column.PropertyColumn<M,I,P>
Type Parameters:
M - grid model object type
I - row/item model object type
P - type of the property
All Implemented Interfaces:
IGridColumn<M,I>, Serializable, IClusterable, IDetachable
Direct Known Subclasses:
EditablePropertyColumn

public class PropertyColumn<M,I,P>
extends AbstractLightWeightColumn<M,I>

A lightweight column that displays a property of row object specified by an property expression.

Author:
Matej Knopp
See Also:
Serialized Form

Constructor Summary
PropertyColumn(IModel<String> headerModel, String propertyExpression)
          Constructor.
PropertyColumn(IModel<String> headerModel, String propertyExpression, String sortProperty)
          Constructor.
PropertyColumn(String columnId, IModel<String> headerModel, String propertyExpression)
          Constructor.
PropertyColumn(String columnId, IModel<String> headerModel, String propertyExpression, String sortProperty)
          Constructor.
 
Method Summary
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 new IRenderable instance that is used to render to render the output of cell for given row.
 PropertyColumn<M,I,P> 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyColumn

public PropertyColumn(String columnId,
                      IModel<String> headerModel,
                      String propertyExpression,
                      String sortProperty)
Constructor.

Parameters:
columnId - column identified (must be unique within the grid)
headerModel - model for column header
propertyExpression - property expression used to get the displayed value for row object
sortProperty - optional string that will be returned by ISortState 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 header
propertyExpression - property expression used to get the displayed value for row object

PropertyColumn

public PropertyColumn(IModel<String> headerModel,
                      String propertyExpression,
                      String sortProperty)
Constructor. The column id is omitted in this constructor, because the property expression is used as column id.

Parameters:
headerModel - model for column header
propertyExpression - property expression used to get the displayed value for row object
sortProperty - optional string that will be returned by ISortState 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 header
propertyExpression - property expression used to get the displayed value for row object
Method Detail

setEscapeMarkup

public PropertyColumn<M,I,P> setEscapeMarkup(boolean escape)
Sets whether the markup will be escaped. Set to false 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:
truefalse otherwise

getProperty

protected P getProperty(Object object,
                        String propertyExpression)

getModelObject

protected I getModelObject(IModel<I> rowModel)

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 new IRenderable 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) returns true ).

Specified by:
newCell in interface IGridColumn<M,I>
Specified by:
newCell in class AbstractLightWeightColumn<M,I>
Parameters:
rowModel - model for given row
Returns:
IRenderable instance

getPropertyExpression

public String getPropertyExpression()
Returns the property expression.

Returns:
property expression


Copyright © 2007-2012 inMethod s.r.o.. All Rights Reserved.