final List<IColumn<EmployeeDO, String>> columns = new ArrayList<IColumn<EmployeeDO, String>>();
final CellItemListener<EmployeeDO> cellItemListener = new CellItemListener<EmployeeDO>() {
public void populateItem(final Item<ICellPopulator<EmployeeDO>> item, final String componentId, final IModel<EmployeeDO> rowModel)
{
final EmployeeDO employee = rowModel.getObject();
appendCssClasses(item, employee.getId(), employee.isDeleted());
}
};
columns.add(new CellItemListenerPropertyColumn<EmployeeDO>(new ResourceModel("name"), getSortable("user.lastname", sortable),
"user.lastname", 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<EmployeeDO>> item, final String componentId, final IModel<EmployeeDO> rowModel)
{
final EmployeeDO employee = rowModel.getObject();
final PFUserDO user = employee != null ? employee.getUser() : null;
final String lastname = user != null ? user.getLastname() : null;
if (isSelectMode() == false) {
item.add(new ListSelectActionPanel(componentId, rowModel, EmployeeEditPage.class, employee.getId(), returnToPage, lastname));
} else {
item.add(new ListSelectActionPanel(componentId, rowModel, caller, selectProperty, employee.getId(), lastname));
}
cellItemListener.populateItem(item, componentId, rowModel);
addRowClick(item);
}
});
columns.add(new CellItemListenerPropertyColumn<EmployeeDO>(new ResourceModel("firstName"), getSortable("user.firstname", sortable),
"user.firstname", cellItemListener));
columns.add(new CellItemListenerPropertyColumn<EmployeeDO>(EmployeeDO.class, getSortable("status", sortable), "status",
cellItemListener));
columns.add(new CellItemListenerPropertyColumn<EmployeeDO>(new ResourceModel("fibu.kost1"), getSortable("kost1.shortDisplayName",
sortable), "kost1.shortDisplayName", cellItemListener));
columns.add(new CellItemListenerPropertyColumn<EmployeeDO>(EmployeeDO.class, getSortable("position", sortable), "position",
cellItemListener));
columns.add(new CellItemListenerPropertyColumn<EmployeeDO>(EmployeeDO.class, getSortable("abteilung", sortable), "abteilung",
cellItemListener));
columns.add(new CellItemListenerPropertyColumn<EmployeeDO>(EmployeeDO.class, getSortable("eintrittsDatum", sortable), "eintrittsDatum",
cellItemListener) {
@Override
public void populateItem(final Item<ICellPopulator<EmployeeDO>> item, final String componentId, final IModel<EmployeeDO> rowModel)
{
final EmployeeDO employee = rowModel.getObject();
item.add(new Label(componentId, DateTimeFormatter.instance().getFormattedDate(employee.getEintrittsDatum())));
}
});
columns.add(new CellItemListenerPropertyColumn<EmployeeDO>(EmployeeDO.class, getSortable("austrittsDatum", sortable), "austrittsDatum",
cellItemListener) {
@Override
public void populateItem(final Item<ICellPopulator<EmployeeDO>> item, final String componentId, final IModel<EmployeeDO> rowModel)
{
final EmployeeDO employee = rowModel.getObject();
item.add(new Label(componentId, DateTimeFormatter.instance().getFormattedDate(employee.getAustrittsDatum())));
}
});
columns.add(new CellItemListenerPropertyColumn<EmployeeDO>(EmployeeDO.class, getSortable("comment", sortable), "comment",
cellItemListener));
return columns;