private Task newTask(GanttTask task) { final Task jtask = new Task(task.getDescription(), task.getStart(), task.getEnd()); jtask.setPercentComplete(task.getPercent()); return jtask; }
/** * Returns the task in the series that has the specified description. * * @param description the name ({@code null} not permitted). * * @return The task (possibly {@code null}). */ public Task get(String description) { Task result = null; int count = this.tasks.size(); for (int i = 0; i < count; i++) { Task t = (Task) this.tasks.get(i); if (t.getDescription().equals(description)) { result = t; break; } } return result; }
/** * Returns the end value of a sub-interval for a given item. * * @param rowKey the row key. * @param columnKey the column key. * @param subinterval the subinterval. * * @return The end value (possibly {@code null}). */ @Override public Number getEndValue(Comparable rowKey, Comparable columnKey, int subinterval) { Number result = null; int row = getRowIndex(rowKey); TaskSeries series = (TaskSeries) this.data.get(row); Task task = series.get(columnKey.toString()); if (task != null) { Task sub = task.getSubtask(subinterval); if (sub != null) { TimePeriod duration = sub.getDuration(); result = new Long(duration.getEnd().getTime()); } } return result; }
/** * Returns the percentage complete value of a sub-interval for a given item. * * @param rowKey the row key. * @param columnKey the column key. * @param subinterval the sub-interval. * * @return The percent complete value (possibly {@code null}). */ @Override public Number getPercentComplete(Comparable rowKey, Comparable columnKey, int subinterval) { Number result = null; int row = getRowIndex(rowKey); TaskSeries series = (TaskSeries) this.data.get(row); Task task = series.get(columnKey.toString()); if (task != null) { Task sub = task.getSubtask(subinterval); if (sub != null) { result = sub.getPercentComplete(); } } return result; }
task = new Task(crtGanttSeries.getTask(), crtGanttSeries.getStartDate(), crtGanttSeries.getEndDate()); Task subtask = new Task(crtGanttSeries.getSubtask(), crtGanttSeries.getStartDate(), crtGanttSeries.getEndDate()); if(subtask.getDuration().getStart().before(task.getDuration().getStart())) { task.setDuration(new SimpleTimePeriod(subtask.getDuration().getStart(), task.getDuration().getEnd())); if(subtask.getDuration().getEnd().after(task.getDuration().getEnd())) { task.setDuration(new SimpleTimePeriod(task.getDuration().getStart(), subtask.getDuration().getEnd())); subtask.setPercentComplete(percent.doubleValue()); task.addSubtask(subtask);
new Task(groupDisplayName, createTimePeriod(completeDuration.getFrom(), completeDuration.getTo())); completeDurationTaskSeries.add(completeDurationTask); rootTask = new Task(groupDisplayName, timePeriod); gapsTaskSeries.add(rootTask); } else { final Task task = new Task(groupDisplayName + " gap" + i, timePeriod); rootTask.addSubtask(task); rootTask = new Task(groupDisplayName, timePeriod); overlapsTaskSeries.add(rootTask); } else { final Task task = new Task(groupDisplayName + " overlap" + i, timePeriod); rootTask.addSubtask(task);
private double getItemEndValue(int series, int item) { TaskSeries s = this.underlying.getSeries(series); Task t = s.get(item); TimePeriod duration = t.getDuration(); Date end = duration.getEnd(); return end.getTime(); }
private IntervalCategoryDataset createGanttDataset() { if (sampleGanttDataset == null) { TaskSeriesCollection dataset = new TaskSeriesCollection(); TaskSeries series = new TaskSeries("Scheduled"); series.add(new Task("First", new SimpleTimePeriod(date(1, Calendar.APRIL, 2008), date(5, Calendar.APRIL, 2008)))); series.add(new Task("Second", new SimpleTimePeriod(date(9, Calendar.APRIL, 2008), date(9, Calendar.APRIL, 2008)))); series.add(new Task("Third", new SimpleTimePeriod(date(10, Calendar.APRIL, 2008), date(5, Calendar.MAY, 2008)))); series.add(new Task("Fourth", new SimpleTimePeriod(date(6, Calendar.MAY, 2008), date(30, Calendar.MAY, 2008)))); series.add(new Task("Fifth", new SimpleTimePeriod(date(2, Calendar.JUNE, 2008), date(2, Calendar.JUNE, 2008)))); dataset.add(series); series = new TaskSeries("Actual"); series.add(new Task("First", new SimpleTimePeriod(date(1, Calendar.APRIL, 2008), date(5, Calendar.APRIL, 2008)))); series.add(new Task("Second", new SimpleTimePeriod(date(9, Calendar.APRIL, 2008), date(9, Calendar.APRIL, 2008)))); series.add(new Task("Third", new SimpleTimePeriod(date(10, Calendar.APRIL, 2008), date(15, Calendar.MAY, 2008)))); series.add(new Task("Fourth", new SimpleTimePeriod(date(15, Calendar.MAY, 2008), date(17, Calendar.JUNE, 2008)))); series.add(new Task("Fifth", new SimpleTimePeriod(date(30, Calendar.JUNE, 2008), date(30, Calendar.JUNE, 2008)))); dataset.add(series); sampleGanttDataset = dataset; } return sampleGanttDataset; }
/** * Sets the percentage complete for the task. * * @param percent the percentage. */ public void setPercentComplete(double percent) { setPercentComplete(new Double(percent)); }
private void addSubtask(Task jtask, GanttTask task) { final GanttTask[] tasks = task.getSubtasks(); final int sz = tasks.length; for (int j = 0; j < sz; ++j) { final GanttTask subtask = tasks[j]; final Task jsubtask = newTask(subtask); jtask.addSubtask(jsubtask); addSubtask(jsubtask, subtask); //recursive } }
/** * Returns the percent complete for a given item. * * @param rowKey the row key. * @param columnKey the column key. * * @return The percent complete. */ public Number getPercentComplete(Comparable rowKey, Comparable columnKey) { Number result = null; int row = getRowIndex(rowKey); TaskSeries series = (TaskSeries) this.data.get(row); Task task = series.get(columnKey.toString()); if (task != null) { result = task.getPercentComplete(); } return result; }
/** * Returns the number of sub-intervals for a given item. * * @param rowKey the row key. * @param columnKey the column key. * * @return The sub-interval count. */ @Override public int getSubIntervalCount(Comparable rowKey, Comparable columnKey) { int result = 0; int row = getRowIndex(rowKey); TaskSeries series = (TaskSeries) this.data.get(row); Task task = series.get(columnKey.toString()); if (task != null) { result = task.getSubtaskCount(); } return result; }
private double getItemStartValue(int series, int item) { TaskSeries s = this.underlying.getSeries(series); Task t = s.get(item); TimePeriod duration = t.getDuration(); Date start = duration.getStart(); return start.getTime(); }
/** * Sets the percentage complete for the task. * * @param percent the percentage. */ public void setPercentComplete(double percent) { setPercentComplete(new Double(percent)); }
taskSeries.add(task); } else { mainTask.addSubtask(task);
/** * Returns the percentage complete value of a sub-interval for a given item. * * @param rowKey the row key. * @param columnKey the column key. * @param subinterval the sub-interval. * * @return The percent complete value (possibly <code>null</code>). */ public Number getPercentComplete(Comparable rowKey, Comparable columnKey, int subinterval) { Number result = null; int row = getRowIndex(rowKey); TaskSeries series = (TaskSeries) this.data.get(row); Task task = series.get(columnKey.toString()); if (task != null) { Task sub = task.getSubtask(subinterval); if (sub != null) { result = sub.getPercentComplete(); } } return result; }
/** * Returns the percent complete for a given item. * * @param rowKey the row key. * @param columnKey the column key. * * @return The percent complete. */ @Override public Number getPercentComplete(Comparable rowKey, Comparable columnKey) { Number result = null; int row = getRowIndex(rowKey); TaskSeries series = (TaskSeries) this.data.get(row); Task task = series.get(columnKey.toString()); if (task != null) { result = task.getPercentComplete(); } return result; }
/** * Returns the number of sub-intervals for a given item. * * @param rowKey the row key. * @param columnKey the column key. * * @return The sub-interval count. */ public int getSubIntervalCount(Comparable rowKey, Comparable columnKey) { int result = 0; int row = getRowIndex(rowKey); TaskSeries series = (TaskSeries) this.data.get(row); Task task = series.get(columnKey.toString()); if (task != null) { result = task.getSubtaskCount(); } return result; }
private Task createTask(ColumnIterator iterator) throws ParseException { Task task = null; while (iterator.hasNext()) { String name = getFullText((Element) iterator.next()); String start = (iterator.hasNext()) ? getFullText((Element) iterator.next()) : ""; if (iterator.hasNext()) { String end = getFullText((Element) iterator.next()); if (!start.trim().equals("") && !end.trim().equals("")) { Date startDate = toDate(start); Date endDate = toDate(end); setDateDeltaBase(start); //CONF-35899 : if the input date and anchor date have a big gap , the Confluence will get the hight CPU and OOME if (!isValidDateForTask(startDate, startDate)) { throw new ParseException("Invalid input date at table row '" + name + "'", 0); } if (!isValidDateForTask(startDate, endDate)) { throw new ParseException("Invalid input date at table row '" + name + "'", 0); } task = new Task(name, startDate, endDate); } if (iterator.hasNext()) { String percent = getFullText((Element) iterator.next()); if ((task != null) && !percent.equals("")) { task.setPercentComplete(toNumber(percent).doubleValue()); } } } } return task; }