Class LambdaColumn<T,S>
- java.lang.Object
-
- org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn<T,S>
-
- org.apache.wicket.extensions.markup.html.repeater.data.table.LambdaColumn<T,S>
-
- Type Parameters:
T- The Model object typeS- the type of the sort property
- All Implemented Interfaces:
Serializable,ICellPopulator<T>,IExportableColumn<T,S>,IColumn<T,S>,IStyledColumn<T,S>,org.apache.wicket.model.IDetachable,org.apache.wicket.util.io.IClusterable
public class LambdaColumn<T,S> extends AbstractColumn<T,S> implements IExportableColumn<T,S>
An implementation of column that adds a label to the cell whose model is determined by the providedSerializableFunctionthat is evaluated against the current row's model objectExample for a table of
Contacts: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.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description LambdaColumn(org.apache.wicket.model.IModel<String> displayModel, org.danekja.java.util.function.serializable.SerializableFunction<T,?> function)Creates a column that is not sortable.LambdaColumn(org.apache.wicket.model.IModel<String> displayModel, S sortProperty, org.danekja.java.util.function.serializable.SerializableFunction<T,?> function)Creates a property column that is also sortable.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.wicket.model.IModel<?>getDataModel(org.apache.wicket.model.IModel<T> rowModel)Factory method for generating a model that will generated the displayed value.voidpopulateItem(org.apache.wicket.markup.repeater.Item<ICellPopulator<T>> item, String componentId, org.apache.wicket.model.IModel<T> rowModel)Method used to populate a cell in theDataGridViewImplementation MUST add a component to the cellItem using the component id provided by componentId argument, otherwise a WicketRuntimeException will be thrown-
Methods inherited from class org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn
detach, getCssClass, getDisplayModel, getHeader, getSortProperty
-
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.IColumn
getHeader, getHeaderColspan, getHeaderRowspan, getSortProperty, isSortable
-
Methods inherited from interface org.apache.wicket.extensions.markup.html.repeater.data.table.export.IExportableColumn
getDisplayModel
-
-
-
-
Constructor Detail
-
LambdaColumn
public LambdaColumn(org.apache.wicket.model.IModel<String> displayModel, org.danekja.java.util.function.serializable.SerializableFunction<T,?> function)
Creates a column that is not sortable.- Parameters:
displayModel- display modelfunction- Wicket function to be applied to each row
-
LambdaColumn
public LambdaColumn(org.apache.wicket.model.IModel<String> displayModel, S sortProperty, org.danekja.java.util.function.serializable.SerializableFunction<T,?> function)
Creates a property column that is also sortable.- Parameters:
displayModel- display modelsortProperty- sort propertyfunction- Wicket function to be applied to each row
-
-
Method Detail
-
populateItem
public void populateItem(org.apache.wicket.markup.repeater.Item<ICellPopulator<T>> item, String componentId, org.apache.wicket.model.IModel<T> rowModel)
Description copied from interface:ICellPopulatorMethod used to populate a cell in theDataGridViewImplementation MUST add a component to the cellItem using the component id provided by componentId argument, otherwise a WicketRuntimeException will be thrown- Specified by:
populateItemin interfaceICellPopulator<T>- Parameters:
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.- See Also:
Item
-
getDataModel
public org.apache.wicket.model.IModel<?> getDataModel(org.apache.wicket.model.IModel<T> rowModel)
Factory method for generating a model that will generated the displayed value.- Specified by:
getDataModelin interfaceIExportableColumn<T,S>- Parameters:
rowModel-- Returns:
- model
-
-