{
final TaskTree taskTree = getTaskTree();
final CellItemListener<TaskNode> cellItemListener = new CellItemListener<TaskNode>() {
public void populateItem(final Item<ICellPopulator<TaskNode>> item, final String componentId, final IModel<TaskNode> rowModel)
{
final TaskNode taskNode = rowModel.getObject();
TaskListPage.appendCssClasses(item, taskNode.getTask(), highlightedTaskNodeId);
}
};
final List<IColumn<TaskNode, String>> columns = new ArrayList<IColumn<TaskNode, String>>();
columns.add(new TreeColumn<TaskNode, String>(new ResourceModel("task")) {
@Override
public void populateItem(final Item<ICellPopulator<TaskNode>> cellItem, final String componentId, final IModel<TaskNode> rowModel)
{
final RepeatingView view = new RepeatingView(componentId);
cellItem.add(view);
final TaskNode taskNode = rowModel.getObject();
if (selectMode == false) {
view.add(new ListSelectActionPanel(view.newChildId(), rowModel, TaskEditPage.class, taskNode.getId(), parentPage, ""));
} else {
view.add(new ListSelectActionPanel(view.newChildId(), rowModel, caller, selectProperty, taskNode.getId(), ""));
}
AbstractListPage.addRowClick(cellItem);
final NodeModel<TaskNode> nodeModel = (NodeModel<TaskNode>) rowModel;
final Component nodeComponent = getTree().newNodeComponent(view.newChildId(), nodeModel.getWrappedModel());
nodeComponent.add(new NodeBorder(nodeModel.getBranches()));
view.add(nodeComponent);
cellItemListener.populateItem(cellItem, componentId, rowModel);
}
});
columns.add(new CellItemListenerPropertyColumn<TaskNode>(new ResourceModel("task.consumption"), null, "task", cellItemListener) {
@Override
public void populateItem(final Item<ICellPopulator<TaskNode>> item, final String componentId, final IModel<TaskNode> rowModel)
{
final TaskNode node = rowModel.getObject();
item.add(TaskListPage.getConsumptionBarPanel(tree, componentId, getTaskTree(), selectMode, node));
cellItemListener.populateItem(item, componentId, rowModel);
}
});
if (showCost == true) {
columns.add(new CellItemListenerPropertyColumn<TaskNode>(new ResourceModel("fibu.kost2"), null, "task.kost2", cellItemListener) {
@Override
public void populateItem(final Item<ICellPopulator<TaskNode>> item, final String componentId, final IModel<TaskNode> rowModel)
{
final Label label = TaskListPage.getKostLabel(componentId, getTaskTree(), rowModel.getObject().getTask());
item.add(label);
cellItemListener.populateItem(item, componentId, rowModel);
}
});
}
if (taskTree.hasOrderPositionsEntries() == true && showOrders == true) {
columns.add(new CellItemListenerPropertyColumn<TaskNode>(new ResourceModel("fibu.auftrag.auftraege"), null, null, cellItemListener) {
@Override
public void populateItem(final Item<ICellPopulator<TaskNode>> item, final String componentId, final IModel<TaskNode> rowModel)
{
final TaskNode taskNode = rowModel.getObject();
final Set<AuftragsPositionVO> orderPositions = taskTree.getOrderPositionEntries(taskNode.getId());
if (CollectionUtils.isEmpty(orderPositions) == true) {
final Label label = new Label(componentId, ""); // Empty label.
item.add(label);
} else {
final OrderPositionsPanel orderPositionsPanel = new OrderPositionsPanel(componentId) {