Package org.jfree.data.gantt
Class SlidingGanttCategoryDataset
- java.lang.Object
-
- org.jfree.data.general.AbstractDataset
-
- org.jfree.data.gantt.SlidingGanttCategoryDataset
-
- All Implemented Interfaces:
java.io.ObjectInputValidation
,java.io.Serializable
,java.lang.Cloneable
,CategoryDataset
,IntervalCategoryDataset
,GanttCategoryDataset
,Dataset
,KeyedValues2D
,Values2D
public class SlidingGanttCategoryDataset extends AbstractDataset implements GanttCategoryDataset
AGanttCategoryDataset
implementation that presents a subset of the categories in an underlying dataset. The index of the first "visible" category can be modified, which provides a means of "sliding" through the categories in the underlying dataset.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private int
firstCategoryIndex
The index of the first category to present.private int
maximumCategoryCount
The maximum number of categories to present.private GanttCategoryDataset
underlying
The underlying dataset.
-
Constructor Summary
Constructors Constructor Description SlidingGanttCategoryDataset(GanttCategoryDataset underlying, int firstColumn, int maxColumns)
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canEqual(java.lang.Object other)
Ensures symmetry between super/subclass implementations of equals.java.lang.Object
clone()
Returns an independent copy of the dataset.boolean
equals(java.lang.Object obj)
Tests thisSlidingGanttCategoryDataset
instance for equality with an arbitrary object.int
getColumnCount()
Returns the number of columns in the table.int
getColumnIndex(java.lang.Comparable key)
Returns the index for the specified column key.java.lang.Comparable
getColumnKey(int column)
Returns the column key for a given index.java.util.List
getColumnKeys()
Returns the column keys.java.lang.Number
getEndValue(int series, int category)
Returns the end value for the interval for a given series and category.java.lang.Number
getEndValue(int row, int column, int subinterval)
Returns the end value of a sub-interval for a given item.java.lang.Number
getEndValue(java.lang.Comparable rowKey, java.lang.Comparable columnKey)
Returns the end value for the interval for a given series and category.java.lang.Number
getEndValue(java.lang.Comparable rowKey, java.lang.Comparable columnKey, int subinterval)
Returns the end value of a sub-interval for a given item.int
getFirstCategoryIndex()
Returns the index of the first visible category.int
getMaximumCategoryCount()
Returns the maximum category count.java.lang.Number
getPercentComplete(int series, int category)
Returns the percent complete for a given item.java.lang.Number
getPercentComplete(int row, int column, int subinterval)
Returns the percentage complete value of a sub-interval for a given item.java.lang.Number
getPercentComplete(java.lang.Comparable rowKey, java.lang.Comparable columnKey)
Returns the percent complete for a given item.java.lang.Number
getPercentComplete(java.lang.Comparable rowKey, java.lang.Comparable columnKey, int subinterval)
Returns the percentage complete value of a sub-interval for a given item.int
getRowCount()
Returns the number of rows in the table.int
getRowIndex(java.lang.Comparable key)
Returns the row index for a given key.java.lang.Comparable
getRowKey(int row)
Returns the row key for a given index.java.util.List
getRowKeys()
Returns the row keys.java.lang.Number
getStartValue(int row, int column)
Returns the start value for the interval for a given series and category.java.lang.Number
getStartValue(int row, int column, int subinterval)
Returns the start value of a sub-interval for a given item.java.lang.Number
getStartValue(java.lang.Comparable rowKey, java.lang.Comparable columnKey)
Returns the start value for the interval for a given series and category.java.lang.Number
getStartValue(java.lang.Comparable rowKey, java.lang.Comparable columnKey, int subinterval)
Returns the start value of a sub-interval for a given item.int
getSubIntervalCount(int row, int column)
Returns the number of sub-intervals for a given item.int
getSubIntervalCount(java.lang.Comparable rowKey, java.lang.Comparable columnKey)
Returns the number of sub-intervals for a given item.GanttCategoryDataset
getUnderlyingDataset()
Returns the underlying dataset that was supplied to the constructor.java.lang.Number
getValue(int row, int column)
Returns a value from the table.java.lang.Number
getValue(java.lang.Comparable rowKey, java.lang.Comparable columnKey)
Returns the value for a pair of keys.int
hashCode()
private int
lastCategoryIndex()
Returns the index of the last column for this dataset, or -1.void
setFirstCategoryIndex(int first)
Sets the index of the first category that should be used from the underlying dataset, and sends aDatasetChangeEvent
to all registered listeners.void
setMaximumCategoryCount(int max)
Sets the maximum category count and sends aDatasetChangeEvent
to all registered listeners.-
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
-
-
-
-
Field Detail
-
underlying
private GanttCategoryDataset underlying
The underlying dataset.
-
firstCategoryIndex
private int firstCategoryIndex
The index of the first category to present.
-
maximumCategoryCount
private int maximumCategoryCount
The maximum number of categories to present.
-
-
Constructor Detail
-
SlidingGanttCategoryDataset
public SlidingGanttCategoryDataset(GanttCategoryDataset underlying, int firstColumn, int maxColumns)
Creates a new instance.- Parameters:
underlying
- the underlying dataset (null
not permitted).firstColumn
- the index of the first visible column from the underlying dataset.maxColumns
- the maximumColumnCount.
-
-
Method Detail
-
getUnderlyingDataset
public GanttCategoryDataset getUnderlyingDataset()
Returns the underlying dataset that was supplied to the constructor.- Returns:
- The underlying dataset (never
null
).
-
getFirstCategoryIndex
public int getFirstCategoryIndex()
Returns the index of the first visible category.- Returns:
- The index.
- See Also:
setFirstCategoryIndex(int)
-
setFirstCategoryIndex
public void setFirstCategoryIndex(int first)
Sets the index of the first category that should be used from the underlying dataset, and sends aDatasetChangeEvent
to all registered listeners.- Parameters:
first
- the index.- See Also:
getFirstCategoryIndex()
-
getMaximumCategoryCount
public int getMaximumCategoryCount()
Returns the maximum category count.- Returns:
- The maximum category count.
- See Also:
setMaximumCategoryCount(int)
-
setMaximumCategoryCount
public void setMaximumCategoryCount(int max)
Sets the maximum category count and sends aDatasetChangeEvent
to all registered listeners.- Parameters:
max
- the maximum.- See Also:
getMaximumCategoryCount()
-
lastCategoryIndex
private int lastCategoryIndex()
Returns the index of the last column for this dataset, or -1.- Returns:
- The index.
-
getColumnIndex
public int getColumnIndex(java.lang.Comparable key)
Returns the index for the specified column key.- Specified by:
getColumnIndex
in interfaceKeyedValues2D
- Parameters:
key
- the key.- Returns:
- The column index, or -1 if the key is not recognised.
-
getColumnKey
public java.lang.Comparable getColumnKey(int column)
Returns the column key for a given index.- Specified by:
getColumnKey
in interfaceKeyedValues2D
- Parameters:
column
- the column index (zero-based).- Returns:
- The column key.
- Throws:
java.lang.IndexOutOfBoundsException
- ifrow
is out of bounds.
-
getColumnKeys
public java.util.List getColumnKeys()
Returns the column keys.- Specified by:
getColumnKeys
in interfaceKeyedValues2D
- Returns:
- The keys.
- See Also:
getColumnKey(int)
-
getRowIndex
public int getRowIndex(java.lang.Comparable key)
Returns the row index for a given key.- Specified by:
getRowIndex
in interfaceKeyedValues2D
- Parameters:
key
- the row key.- Returns:
- The row index, or
-1
if the key is unrecognised.
-
getRowKey
public java.lang.Comparable getRowKey(int row)
Returns the row key for a given index.- Specified by:
getRowKey
in interfaceKeyedValues2D
- Parameters:
row
- the row index (zero-based).- Returns:
- The row key.
- Throws:
java.lang.IndexOutOfBoundsException
- ifrow
is out of bounds.
-
getRowKeys
public java.util.List getRowKeys()
Returns the row keys.- Specified by:
getRowKeys
in interfaceKeyedValues2D
- Returns:
- The keys.
-
getValue
public java.lang.Number getValue(java.lang.Comparable rowKey, java.lang.Comparable columnKey)
Returns the value for a pair of keys.- Specified by:
getValue
in interfaceKeyedValues2D
- Parameters:
rowKey
- the row key (null
not permitted).columnKey
- the column key (null
not permitted).- Returns:
- The value (possibly
null
). - Throws:
UnknownKeyException
- if either key is not defined in the dataset.
-
getColumnCount
public int getColumnCount()
Returns the number of columns in the table.- Specified by:
getColumnCount
in interfaceValues2D
- Returns:
- The column count.
-
getRowCount
public int getRowCount()
Returns the number of rows in the table.- Specified by:
getRowCount
in interfaceValues2D
- Returns:
- The row count.
-
getValue
public java.lang.Number getValue(int row, int column)
Returns a value from the table.
-
getPercentComplete
public java.lang.Number getPercentComplete(java.lang.Comparable rowKey, java.lang.Comparable columnKey)
Returns the percent complete for a given item.- Specified by:
getPercentComplete
in interfaceGanttCategoryDataset
- Parameters:
rowKey
- the row key.columnKey
- the column key.- Returns:
- The percent complete.
- See Also:
GanttCategoryDataset.getPercentComplete(int, int)
-
getPercentComplete
public java.lang.Number getPercentComplete(java.lang.Comparable rowKey, java.lang.Comparable columnKey, int subinterval)
Returns the percentage complete value of a sub-interval for a given item.- Specified by:
getPercentComplete
in interfaceGanttCategoryDataset
- Parameters:
rowKey
- the row key.columnKey
- the column key.subinterval
- the sub-interval.- Returns:
- The percent complete value (possibly
null
). - See Also:
getPercentComplete(int, int, int)
-
getEndValue
public java.lang.Number getEndValue(java.lang.Comparable rowKey, java.lang.Comparable columnKey, int subinterval)
Returns the end value of a sub-interval for a given item.- Specified by:
getEndValue
in interfaceGanttCategoryDataset
- Parameters:
rowKey
- the row key.columnKey
- the column key.subinterval
- the sub-interval.- Returns:
- The end value (possibly
null
). - See Also:
getStartValue(Comparable, Comparable, int)
-
getEndValue
public java.lang.Number getEndValue(int row, int column, int subinterval)
Returns the end value of a sub-interval for a given item.- Specified by:
getEndValue
in interfaceGanttCategoryDataset
- Parameters:
row
- the row index (zero-based).column
- the column index (zero-based).subinterval
- the sub-interval.- Returns:
- The end value (possibly
null
). - See Also:
getStartValue(int, int, int)
-
getPercentComplete
public java.lang.Number getPercentComplete(int series, int category)
Returns the percent complete for a given item.- Specified by:
getPercentComplete
in interfaceGanttCategoryDataset
- Parameters:
series
- the row index (zero-based).category
- the column index (zero-based).- Returns:
- The percent complete.
- See Also:
GanttCategoryDataset.getPercentComplete(Comparable, Comparable)
-
getPercentComplete
public java.lang.Number getPercentComplete(int row, int column, int subinterval)
Returns the percentage complete value of a sub-interval for a given item.- Specified by:
getPercentComplete
in interfaceGanttCategoryDataset
- Parameters:
row
- the row index (zero-based).column
- the column index (zero-based).subinterval
- the sub-interval.- Returns:
- The percent complete value (possibly
null
). - See Also:
getPercentComplete(Comparable, Comparable, int)
-
getStartValue
public java.lang.Number getStartValue(java.lang.Comparable rowKey, java.lang.Comparable columnKey, int subinterval)
Returns the start value of a sub-interval for a given item.- Specified by:
getStartValue
in interfaceGanttCategoryDataset
- Parameters:
rowKey
- the row key.columnKey
- the column key.subinterval
- the sub-interval.- Returns:
- The start value (possibly
null
). - See Also:
getEndValue(Comparable, Comparable, int)
-
getStartValue
public java.lang.Number getStartValue(int row, int column, int subinterval)
Returns the start value of a sub-interval for a given item.- Specified by:
getStartValue
in interfaceGanttCategoryDataset
- Parameters:
row
- the row index (zero-based).column
- the column index (zero-based).subinterval
- the sub-interval index (zero-based).- Returns:
- The start value (possibly
null
). - See Also:
getEndValue(int, int, int)
-
getSubIntervalCount
public int getSubIntervalCount(java.lang.Comparable rowKey, java.lang.Comparable columnKey)
Returns the number of sub-intervals for a given item.- Specified by:
getSubIntervalCount
in interfaceGanttCategoryDataset
- Parameters:
rowKey
- the row key.columnKey
- the column key.- Returns:
- The sub-interval count.
- See Also:
getSubIntervalCount(int, int)
-
getSubIntervalCount
public int getSubIntervalCount(int row, int column)
Returns the number of sub-intervals for a given item.- Specified by:
getSubIntervalCount
in interfaceGanttCategoryDataset
- Parameters:
row
- the row index (zero-based).column
- the column index (zero-based).- Returns:
- The sub-interval count.
- See Also:
getSubIntervalCount(Comparable, Comparable)
-
getStartValue
public java.lang.Number getStartValue(java.lang.Comparable rowKey, java.lang.Comparable columnKey)
Returns the start value for the interval for a given series and category.- Specified by:
getStartValue
in interfaceIntervalCategoryDataset
- Parameters:
rowKey
- the series key.columnKey
- the category key.- Returns:
- The start value (possibly
null
). - See Also:
getEndValue(Comparable, Comparable)
-
getStartValue
public java.lang.Number getStartValue(int row, int column)
Returns the start value for the interval for a given series and category.- Specified by:
getStartValue
in interfaceIntervalCategoryDataset
- Parameters:
row
- the series (zero-based index).column
- the category (zero-based index).- Returns:
- The start value (possibly
null
). - See Also:
getEndValue(int, int)
-
getEndValue
public java.lang.Number getEndValue(java.lang.Comparable rowKey, java.lang.Comparable columnKey)
Returns the end value for the interval for a given series and category.- Specified by:
getEndValue
in interfaceIntervalCategoryDataset
- Parameters:
rowKey
- the series key.columnKey
- the category key.- Returns:
- The end value (possibly
null
). - See Also:
getStartValue(Comparable, Comparable)
-
getEndValue
public java.lang.Number getEndValue(int series, int category)
Returns the end value for the interval for a given series and category.- Specified by:
getEndValue
in interfaceIntervalCategoryDataset
- Parameters:
series
- the series (zero-based index).category
- the category (zero-based index).- Returns:
- The end value (possibly
null
). - See Also:
IntervalCategoryDataset.getStartValue(int, int)
-
equals
public boolean equals(java.lang.Object obj)
Tests thisSlidingGanttCategoryDataset
instance for equality with an arbitrary object.- Overrides:
equals
in classAbstractDataset
- Parameters:
obj
- the object (null
permitted).- Returns:
- A boolean.
-
canEqual
public boolean canEqual(java.lang.Object other)
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
public int hashCode()
- Overrides:
hashCode
in classAbstractDataset
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
Returns an independent copy of the dataset. Note that:- the underlying dataset is only cloned if it implements the
PublicCloneable
interface; - the listeners registered with this dataset are not carried over to the cloned dataset.
- Overrides:
clone
in classAbstractDataset
- Returns:
- An independent copy of the dataset.
- Throws:
java.lang.CloneNotSupportedException
- if the dataset cannot be cloned for any reason.
- the underlying dataset is only cloned if it implements the
-
-