T
- The Model object typeS
- the type of the sort propertypublic class LambdaColumn<T,S> extends AbstractColumn<T,S> implements IExportableColumn<T,S>
SerializableFunction
that is evaluated against the current row's model object
Example for a table of Contact
s:
columns[0] = new LambdaColumn(new Model<String>("First Name"), Contact::getFirstName);The above will attach a label to the cell which calls
#getFirstName()
for each displayed
contact.Constructor and Description |
---|
LambdaColumn(IModel<String> displayModel,
org.danekja.java.util.function.serializable.SerializableFunction<T,?> function)
Creates a column that is not sortable.
|
LambdaColumn(IModel<String> displayModel,
S sortProperty,
org.danekja.java.util.function.serializable.SerializableFunction<T,?> function)
Creates a property column that is also sortable.
|
Modifier and Type | Method and Description |
---|---|
IModel<?> |
getDataModel(IModel<T> rowModel)
Factory method for generating a model that will generated the displayed value.
|
void |
populateItem(Item<ICellPopulator<T>> item,
String componentId,
IModel<T> rowModel)
Method used to populate a cell in the
DataGridView
Implementation MUST add a component to the cellItem using the component id provided by
componentId argument, otherwise a WicketRuntimeException will be thrown |
detach, getCssClass, getDisplayModel, getHeader, getSortProperty
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDisplayModel
getHeader, getHeaderColspan, getHeaderRowspan, getSortProperty, isSortable
detach
public LambdaColumn(IModel<String> displayModel, org.danekja.java.util.function.serializable.SerializableFunction<T,?> function)
displayModel
- display modelfunction
- Wicket function to be applied to each rowpublic LambdaColumn(IModel<String> displayModel, S sortProperty, org.danekja.java.util.function.serializable.SerializableFunction<T,?> function)
displayModel
- display modelsortProperty
- sort propertyfunction
- Wicket function to be applied to each rowpublic void populateItem(Item<ICellPopulator<T>> item, String componentId, IModel<T> rowModel)
ICellPopulator
DataGridView
Implementation MUST add a component to the cellItem using the component id provided by
componentId argument, otherwise a WicketRuntimeException will be thrownpopulateItem
in interface ICellPopulator<T>
item
- the item representing the current table cell being renderedcomponentId
- 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.Item
public IModel<?> getDataModel(IModel<T> rowModel)
getDataModel
in interface IExportableColumn<T,S>
rowModel
- Copyright © 2006–2022 Apache Software Foundation. All rights reserved.