org.jfree.data.gantt

Class XYTaskDataset

public class XYTaskDataset extends AbstractXYDataset implements IntervalXYDataset, DatasetChangeListener

A dataset implementation that wraps a TaskSeriesCollection and presents it as an IntervalXYDataset, allowing a set of tasks to be displayed using an XYBarRenderer (and usually a SymbolAxis). This is a very specialised dataset implementation ---before using it, you should take some time to understand the use-cases that it is designed for.

Since: 1.0.11

Constructor Summary
XYTaskDataset(TaskSeriesCollection tasks)
Creates a new dataset based on the supplied collection of tasks.
Method Summary
Objectclone()
Returns a clone of this dataset.
voiddatasetChanged(DatasetChangeEvent event)
Receives a change event from the underlying dataset and responds by firing a change event for this dataset.
booleanequals(Object obj)
Tests this dataset for equality with an arbitrary object.
NumbergetEndX(int series, int item)
Returns the ending date/time for the specified item (task) in the given series, measured in milliseconds since 1-Jan-1970 (as in java.util.Date).
doublegetEndXValue(int series, int item)
Returns the ending date/time for the specified item (task) in the given series, measured in milliseconds since 1-Jan-1970 (as in java.util.Date).
NumbergetEndY(int series, int item)
Returns the ending value of the y-interval for an item in the given series.
doublegetEndYValue(int series, int item)
Returns the ending value of the y-interval for an item in the given series.
intgetItemCount(int series)
Returns the number of items (tasks) in the specified series.
intgetSeriesCount()
Returns the number of series in the dataset.
ComparablegetSeriesKey(int series)
Returns the name of a series.
doublegetSeriesWidth()
Returns the width of the interval for each series this dataset.
NumbergetStartX(int series, int item)
Returns the starting date/time for the specified item (task) in the given series, measured in milliseconds since 1-Jan-1970 (as in java.util.Date).
doublegetStartXValue(int series, int item)
Returns the starting date/time for the specified item (task) in the given series, measured in milliseconds since 1-Jan-1970 (as in java.util.Date).
NumbergetStartY(int series, int item)
Returns the starting value of the y-interval for an item in the given series.
doublegetStartYValue(int series, int item)
Returns the starting value of the y-interval for an item in the given series.
TaskSeriesCollectiongetTasks()
Returns the underlying task series collection that was supplied to the constructor.
NumbergetX(int series, int item)
Returns the x-value for the specified series.
doublegetXValue(int series, int item)
Returns the x-value (as a double primitive) for an item within a series.
NumbergetY(int series, int item)
Returns the y-value for the specified series/item.
doublegetYValue(int series, int item)
Returns the y-value (as a double primitive) for an item within a series.
booleanisTransposed()
Returns a flag that indicates whether or not the dataset is transposed.
voidsetSeriesWidth(double w)
Sets the series interval width and sends a DatasetChangeEvent to all registered listeners.
voidsetTransposed(boolean transposed)
Sets the flag that controls whether or not the dataset is transposed and sends a DatasetChangeEvent to all registered listeners.

Constructor Detail

XYTaskDataset

public XYTaskDataset(TaskSeriesCollection tasks)
Creates a new dataset based on the supplied collection of tasks.

Parameters: tasks the underlying dataset (null not permitted).

Method Detail

clone

public Object clone()
Returns a clone of this dataset.

Returns: A clone of this dataset.

Throws: CloneNotSupportedException if there is a problem cloning.

datasetChanged

public void datasetChanged(DatasetChangeEvent event)
Receives a change event from the underlying dataset and responds by firing a change event for this dataset.

Parameters: event the event.

equals

public boolean equals(Object obj)
Tests this dataset for equality with an arbitrary object.

Parameters: obj the object (null permitted).

Returns: A boolean.

getEndX

public Number getEndX(int series, int item)
Returns the ending date/time for the specified item (task) in the given series, measured in milliseconds since 1-Jan-1970 (as in java.util.Date).

