@Override
public void populateItem(final Item<ICellPopulator<TimesheetDO>> item, final String componentId,
final IModel<TimesheetDO> rowModel)
{
final TimesheetDO timesheet = rowModel.getObject();
final ListSelectActionPanel actionPanel = new ListSelectActionPanel(componentId,
createRecentTimeSheetSelectionLink(timesheet), new Model<String>() {
@Override
public String getObject()
{
final StringBuffer buf = new StringBuffer();
if (timesheet.getKost2() != null) {
buf.append(timesheet.getKost2().getShortDisplayName());
}
if (timesheet.getUserId() != null && timesheet.getUserId().equals(PFUserContext.getUserId()) == false) {
if (timesheet.getKost2() != null) {
buf.append(", ");
}
buf.append(userFormatter.getFormattedUser(timesheet.getUserId()));
}
return buf.toString();
}
});
item.add(actionPanel);
item.add(AttributeModifier.append("style", new Model<String>("white-space: nowrap;")));
final Item< ? > row = item.findParent(Item.class);
WicketUtils.addRowClick(row);
cellItemListener.populateItem(item, componentId, rowModel);
}
});
columns.add(new CellItemListenerPropertyColumn<TimesheetDO>(new Model<String>(getString("fibu.kunde")), null,
"kost2.projekt.kunde.name", cellItemListener));
columns.add(new CellItemListenerPropertyColumn<TimesheetDO>(new Model<String>(getString("fibu.projekt")), null, "kost2.projekt.name",
cellItemListener));
columns.add(new TaskPropertyColumn<TimesheetDO>(getString("task"), null, "task", cellItemListener).withTaskTree(taskTree));
} else {
columns.add(new CellItemListenerPropertyColumn<TimesheetDO>(new Model<String>(getString("task")), null, "task.title",
cellItemListener) {
@Override
public void populateItem(final Item<ICellPopulator<TimesheetDO>> item, final String componentId, final IModel<TimesheetDO> rowModel)
{
final TimesheetDO timesheet = rowModel.getObject();
final TaskDO task = rowModel.getObject().getTask();
final Label label = new Label("label", task != null ? task.getTitle() : "");
final ListSelectActionPanel actionPanel = new ListSelectActionPanel(componentId, createRecentTimeSheetSelectionLink(timesheet),
label);
WicketUtils.addTooltip(label, TaskFormatter.instance().getTaskPath(task.getId(), false, OutputType.HTML));
item.add(actionPanel);
final Item< ? > row = item.findParent(Item.class);
WicketUtils.addRowClick(row);