/** * */ public Dataset getCustomDataset() { TaskSeriesCollection dataset = new TaskSeriesCollection(); if (seriesNames != null) { for(int i = 0; i < seriesNames.size(); i++) { Comparable seriesName = (Comparable)seriesNames.get(i); dataset.add((TaskSeries)seriesMap.get(seriesName)); } } return dataset; }
/** * Returns a series from the collection. * * @param key the series key ({@code null} not permitted). * * @return The series. * * @since 1.0.1 */ public TaskSeries getSeries(Comparable key) { if (key == null) { throw new NullPointerException("Null 'key' argument."); } TaskSeries result = null; int index = getRowIndex(key); if (index >= 0) { result = getSeries(index); } return result; }
/** * Creates a new dataset based on the supplied collection of tasks. * * @param tasks the underlying dataset (<code>null</code> not permitted). */ public XYTaskDataset(TaskSeriesCollection tasks) { if (tasks == null) { throw new IllegalArgumentException("Null 'tasks' argument."); } this.underlying = tasks; this.seriesWidth = 0.8; this.underlying.addChangeListener(this); }
/** * Called when a series belonging to the dataset changes. * * @param event information about the change. */ public void seriesChanged(SeriesChangeEvent event) { refreshKeys(); fireDatasetChanged(); }
/** * Returns the start value for a task. * * @param row the row index (zero-based). * @param column the column index (zero-based). * * @return The start value. */ @Override public Number getStartValue(int row, int column) { Comparable rowKey = getRowKey(row); Comparable columnKey = getColumnKey(column); return getStartValue(rowKey, columnKey); }
/** * Returns the number of sub-intervals for a given item. * * @param row the row index (zero-based). * @param column the column index (zero-based). * * @return The sub-interval count. */ @Override public int getSubIntervalCount(int row, int column) { Comparable rowKey = getRowKey(row); Comparable columnKey = getColumnKey(column); return getSubIntervalCount(rowKey, columnKey); }
/** * Returns the number of items (tasks) in the specified series. * * @param series the series index (zero-based). * * @return The item count. */ @Override public int getItemCount(int series) { return this.underlying.getSeries(series).getItemCount(); }
/** * Returns the percent complete for a given item. * * @param row the row index (zero-based). * @param column the column index (zero-based). * * @return The percent complete (possibly <code>null</code>). */ public Number getPercentComplete(int row, int column) { Comparable rowKey = getRowKey(row); Comparable columnKey = getColumnKey(column); return getPercentComplete(rowKey, columnKey); }
/** * Returns the end value for a task. * * @param row the row index (zero-based). * @param column the column index (zero-based). * * @return The end value. */ @Override public Number getEndValue(int row, int column) { Comparable rowKey = getRowKey(row); Comparable columnKey = getColumnKey(column); return getEndValue(rowKey, columnKey); }
IntervalCategoryDataset dataset = new TaskSeriesCollection(); chartData.processData(dataset); chart = ConfluenceChartFactory.createGanttChart(title, xLabel, yLabel, dataset, legend, tooltips, urls);
/** * Removes a series from the collection and sends * a {@link org.jfree.data.general.DatasetChangeEvent} * to all registered listeners. * * @param series the series (zero based index). */ public void remove(int series) { if ((series < 0) || (series >= getSeriesCount())) { throw new IllegalArgumentException( "TaskSeriesCollection.remove(): index outside valid range."); } // fetch the series, remove the change listener, then remove the series. TaskSeries ts = (TaskSeries) this.data.get(series); ts.removeChangeListener(this); this.data.remove(series); fireDatasetChanged(); }
/** * Removes all the series from the collection and sends * a {@link org.jfree.data.general.DatasetChangeEvent} * to all registered listeners. */ public void removeAll() { // deregister the collection as a change listener to each series in // the collection. Iterator iterator = this.data.iterator(); while (iterator.hasNext()) { TaskSeries series = (TaskSeries) iterator.next(); series.removeChangeListener(this); } // remove all the series from the collection and notify listeners. this.data.clear(); fireDatasetChanged(); }
/** * Returns a clone of this dataset. * * @return A clone of this dataset. * * @throws CloneNotSupportedException if there is a problem cloning. */ public Object clone() throws CloneNotSupportedException { XYTaskDataset clone = (XYTaskDataset) super.clone(); clone.underlying = (TaskSeriesCollection) this.underlying.clone(); return clone; }
/** * Tests this dataset for equality with an arbitrary object. * * @param obj the object (<code>null</code> permitted). * * @return A boolean. */ public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof XYTaskDataset)) { return false; } XYTaskDataset that = (XYTaskDataset) obj; if (this.seriesWidth != that.seriesWidth) { return false; } if (this.transposed != that.transposed) { return false; } if (!this.underlying.equals(that.underlying)) { return false; } return true; }
/** * Returns the number of items (tasks) in the specified series. * * @param series the series index (zero-based). * * @return The item count. */ public int getItemCount(int series) { return this.underlying.getSeries(series).getItemCount(); }
/** * Returns the start value of a sub-interval for a given item. * * @param row the row index (zero-based). * @param column the column index (zero-based). * @param subinterval the sub-interval index (zero-based). * * @return The start value (possibly <code>null</code>). */ public Number getStartValue(int row, int column, int subinterval) { Comparable rowKey = getRowKey(row); Comparable columnKey = getColumnKey(column); return getStartValue(rowKey, columnKey, subinterval); }
/** * Returns the percent complete for a given item. * * @param row the row index (zero-based). * @param column the column index (zero-based). * * @return The percent complete (possibly {@code null}). */ @Override public Number getPercentComplete(int row, int column) { Comparable rowKey = getRowKey(row); Comparable columnKey = getColumnKey(column); return getPercentComplete(rowKey, columnKey); }
/** * Returns the end value for a task. * * @param row the row index (zero-based). * @param column the column index (zero-based). * * @return The end value. */ public Number getEndValue(int row, int column) { Comparable rowKey = getRowKey(row); Comparable columnKey = getColumnKey(column); return getEndValue(rowKey, columnKey); }
/** * Returns the number of sub-intervals for a given item. * * @param row the row index (zero-based). * @param column the column index (zero-based). * * @return The sub-interval count. */ public int getSubIntervalCount(int row, int column) { Comparable rowKey = getRowKey(row); Comparable columnKey = getColumnKey(column); return getSubIntervalCount(rowKey, columnKey); }