コード例 #1
0
    private static String createTooltiptext(LimitingResourceQueueElement element) {
        final Task task = element.getResourceAllocation().getTask();
        final OrderElement order = getRootOrder(task);

        StringBuilder result = new StringBuilder();
        result.append(_("Project: {0}", order.getName())).append(" ");
        result.append(_("Task: {0}", task.getName())).append(" ");
        result.append(_("Completed: {0}%", element.getAdvancePercentage().multiply(new BigDecimal(100)))).append(" ");

        final ResourceAllocation<?> resourceAllocation = element.getResourceAllocation();

        if ( resourceAllocation instanceof SpecificResourceAllocation ) {

            final SpecificResourceAllocation specific = (SpecificResourceAllocation) resourceAllocation;
            result.append(_("Resource: {0}", specific.getResource().getName())).append(" ");

        } else if ( resourceAllocation instanceof GenericResourceAllocation ) {

            final GenericResourceAllocation generic = (GenericResourceAllocation) resourceAllocation;

            /* TODO resolve deprecated */
            result.append(_("Criteria: {0}", Criterion.getCaptionFor(generic.getCriterions()))).append(" ");

        }
        result.append(_("Allocation: [{0},{1}]", element.getStartDate().toString(), element.getEndDate()));

        return result.toString();
    }
コード例 #2
0
 private void initializeCriteria(Task task) {
     for (ResourceAllocation<?> each: task.getLimitingResourceAllocations()) {
         if (isGeneric(each)) {
             initializeCriteria((GenericResourceAllocation) each);
         }
     }
 }
コード例 #3
0
 /**
  * Re-attach {@link TaskSource}
  */
 private void reattachTaskSource() {
     TaskSource taskSource = task.getTaskSource();
     taskSourceDAO.reattach(taskSource);
     Set<HoursGroup> hoursGroups = taskSource.getHoursGroups();
     for (HoursGroup hoursGroup : hoursGroups) {
         reattachHoursGroup(hoursGroup);
     }
 }
コード例 #4
0
 @Override
 @Transactional(readOnly = true)
 public List<AggregatedHoursGroup> getHoursAggregatedByCriteria() {
     reattachTaskSource();
     List<AggregatedHoursGroup> result = task.getTaskSource()
             .getAggregatedByCriterions();
     ensuringAccesedPropertiesAreLoaded(result);
     return result;
 }
コード例 #5
0
    private static OrderElement getRootOrder(Task task) {
        OrderElement order = task.getOrderElement();

        while (order.getParent() != null) {
            order = order.getParent();
        }

        return order;
    }
コード例 #6
0
 private void addAssociatedLimitingResourceQueueElement(Task task, ResourceAllocation<?> resourceAllocation) {
     LimitingResourceQueueElement element = LimitingResourceQueueElement.create();
     resourceAllocation.setLimitingResourceQueueElement(element);
     task.setResourceAllocation(resourceAllocation);
 }
コード例 #7
0
 private void forceLoadHoursGroup(Task task) {
   task.getHoursGroup();
 }
コード例 #8
0
    private static QueueTask createDivForElement(IDatesMapper datesMapper, LimitingResourceQueueElement queueElement) {

        final Task task = queueElement.getResourceAllocation().getTask();
        final OrderElement order = getRootOrder(task);

        QueueTask result = new QueueTask(queueElement);
        String cssClass = "queue-element";
        result.setTooltiptext(createTooltiptext(queueElement));

        int startPixels = getStartPixels(datesMapper, queueElement);
        result.setLeft(forCSS(startPixels));

        if ( startPixels < 0 ) {
            cssClass += " truncated-start ";
        }

        int taskWidth = getWidthPixels(datesMapper, queueElement);

        if ( (startPixels + taskWidth) > datesMapper.getHorizontalSize() ) {
            taskWidth = datesMapper.getHorizontalSize() - startPixels;
            cssClass += " truncated-end ";
        } else {
            result.appendChild(generateNonWorkableShade(datesMapper, queueElement));
        }
        result.setWidth(forCSS(taskWidth));

        LocalDate deadlineDate = task.getDeadline();
        boolean isOrderDeadline = false;

        if ( deadlineDate == null ) {

            Date orderDate = order.getDeadline();

            if ( orderDate != null ) {

                deadlineDate = LocalDate.fromDateFields(orderDate);
                isOrderDeadline = true;

            }
        }

        if ( deadlineDate != null ) {

            int deadlinePosition = getDeadlinePixels(datesMapper, deadlineDate);

            if ( deadlinePosition < datesMapper.getHorizontalSize() ) {
                Div deadline = new Div();
                deadline.setSclass(isOrderDeadline ? "deadline order-deadline" : "deadline");
                deadline.setLeft((deadlinePosition - startPixels - DEADLINE_MARK_HALF_WIDTH) + "px");
                result.appendChild(deadline);
                result.appendChild(generateNonWorkableShade(datesMapper, queueElement));
            }

            if ( deadlineDate.isBefore(queueElement.getEndDate()) ) {
                cssClass += " unmet-deadline ";
            }
        }

        result.setClass(cssClass);
        result.appendChild(generateCompletionShade(datesMapper, queueElement));
        Component progressBar = generateProgressBar(datesMapper, queueElement);

        if ( progressBar != null ) {
            result.appendChild(progressBar);
        }

        return result;
    }
コード例 #9
0
 public void visit(Task task) {
   TaskStatusEnum status = task.getTaskStatus();
   Integer currentValue = getTaskStatusData().get(status);
   taskStatusData.put(status, Integer.valueOf(currentValue.intValue() + 1));
 }