List of usage examples for org.jfree.data UnknownKeyException UnknownKeyException
public UnknownKeyException(String message)
From source file:org.jfree.data.gantt.SlidingGanttCategoryDataset.java
/** * Returns the percentage complete value of a sub-interval for a given item. * * @param rowKey the row key./*from w ww . jav a 2 s .c o m*/ * @param columnKey the column key. * @param subinterval the sub-interval. * * @return The percent complete value (possibly <code>null</code>). * * @see #getPercentComplete(int, int, int) */ @Override 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); } }
From source file:org.jfree.data.DefaultKeyedValues.java
/** * Removes a value from the collection.//from w ww . java2 s .c o m * * @param key the item key (<code>null</code> not permitted). * * @throws IllegalArgumentException if <code>key</code> is * <code>null</code>. * @throws UnknownKeyException if <code>key</code> is not recognised. */ public void removeValue(Comparable key) { int index = getIndex(key); if (index < 0) { throw new UnknownKeyException("The key (" + key + ") is not recognised."); } removeValue(index); }
From source file:org.jfree.data.gantt.SlidingGanttCategoryDataset.java
/** * Returns the end value of a sub-interval for a given item. * * @param rowKey the row key.// w w w. j ava2 s .c o m * @param columnKey the column key. * @param subinterval the sub-interval. * * @return The end value (possibly <code>null</code>). * * @see #getStartValue(Comparable, Comparable, int) */ @Override 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); } }
From source file:org.jfree.data.KeyedObjects2D.java
/** * Removes an entire row from the table. * * @param rowKey the row key (<code>null</code> not permitted). * * @throws UnknownKeyException if <code>rowKey</code> is not recognised. * * @see #removeColumn(Comparable)/*from w w w . j a va2 s . c om*/ */ public void removeRow(Comparable rowKey) { int index = getRowIndex(rowKey); if (index < 0) { throw new UnknownKeyException("Row key (" + rowKey + ") not recognised."); } removeRow(index); }
From source file:org.jfree.data.KeyedObjects2D.java
/** * Removes an entire column from the table. * * @param columnKey the column key (<code>null</code> not permitted). * * @throws UnknownKeyException if <code>rowKey</code> is not recognised. * * @see #removeRow(Comparable)/* w w w .ja va2 s .c o m*/ */ public void removeColumn(Comparable columnKey) { int index = getColumnIndex(columnKey); if (index < 0) { throw new UnknownKeyException("Column key (" + columnKey + ") not recognised."); } Iterator iterator = this.rows.iterator(); while (iterator.hasNext()) { KeyedObjects rowData = (KeyedObjects) iterator.next(); int i = rowData.getIndex(columnKey); if (i >= 0) { rowData.removeValue(i); } } this.columnKeys.remove(columnKey); }
From source file:org.jfree.data.category.DefaultIntervalCategoryDataset.java
/** * Returns the data value for one category in a series. * <P>//from w w w . j a va 2 s . com * This method is part of the CategoryDataset interface. Not particularly * meaningful for this class...returns the end value. * * @param series The required series (zero based index). * @param category The required category. * * @return The data value for one category in a series (null possible). * * @see #getEndValue(Comparable, Comparable) */ @Override public Number getValue(Comparable series, Comparable category) { int seriesIndex = getSeriesIndex(series); if (seriesIndex < 0) { throw new UnknownKeyException("Unknown 'series' key."); } int itemIndex = getColumnIndex(category); if (itemIndex < 0) { throw new UnknownKeyException("Unknown 'category' key."); } return getValue(seriesIndex, itemIndex); }
From source file:org.jfree.data.gantt.SlidingGanttCategoryDataset.java
/** * Returns the start value of a sub-interval for a given item. * * @param rowKey the row key.//from w w w . j a v a2 s. c o m * @param columnKey the column key. * @param subinterval the sub-interval. * * @return The start value (possibly <code>null</code>). * * @see #getEndValue(Comparable, Comparable, int) */ @Override 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); } }
From source file:org.jfree.data.DefaultKeyedValues2D.java
/** * Removes a row from the table.//from w ww . ja v a 2s.c o m * * @param rowKey the row key (<code>null</code> not permitted). * * @see #removeRow(int) * @see #removeColumn(Comparable) * * @throws UnknownKeyException if <code>rowKey</code> is not defined in the * table. */ public void removeRow(Comparable rowKey) { ParamChecks.nullNotPermitted(rowKey, "rowKey"); int index = getRowIndex(rowKey); if (index >= 0) { removeRow(index); } else { throw new UnknownKeyException("Unknown key: " + rowKey); } }
From source file:org.jfree.data.DefaultKeyedValues2D.java
/** * Removes a column from the table./* w w w. ja v a2s . c om*/ * * @param columnKey the column key (<code>null</code> not permitted). * * @throws UnknownKeyException if the table does not contain a column with * the specified key. * @throws IllegalArgumentException if <code>columnKey</code> is * <code>null</code>. * * @see #removeColumn(int) * @see #removeRow(Comparable) */ public void removeColumn(Comparable columnKey) { if (columnKey == null) { throw new IllegalArgumentException("Null 'columnKey' argument."); } if (!this.columnKeys.contains(columnKey)) { throw new UnknownKeyException("Unknown key: " + columnKey); } Iterator iterator = this.rows.iterator(); while (iterator.hasNext()) { DefaultKeyedValues rowData = (DefaultKeyedValues) iterator.next(); int index = rowData.getIndex(columnKey); if (index >= 0) { rowData.removeValue(columnKey); } } this.columnKeys.remove(columnKey); }
From source file:org.jfree.data.DefaultKeyedValues2D.java
/** * Removes a column from the table./* w ww . ja v a 2 s .c o m*/ * * @param columnKey the column key (<code>null</code> not permitted). * * @throws UnknownKeyException if the table does not contain a column with * the specified key. * @throws IllegalArgumentException if <code>columnKey</code> is * <code>null</code>. * * @see #removeColumn(int) * @see #removeRow(Comparable) */ public void removeColumn(Comparable columnKey) { ParamChecks.nullNotPermitted(columnKey, "columnKey"); if (!this.columnKeys.contains(columnKey)) { throw new UnknownKeyException("Unknown key: " + columnKey); } Iterator iterator = this.rows.iterator(); while (iterator.hasNext()) { DefaultKeyedValues rowData = (DefaultKeyedValues) iterator.next(); int index = rowData.getIndex(columnKey); if (index >= 0) { rowData.removeValue(columnKey); } } this.columnKeys.remove(columnKey); }