final List<IColumn<KundeDO, String>> columns = new ArrayList<IColumn<KundeDO, String>>();
final CellItemListener<KundeDO> cellItemListener = new CellItemListener<KundeDO>() {
public void populateItem(final Item<ICellPopulator<KundeDO>> item, final String componentId, final IModel<KundeDO> rowModel)
{
final KundeDO kunde = rowModel.getObject();
if (kunde.getStatus() == null) {
// Should not occur:
return;
}
appendCssClasses(item, kunde.getId(), kunde.isDeleted() == true || kunde.getStatus().isIn(KundeStatus.ENDED) == true);
}
};
columns.add(new CellItemListenerPropertyColumn<KundeDO>(new Model<String>(getString("fibu.kunde.nummer")), "kost", "kost",
cellItemListener) {
/**
* @see org.projectforge.web.wicket.CellItemListenerPropertyColumn#populateItem(org.apache.wicket.markup.repeater.Item,
* java.lang.String, org.apache.wicket.model.IModel)
*/
@Override
public void populateItem(final Item<ICellPopulator<KundeDO>> item, final String componentId, final IModel<KundeDO> rowModel)
{
final KundeDO kunde = rowModel.getObject();
if (isSelectMode() == false) {
item.add(new ListSelectActionPanel(componentId, rowModel, CustomerEditPage.class, kunde.getId(), returnToPage, String
.valueOf(kunde.getKost())));
} else {
item.add(new ListSelectActionPanel(componentId, rowModel, caller, selectProperty, kunde.getId(), String.valueOf(kunde.getKost())));
}
cellItemListener.populateItem(item, componentId, rowModel);
addRowClick(item);
}
});
columns.add(new CellItemListenerPropertyColumn<KundeDO>(new Model<String>(getString("fibu.kunde.identifier")), "identifier",
"identifier", cellItemListener));
columns.add(new CellItemListenerPropertyColumn<KundeDO>(new Model<String>(getString("fibu.kunde.name")), "name", "name",
cellItemListener));
columns.add(new CellItemListenerPropertyColumn<KundeDO>(new Model<String>(getString("fibu.kunde.division")), "division", "division",
cellItemListener));
columns.add(new CellItemListenerPropertyColumn<KundeDO>(new Model<String>(getString("fibu.konto")), null, "konto", cellItemListener) {
/**
* @see org.projectforge.web.wicket.CellItemListenerPropertyColumn#populateItem(org.apache.wicket.markup.repeater.Item,
* java.lang.String, org.apache.wicket.model.IModel)
*/
@Override
public void populateItem(final Item<ICellPopulator<KundeDO>> item, final String componentId, final IModel<KundeDO> rowModel)
{
final KundeDO kunde = rowModel.getObject();
final KontoDO konto = kontoCache.getKonto(kunde.getKontoId());
item.add(new Label(componentId, konto != null ? konto.formatKonto() : ""));
cellItemListener.populateItem(item, componentId, rowModel);
}
});
columns.add(new CellItemListenerPropertyColumn<KundeDO>(new Model<String>(getString("status")), "status", "status", cellItemListener));