org.apache.wicket.extensions.markup.html.repeater.data.table
Class PropertyColumn<T,S>

java.lang.Object
  extended by org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn<T,S>
      extended by org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn<T,S>
Type Parameters:
T - The Model object type
S - the type of the sort property
All Implemented Interfaces:
Serializable, ICellPopulator<T>, IExportableColumn<T,S,Object>, IColumn<T,S>, IStyledColumn<T,S>, IDetachable, org.apache.wicket.util.io.IClusterable
Direct Known Subclasses:
FilteredPropertyColumn

public class PropertyColumn<T,S>
extends AbstractColumn<T,S>
implements IExportableColumn<T,S,Object>

A convenience implementation of column that adds a label to the cell whose model is determined by the provided wicket property expression (same as used by PropertyModel) that is evaluated against the current row's model object

Example

 columns[0] = new PropertyColumn(new Model<String>("First Name"), "name.first");
 
The above will attach a label to the cell with a property model for the expression "name.first"

Author:
Igor Vaynberg ( ivaynberg )
See Also:
PropertyModel, Serialized Form

Constructor Summary
PropertyColumn(IModel<String> displayModel, S sortProperty, String propertyExpression)
          Creates a property column that is also sortable
PropertyColumn(IModel<String> displayModel, String propertyExpression)
          Creates a non sortable property column
 
Method Summary
protected  IModel<?> createLabelModel(IModel<T> rowModel)
          Deprecated. since 6.2.0, scheduled for removal in 7.0.0. Please use getDataModel(org.apache.wicket.model.IModel) instead.
 IModel<Object> getDataModel(IModel<T> rowModel)
          Factory method for generating a model that will generated the displayed value.
 String getPropertyExpression()
           
 void populateItem(Item<ICellPopulator<T>> item, String componentId, IModel<T> rowModel)
          Implementation of populateItem which adds a label to the cell whose model is the provided property expression evaluated against rowModelObject
 
Methods inherited from class org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn
detach, getCssClass, getDisplayModel, getHeader, getSortProperty, isSortable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.wicket.extensions.markup.html.repeater.data.table.export.IExportableColumn
getDisplayModel
 
Methods inherited from interface org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn
getHeader, getSortProperty, isSortable
 
Methods inherited from interface org.apache.wicket.model.IDetachable
detach
 

Constructor Detail

PropertyColumn

public PropertyColumn(IModel<String> displayModel,
                      S sortProperty,
                      String propertyExpression)
Creates a property column that is also sortable

Parameters:
displayModel - display model
sortProperty - sort property
propertyExpression - wicket property expression used by PropertyModel

PropertyColumn

public PropertyColumn(IModel<String> displayModel,
                      String propertyExpression)
Creates a non sortable property column

Parameters:
displayModel - display model
propertyExpression - wicket property expression
See Also:
PropertyModel
Method Detail

populateItem

public void populateItem(Item<ICellPopulator<T>> item,
                         String componentId,
                         IModel<T> rowModel)
Implementation of populateItem which adds a label to the cell whose model is the provided property expression evaluated against rowModelObject

Specified by:
populateItem in interface ICellPopulator<T>
Parameters:
item - the item representing the current table cell being rendered
componentId - the id of the component used to render the cell (only one component should be added to the cell)
rowModel - the model of the row item being rendered. this model usually contains the model provided by the data provider.
See Also:
ICellPopulator.populateItem(Item, String, IModel)

createLabelModel

protected IModel<?> createLabelModel(IModel<T> rowModel)
Deprecated. since 6.2.0, scheduled for removal in 7.0.0. Please use getDataModel(org.apache.wicket.model.IModel) instead.

Factory method for generating a model that will generated the displayed value. Typically the model is a property model using the propertyExpression specified in the constructor.

Parameters:
rowModel -
Returns:
model

getPropertyExpression

public String getPropertyExpression()
Returns:
wicket property expression

getDataModel

public IModel<Object> getDataModel(IModel<T> rowModel)
Factory method for generating a model that will generated the displayed value. Typically the model is a property model using the propertyExpression specified in the constructor.

Specified by:
getDataModel in interface IExportableColumn<T,S,Object>
Parameters:
rowModel -
Returns:
model


Copyright © 2006-2013 Apache Software Foundation. All Rights Reserved.