public List<IColumn<TaskDO, String>> createColumns(final WebPage returnToPage, final boolean sortable)
{
final CellItemListener<TaskDO> cellItemListener = new CellItemListener<TaskDO>() {
public void populateItem(final Item<ICellPopulator<TaskDO>> item, final String componentId, final IModel<TaskDO> rowModel)
{
final TaskDO task = rowModel.getObject();
appendCssClasses(item, task, (Integer) getHighlightedRowId());
}
};
final List<IColumn<TaskDO, String>> columns = new ArrayList<IColumn<TaskDO, String>>();
columns.add(new CellItemListenerPropertyColumn<TaskDO>(getString("task"), getSortable("title", sortable), "title",
cellItemListener) {
@Override
public void populateItem(final Item<ICellPopulator<TaskDO>> item, final String componentId, final IModel<TaskDO> rowModel)
{
final TaskDO task = rowModel.getObject();
final StringBuffer buf = new StringBuffer();
taskFormatter.appendFormattedTask(getRequestCycle(), buf, task, true, false);
final Label formattedTaskLabel = new Label(ListSelectActionPanel.LABEL_ID, buf.toString());
formattedTaskLabel.setEscapeModelStrings(false);
if (isSelectMode() == false) {
item.add(new ListSelectActionPanel(componentId, rowModel, TaskEditPage.class, task.getId(), returnToPage, formattedTaskLabel));
} else {
item.add(new ListSelectActionPanel(componentId, rowModel, caller, selectProperty, task.getId(), formattedTaskLabel));
}
cellItemListener.populateItem(item, componentId, rowModel);
addRowClick(item);
}
});
columns
.add(new CellItemListenerPropertyColumn<TaskDO>(getString("task.consumption"), null, "task", cellItemListener) {
@Override
public void populateItem(final Item<ICellPopulator<TaskDO>> item, final String componentId, final IModel<TaskDO> rowModel)
{
final TaskNode node = taskTree.getTaskNodeById(rowModel.getObject().getId());
item.add(getConsumptionBarPanel(TaskListPage.this, componentId, taskTree, isSelectMode(), node));
cellItemListener.populateItem(item, componentId, rowModel);
}
});
if (kostCache.isKost2EntriesExists() == true) {
columns.add(new CellItemListenerPropertyColumn<TaskDO>(getString("fibu.kost2"), getSortable("kost2", sortable), "kost2",
cellItemListener) {
@Override
public void populateItem(final Item<ICellPopulator<TaskDO>> item, final String componentId, final IModel<TaskDO> rowModel)
{
final Label label = getKostLabel(componentId, taskTree, rowModel.getObject());
item.add(label);
cellItemListener.populateItem(item, componentId, rowModel);
}
});
}
if (taskTree.hasOrderPositionsEntries() == true
&& accessChecker.isLoggedInUserMemberOfGroup(ProjectForgeGroup.FINANCE_GROUP, ProjectForgeGroup.CONTROLLING_GROUP,
ProjectForgeGroup.PROJECT_ASSISTANT, ProjectForgeGroup.PROJECT_MANAGER) == true) {
columns.add(new CellItemListenerPropertyColumn<TaskDO>(getString("fibu.auftrag.auftraege"), null, null, cellItemListener) {
@Override
public void populateItem(final Item<ICellPopulator<TaskDO>> item, final String componentId, final IModel<TaskDO> rowModel)
{
final TaskDO task = rowModel.getObject();
final Set<AuftragsPositionVO> orderPositions = taskTree.getOrderPositionEntries(task.getId());
if (CollectionUtils.isEmpty(orderPositions) == true) {
final Label label = new Label(componentId, ""); // Empty label.
item.add(label);
} else {
final OrderPositionsPanel orderPositionsPanel = new OrderPositionsPanel(componentId) {