org.ujorm.wicket.component.gridView
Class KeyColumn<UJO extends Ujo>

java.lang.Object
  extended by org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn<UJO>
      extended by org.ujorm.wicket.component.gridView.KeyColumn<UJO>
All Implemented Interfaces:
Serializable, org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator<UJO>, org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn<UJO>, org.apache.wicket.extensions.markup.html.repeater.data.table.IStyledColumn<UJO>, org.apache.wicket.IClusterable, org.apache.wicket.model.IDetachable

public class KeyColumn<UJO extends Ujo>
extends org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn<UJO>

A convenience implementation of column that adds a Ujo Property 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:

 public class DataTablePage2 extends WebPage {
     
     public DataTablePage2() {
         final EmployeeProvider userProvider = new EmployeeProvider();
 
         final List<IColumn> columns = new ArrayList<IColumn>();
         columns.add(new KeyColumn(Employee.ID));
         columns.add(new KeyColumn(Employee.FIRSTNAME));
         columns.add(new KeyColumn(Employee.LASTNAME));
         columns.add(new KeyColumn(Employee.EMAIL));
         columns.add(new KeyColumn(Employee.STUDENT));
 
         add(new DefaultDataTable("datatable", columns, userProvider, 20));
     }
 }
 
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
KeyColumn(Class type, Key property)
          Deprecated. 
KeyColumn(Key property)
          Creates a property column that is also sortable - the simplyfied methdod
 
Method Summary
protected  org.apache.wicket.model.IModel<UJO> createLabelModel(org.apache.wicket.model.IModel<UJO> rowModel)
          Factory method for generating a model that will generated the displayed value.
 String getPropertyExpression()
           
 void populateItem(org.apache.wicket.markup.repeater.Item<org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator<UJO>> item, String componentId, org.apache.wicket.model.IModel<UJO> 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
 

Constructor Detail

KeyColumn

@Deprecated
public KeyColumn(Class type,
                            Key property)
Deprecated. 

Creates a property column that is also sortable

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

KeyColumn

public KeyColumn(Key property)
Creates a property column that is also sortable - the simplyfied methdod

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

populateItem

public void populateItem(org.apache.wicket.markup.repeater.Item<org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator<UJO>> item,
                         String componentId,
                         org.apache.wicket.model.IModel<UJO> rowModel)
Implementation of populateItem which adds a label to the cell whose model is the provided property expression evaluated against rowModelObject

See Also:
ICellPopulator.populateItem(Item, String, IModel)

createLabelModel

protected org.apache.wicket.model.IModel<UJO> createLabelModel(org.apache.wicket.model.IModel<UJO> 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.

Parameters:
rowModel -
Returns:
model

getPropertyExpression

public String getPropertyExpression()
Returns:
wicket property expression


Copyright © 2013. All Rights Reserved.