Hi all,
whats the meaning of generic T on DataTables vs T of IColumn and T of ICellPopulator?

As I understand its the type of object shown by the table rows.

Reading the javadoc of AbstractColumn it says T (if I understand correct), its the type of object shown by the cell itself.

But DataTable and its internal list of columns are bound together.
T of both must be the same...

I tried to implement something like this, and here I get problems.


List<IColumn<Person, Void>> cols = new ArrayList<>();
cols.add(new PropertyColumn<Person, Void>(Model.of("Name"), "name"));
(compiler error)
cols.add(new LocationColumn("location"));
(compiler error)

new DataTable<Person, Void>("id", cols, new ListDataProvider<Person>(), 50);


public class LocationColumn extends PropertyColumn<Location>{

        public LocationColumn(String expressionToLocation){
                super(Model.of("Location"), expressionToLocation);
        }

        @Override
public void populateItem(Item<ICellPopulator<Location>> cellItem, String componentId, IModel<Location> rowModel) { cellItem.add(new Label(componentId, new LocationFormatModel(rowModel, Model.of(Session.get().getLocale()))));
        }
}

Also the Generic of ICellPopulator is bound to T of column.

I always thought it could be possible to implement sub-class columns to allow special renderings of table-cells.

But how can I achieve this, if also ICellPopulator is bound to T of the rowModel?

kind regards
Patrick

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to