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.
| Method from org.jfree.data.gantt.SlidingGanttCategoryDataset Detail: |
public Object clone() throws CloneNotSupportedException {
SlidingGanttCategoryDataset clone
= (SlidingGanttCategoryDataset) super.clone();
if (this.underlying instanceof PublicCloneable) {
PublicCloneable pc = (PublicCloneable) this.underlying;
clone.underlying = (GanttCategoryDataset) pc.clone();
}
return clone;
}
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.
|
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof SlidingGanttCategoryDataset)) {
return false;
}
SlidingGanttCategoryDataset that = (SlidingGanttCategoryDataset) obj;
if (this.firstCategoryIndex != that.firstCategoryIndex) {
return false;
}
if (this.maximumCategoryCount != that.maximumCategoryCount) {
return false;
}
if (!this.underlying.equals(that.underlying)) {
return false;
}
return true;
}
Tests this SlidingCategoryDataset for equality with an
arbitrary object. |
public int getColumnCount() {
int last = lastCategoryIndex();
if (last == -1) {
return 0;
}
else {
return Math.max(last - this.firstCategoryIndex + 1, 0);
}
}
Returns the number of columns in the table. |
public int getColumnIndex(Comparable key) {
int index = this.underlying.getColumnIndex(key);
if (index >= this.firstCategoryIndex && index < = lastCategoryIndex()) {
return index - this.firstCategoryIndex;
}
return -1; // we didn't find the key
}
Returns the index for the specified column key. |
public Comparable getColumnKey(int column) {
return this.underlying.getColumnKey(column + this.firstCategoryIndex);
}
Returns the column key for a given index. |
public List getColumnKeys() {
List result = new java.util.ArrayList();
int last = lastCategoryIndex();
for (int i = this.firstCategoryIndex; i < last; i++) {
result.add(this.underlying.getColumnKey(i));
}
return Collections.unmodifiableList(result);
}
|
public Number getEndValue(Comparable rowKey,
Comparable columnKey) {
int r = getRowIndex(rowKey);
int c = getColumnIndex(columnKey);
if (c != -1) {
return this.underlying.getEndValue(r, c + this.firstCategoryIndex);
}
else {
throw new UnknownKeyException("Unknown columnKey: " + columnKey);
}
}
Returns the end value for the interval for a given series and category. |
public Number getEndValue(int series,
int category) {
return this.underlying.getEndValue(series,
category + this.firstCategoryIndex);
}
Returns the end value for the interval for a given series and category. |
public Number getEndValue(Comparable rowKey,
Comparable columnKey,
int subinterval) {
int r = getRowIndex(rowKey);
int c = getColumnIndex(columnKey);
if (c != -1) {
return this.underlying.getEndValue(r,
c + this.firstCategoryIndex, subinterval);
}
else {
throw new UnknownKeyException("Unknown columnKey: " + columnKey);
}
}
Returns the end value of a sub-interval for a given item. |
public Number getEndValue(int row,
int column,
int subinterval) {
return this.underlying.getEndValue(row,
column + this.firstCategoryIndex, subinterval);
}
Returns the end value of a sub-interval for a given item. |
public int getFirstCategoryIndex() {
return this.firstCategoryIndex;
}
Returns the index of the first visible category. |
public int getMaximumCategoryCount() {
return this.maximumCategoryCount;
}
Returns the maximum category count. |
public Number getPercentComplete(Comparable rowKey,
Comparable columnKey) {
int r = getRowIndex(rowKey);
int c = getColumnIndex(columnKey);
if (c != -1) {
return this.underlying.getPercentComplete(r,
c + this.firstCategoryIndex);
}
else {
throw new UnknownKeyException("Unknown columnKey: " + columnKey);
}
}
Returns the percent complete for a given item. |
public Number getPercentComplete(int series,
int category) {
return this.underlying.getPercentComplete(series,
category + this.firstCategoryIndex);
}
Returns the percent complete for a given item. |
public Number getPercentComplete(Comparable rowKey,
Comparable columnKey,
int subinterval) {
int r = getRowIndex(rowKey);
int c = getColumnIndex(columnKey);
if (c != -1) {
return this.underlying.getPercentComplete(r,
c + this.firstCategoryIndex, subinterval);
}
else {
throw new UnknownKeyException("Unknown columnKey: " + columnKey);
}
}
Returns the percentage complete value of a sub-interval for a given item. |
public Number getPercentComplete(int row,
int column,
int subinterval) {
return this.underlying.getPercentComplete(row,
column + this.firstCategoryIndex, subinterval);
}
Returns the percentage complete value of a sub-interval for a given item. |
public int getRowCount() {
return this.underlying.getRowCount();
}
Returns the number of rows in the table. |
public int getRowIndex(Comparable key) {
return this.underlying.getRowIndex(key);
}
Returns the row index for a given key. |
public Comparable getRowKey(int row) {
return this.underlying.getRowKey(row);
}
Returns the row key for a given index. |
public List getRowKeys() {
return this.underlying.getRowKeys();
}
|
public Number getStartValue(Comparable rowKey,
Comparable columnKey) {
int r = getRowIndex(rowKey);
int c = getColumnIndex(columnKey);
if (c != -1) {
return this.underlying.getStartValue(r, c + this.firstCategoryIndex);
}
else {
throw new UnknownKeyException("Unknown columnKey: " + columnKey);
}
}
Returns the start value for the interval for a given series and category. |
public Number getStartValue(int row,
int column) {
return this.underlying.getStartValue(row,
column + this.firstCategoryIndex);
}
Returns the start value for the interval for a given series and category. |
public Number getStartValue(Comparable rowKey,
Comparable columnKey,
int subinterval) {
int r = getRowIndex(rowKey);
int c = getColumnIndex(columnKey);
if (c != -1) {
return this.underlying.getStartValue(r,
c + this.firstCategoryIndex, subinterval);
}
else {
throw new UnknownKeyException("Unknown columnKey: " + columnKey);
}
}
Returns the start value of a sub-interval for a given item. |
public Number getStartValue(int row,
int column,
int subinterval) {
return this.underlying.getStartValue(row,
column + this.firstCategoryIndex, subinterval);
}
Returns the start value of a sub-interval for a given item. |
public int getSubIntervalCount(Comparable rowKey,
Comparable columnKey) {
int r = getRowIndex(rowKey);
int c = getColumnIndex(columnKey);
if (c != -1) {
return this.underlying.getSubIntervalCount(r,
c + this.firstCategoryIndex);
}
else {
throw new UnknownKeyException("Unknown columnKey: " + columnKey);
}
}
Returns the number of sub-intervals for a given item. |
public int getSubIntervalCount(int row,
int column) {
return this.underlying.getSubIntervalCount(row,
column + this.firstCategoryIndex);
}
Returns the number of sub-intervals for a given item. |
public GanttCategoryDataset getUnderlyingDataset() {
return this.underlying;
}
Returns the underlying dataset that was supplied to the constructor. |
public Number getValue(Comparable rowKey,
Comparable columnKey) {
int r = getRowIndex(rowKey);
int c = getColumnIndex(columnKey);
if (c != -1) {
return this.underlying.getValue(r, c + this.firstCategoryIndex);
}
else {
throw new UnknownKeyException("Unknown columnKey: " + columnKey);
}
}
Returns the value for a pair of keys. |
public Number getValue(int row,
int column) {
return this.underlying.getValue(row, column + this.firstCategoryIndex);
}
Returns a value from the table. |
public void setFirstCategoryIndex(int first) {
if (first < 0 || first >= this.underlying.getColumnCount()) {
throw new IllegalArgumentException("Invalid index.");
}
this.firstCategoryIndex = first;
fireDatasetChanged();
}
Sets the index of the first category that should be used from the
underlying dataset, and sends a DatasetChangeEvent to all
registered listeners. |
public void setMaximumCategoryCount(int max) {
if (max < 0) {
throw new IllegalArgumentException("Requires 'max' >= 0.");
}
this.maximumCategoryCount = max;
fireDatasetChanged();
}
Sets the maximum category count and sends a DatasetChangeEvent
to all registered listeners. |