/** * @see org.projectforge.business.gantt.GanttTask#getCalculatedStartDate() */ @Override public Date getCalculatedStartDate() { if (startDateCalculated == false) { calculatedStartDate = GanttUtils.getCalculatedStartDate(this); startDateCalculated = true; } return this.calculatedStartDate; }
/** * Please note: If the start date is after the start date of the earliest task of any child then the start date of this child is returned. * Otherwise the set start date or if not set the calculated start date is returned. * @param node */ public static Date getCalculatedStartDate(final GanttTask node) { final Date start = getCalculatedStartDate(node, new HashSet<Serializable>(), new HashSet<Serializable>()); return start; }
private static Date getPredecessorRelDate(final GanttRelationType relationType, final GanttTask predecessor, final Set<Serializable> startDateSet, final Set<Serializable> endDateSet) { if (relationType == GanttRelationType.START_START || relationType == GanttRelationType.START_FINISH) { final Date calculatedStartDate = getCalculatedStartDate(predecessor, startDateSet, endDateSet); return calculatedStartDate; } else { final Date calculatedEndDate = getCalculatedEndDate(predecessor, startDateSet, endDateSet); return calculatedEndDate; } }
ObjectInfo(final GanttTask node, final int row) { this.fromDate = GanttUtils.getCalculatedStartDate(node); this.toDate = GanttUtils.getCalculatedEndDate(node); if (fromDate != null) { this.x1 = getXValue(fromDate); } else { x1 = 0; } if (toDate != null) { this.x2 = getXValue(toDate); } else { x2 = 0; } this.row = row; this.y = style.getYScale() * row; }
final Collection<GanttTask> allVisibleGanttObjects = getAllVisibleGanttObjects(new ArrayList<GanttTask>(), rootNode); for (final GanttTask node : allVisibleGanttObjects) { Date periodStart = GanttUtils.getCalculatedStartDate(node); Date periodEnd = GanttUtils.getCalculatedEndDate(node); if (periodEnd == null) {
private GanttTask getExternalGanttObject(final TaskDO task) { final GanttTask ganttObject = convertToGanttObject(task); if (ganttObject.getStartDate() == null) { ganttObject.setStartDate(GanttUtils.getCalculatedStartDate(ganttObject)); } if (ganttObject.getEndDate() == null) { ganttObject.setEndDate(GanttUtils.getCalculatedEndDate(ganttObject)); } // Remove any existing predecessor chain: ganttObject.setPredecessor(null); return ganttObject; }
@Test public void circularReferences() { final GanttTaskImpl a1 = createActivity(1).setTitle("a1"); final GanttTaskImpl a1_1 = createActivity(10).setTitle("a1_1"); a1_1.setPredecessor(a1); a1.addChild(a1_1); log.error("The two following error messages about circular reference detection are OK and part of this test."); assertNull(GanttUtils.getCalculatedStartDate(a1)); assertNull(GanttUtils.getCalculatedEndDate(a1)); assertNull(GanttUtils.getCalculatedStartDate(a1_1)); assertNull(GanttUtils.getCalculatedEndDate(a1_1)); }
final Date date = getCalculatedStartDate(child, startDateSet, endDateSet); if (startDate == null) { startDate = date;
final Date calculatedStartDate = getCalculatedStartDate(node, startDateSet, endDateSet); if (calculatedStartDate != null) { endDate = calculateDate(calculatedStartDate, durationDays);
assertDate(2010, Calendar.FEBRUARY, 19, GanttUtils.getCalculatedStartDate(activity2)); activity2.setPredecessorOffset(2); assertDate(2010, Calendar.FEBRUARY, 19, GanttUtils.getCalculatedStartDate(activity2)); activity2.recalculate(); assertDate(2010, Calendar.FEBRUARY, 23, GanttUtils.getCalculatedStartDate(activity2)); a2_2.setPredecessor(a2).setRelationType(GanttRelationType.START_START); a2.addChild(a2_2); assertDate(2010, Calendar.FEBRUARY, 1, GanttUtils.getCalculatedStartDate(a1)); assertDate(2010, Calendar.FEBRUARY, 2, GanttUtils.getCalculatedStartDate(a2)); assertDate(2010, Calendar.FEBRUARY, 2, GanttUtils.getCalculatedStartDate(a2_1)); assertDate(2010, Calendar.FEBRUARY, 2, GanttUtils.getCalculatedStartDate(a2_2));