Parameters: series the series index. item the item (or task) index.

Returns: The end date/time.

getEndXValue

public double getEndXValue(int series, int item)
Returns the ending date/time for the specified item (task) in the given series, measured in milliseconds since 1-Jan-1970 (as in java.util.Date).

Parameters: series the series index. item the item (or task) index.

Returns: The end date/time.

getEndY

public Number getEndY(int series, int item)
Returns the ending value of the y-interval for an item in the given series.

Parameters: series the series index. item the item (or task) index.

Returns: The y-interval end.

getEndYValue

public double getEndYValue(int series, int item)
Returns the ending value of the y-interval for an item in the given series.

Parameters: series the series index. item the item (or task) index.

Returns: The y-interval end.

getItemCount

public int getItemCount(int series)
Returns the number of items (tasks) in the specified series.

Parameters: series the series index (zero-based).

Returns: The item count.

getSeriesCount

public int getSeriesCount()
Returns the number of series in the dataset.

Returns: The series count.

getSeriesKey

public Comparable getSeriesKey(int series)
Returns the name of a series.

Parameters: series the series index (zero-based).

Returns: The name of a series.

getSeriesWidth

public double getSeriesWidth()
Returns the width of the interval for each series this dataset.

Returns: The width of the series interval.

See Also: XYTaskDataset

getStartX

public Number getStartX(int series, int item)
Returns the starting date/time for the specified item (task) in the given series, measured in milliseconds since 1-Jan-1970 (as in java.util.Date).

Parameters: series the series index. item the item (or task) index.

Returns: The start date/time.

getStartXValue

public double getStartXValue(int series, int item)
Returns the starting date/time for the specified item (task) in the given series, measured in milliseconds since 1-Jan-1970 (as in java.util.Date).

Parameters: series the series index. item the item (or task) index.

Returns: The start date/time.

getStartY

public Number getStartY(int series, int item)
Returns the starting value of the y-interval for an item in the given series.

Parameters: series the series index. item the item (or task) index.

Returns: The y-interval start.

getStartYValue

public double getStartYValue(int series, int item)
Returns the starting value of the y-interval for an item in the given series.

Parameters: series the series index. item the item (or task) index.

Returns: The y-interval start.

getTasks

public TaskSeriesCollection getTasks()
Returns the underlying task series collection that was supplied to the constructor.

Returns: The underlying collection (never null).

getX

public Number getX(int series, int item)
Returns the x-value for the specified series.

Parameters: series the series index. item the item index.

Returns: The x-value (in milliseconds).

getXValue

public double getXValue(int series, int item)
Returns the x-value (as a double primitive) for an item within a series.

Parameters: series the series index (zero-based). item the item index (zero-based).

Returns: The value.

getY

public Number getY(int series, int item)
Returns the y-value for the specified series/item. In this implementation, we return the series index as the y-value (this means that every item in the series has a constant integer value).

Parameters: series the series index. item the item index.

Returns: The y-value.

getYValue

public double getYValue(int series, int item)
Returns the y-value (as a double primitive) for an item within a series.

Parameters: series the series index (zero-based). item the item index (zero-based).

Returns: The value.

isTransposed

public boolean isTransposed()
Returns a flag that indicates whether or not the dataset is transposed. The default is false which means the x-values are integers corresponding to the series indices, and the y-values are millisecond values corresponding to the task date/time intervals. If the flag is set to true, the x and y-values are reversed.

Returns: The flag.

See Also: XYTaskDataset

setSeriesWidth

public void setSeriesWidth(double w)
Sets the series interval width and sends a DatasetChangeEvent to all registered listeners.

Parameters: w the width.

See Also: getSeriesWidth

setTransposed

public void setTransposed(boolean transposed)
Sets the flag that controls whether or not the dataset is transposed and sends a DatasetChangeEvent to all registered listeners.

Parameters: transposed the new flag value.

See Also: isTransposed

Copyright © 2000-2009 by Object Refinery Limited. All Rights Reserved.