Package org.jfree.data.gantt
Class XYTaskDataset
java.lang.Object
org.jfree.data.general.AbstractDataset
org.jfree.data.general.AbstractSeriesDataset
org.jfree.data.xy.AbstractXYDataset
org.jfree.data.gantt.XYTaskDataset
- All Implemented Interfaces:
ObjectInputValidation
,Serializable
,Cloneable
,EventListener
,Dataset
,DatasetChangeListener
,SeriesChangeListener
,SeriesDataset
,IntervalXYDataset
,XYDataset
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.- See Also:
-
Constructor Summary
ConstructorDescriptionCreates a new dataset based on the supplied collection of tasks. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Ensures symmetry between super/subclass implementations of equals.clone()
Returns a clone of this dataset.void
datasetChanged
(DatasetChangeEvent event) Receives a change event from the underlying dataset and responds by firing a change event for this dataset.boolean
Tests this dataset for equality with an arbitrary object.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).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).getEndY
(int series, int item) Returns the ending value of the y-interval for an item in the given series.double
getEndYValue
(int series, int item) Returns the ending value of the y-interval for an item in the given series.int
getItemCount
(int series) Returns the number of items (tasks) in the specified series.int
Returns the number of series in the dataset.getSeriesKey
(int series) Returns the name of a series.double
Returns the width of the interval for each series this dataset.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).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).getStartY
(int series, int item) Returns the starting value of the y-interval for an item in the given series.double
getStartYValue
(int series, int item) Returns the starting value of the y-interval for an item in the given series.getTasks()
Returns the underlying task series collection that was supplied to the constructor.getX
(int series, int item) Returns the x-value for the specified series.double
getXValue
(int series, int item) Returns the x-value (as a double primitive) for an item within a series.getY
(int series, int item) Returns the y-value for the specified series/item.double
getYValue
(int series, int item) Returns the y-value (as a double primitive) for an item within a series.int
hashCode()
boolean
Returns a flag that indicates whether or not the dataset is transposed.void
setSeriesWidth
(double w) Sets the series interval width and sends aDatasetChangeEvent
to all registered listeners.void
setTransposed
(boolean transposed) Sets the flag that controls whether or not the dataset is transposed and sends aDatasetChangeEvent
to all registered listeners.Methods inherited from class org.jfree.data.xy.AbstractXYDataset
getDomainOrder
Methods inherited from class org.jfree.data.general.AbstractSeriesDataset
indexOf, seriesChanged
Methods inherited from class org.jfree.data.general.AbstractDataset
addChangeListener, fireDatasetChanged, getGroup, getNotify, hasListener, notifyListeners, removeChangeListener, setGroup, setNotify, validateObject
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jfree.data.general.Dataset
addChangeListener, getGroup, removeChangeListener, setGroup
Methods inherited from interface org.jfree.data.general.SeriesDataset
indexOf
Methods inherited from interface org.jfree.data.xy.XYDataset
getDomainOrder
-
Constructor Details
-
XYTaskDataset
Creates a new dataset based on the supplied collection of tasks.- Parameters:
tasks
- the underlying dataset (null
not permitted).
-
-
Method Details
-
getTasks
Returns the underlying task series collection that was supplied to the constructor.- Returns:
- The underlying collection (never
null
).
-
getSeriesWidth
Returns the width of the interval for each series this dataset.- Returns:
- The width of the series interval.
- See Also:
-
setSeriesWidth
Sets the series interval width and sends aDatasetChangeEvent
to all registered listeners.- Parameters:
w
- the width.- See Also:
-
isTransposed
Returns a flag that indicates whether or not the dataset is transposed. The default isfalse
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 totrue
, the x and y-values are reversed.- Returns:
- The flag.
- See Also:
-
setTransposed
Sets the flag that controls whether or not the dataset is transposed and sends aDatasetChangeEvent
to all registered listeners.- Parameters:
transposed
- the new flag value.- See Also:
-
getSeriesCount
Returns the number of series in the dataset.- Specified by:
getSeriesCount
in interfaceSeriesDataset
- Specified by:
getSeriesCount
in classAbstractSeriesDataset
- Returns:
- The series count.
-
getSeriesKey
Returns the name of a series.- Specified by:
getSeriesKey
in interfaceSeriesDataset
- Specified by:
getSeriesKey
in classAbstractSeriesDataset
- Parameters:
series
- the series index (zero-based).- Returns:
- The name of a series.
-
getItemCount
Returns the number of items (tasks) in the specified series.- Specified by:
getItemCount
in interfaceXYDataset
- Parameters:
series
- the series index (zero-based).- Returns:
- The item count.
-
getXValue
Returns the x-value (as a double primitive) for an item within a series.- Specified by:
getXValue
in interfaceXYDataset
- Overrides:
getXValue
in classAbstractXYDataset
- Parameters:
series
- the series index (zero-based).item
- the item index (zero-based).- Returns:
- The value.
-
getStartXValue
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).- Specified by:
getStartXValue
in interfaceIntervalXYDataset
- Parameters:
series
- the series index.item
- the item (or task) index.- Returns:
- The start date/time.
- See Also:
-
getEndXValue
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).- Specified by:
getEndXValue
in interfaceIntervalXYDataset
- Parameters:
series
- the series index.item
- the item (or task) index.- Returns:
- The end date/time.
- See Also:
-
getX
Returns the x-value for the specified series. -
getStartX
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).- Specified by:
getStartX
in interfaceIntervalXYDataset
- Parameters:
series
- the series index.item
- the item (or task) index.- Returns:
- The start date/time.
-
getEndX
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).- Specified by:
getEndX
in interfaceIntervalXYDataset
- Parameters:
series
- the series index.item
- the item (or task) index.- Returns:
- The end date/time.
-
getYValue
Returns the y-value (as a double primitive) for an item within a series.- Specified by:
getYValue
in interfaceXYDataset
- Overrides:
getYValue
in classAbstractXYDataset
- Parameters:
series
- the series index (zero-based).item
- the item index (zero-based).- Returns:
- The value.
-
getStartYValue
Returns the starting value of the y-interval for an item in the given series.- Specified by:
getStartYValue
in interfaceIntervalXYDataset
- Parameters:
series
- the series index.item
- the item (or task) index.- Returns:
- The y-interval start.
- See Also:
-
getEndYValue
Returns the ending value of the y-interval for an item in the given series.- Specified by:
getEndYValue
in interfaceIntervalXYDataset
- Parameters:
series
- the series index.item
- the item (or task) index.- Returns:
- The y-interval end.
- See Also:
-
getY
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). -
getStartY
Returns the starting value of the y-interval for an item in the given series.- Specified by:
getStartY
in interfaceIntervalXYDataset
- Parameters:
series
- the series index.item
- the item (or task) index.- Returns:
- The y-interval start.
-
getEndY
Returns the ending value of the y-interval for an item in the given series.- Specified by:
getEndY
in interfaceIntervalXYDataset
- Parameters:
series
- the series index.item
- the item (or task) index.- Returns:
- The y-interval end.
-
datasetChanged
Receives a change event from the underlying dataset and responds by firing a change event for this dataset.- Specified by:
datasetChanged
in interfaceDatasetChangeListener
- Parameters:
event
- the event.
-
equals
Tests this dataset for equality with an arbitrary object.- Overrides:
equals
in classAbstractDataset
- Parameters:
obj
- the object (null
permitted).- Returns:
- A boolean.
-
canEqual
Ensures symmetry between super/subclass implementations of equals. For more detail, see http://jqno.nl/equalsverifier/manual/inheritance.- Overrides:
canEqual
in classAbstractDataset
- Parameters:
other
- Object- Returns:
- true ONLY if the parameter is THIS class type
-
hashCode
- Overrides:
hashCode
in classAbstractDataset
-
clone
Returns a clone of this dataset.- Overrides:
clone
in classAbstractDataset
- Returns:
- A clone of this dataset.
- Throws:
CloneNotSupportedException
- if there is a problem cloning.
-