I've been working on a project using TaskSeriesCollection to draw Gantt chart and found a bug in the implementation. It could not return the correct value to getStartValue() and getEndValue() in case there are some holes in the gantt chart. (A category doesn't have all series.)
Here is the revised code. Hope it is helpful to other people.
public Number getStartValue (int row, int column) {
Number result = null;
TaskSeries series = (TaskSeries) this.data.get(row);
//int tasks = series.getItemCount();
Comparable columnKey = (Comparable) this.keys.get(column);
for (Iterator i = series.getTasks().iterator(); i.hasNext();) {
Task task = (Task) i.next();
if (task.getDescription().equals(columnKey)) {
return new Long(task.getDuration().getStart().getTime());
}
}
return null;
/*
if (column < tasks) {
Task task = series.get(column);
result = new Long(task.getDuration().getStart().getTime());
}
return result;
*/
}
The getEndValue() is similar.
If there is a better solution please point me out.
Cheers,
Hongbing