List of usage examples for org.jfree.data.pie PieDatasetChangeType ADD
PieDatasetChangeType ADD
To view the source code for org.jfree.data.pie PieDatasetChangeType ADD.
Click Source Link
From source file:org.jfree.data.pie.DefaultPieDataset.java
/** * Sets the data value for a key and sends a {@link DatasetChangeEvent} to * all registered listeners.// w ww .j a v a 2 s.c o m * * @param key the key (<code>null</code> not permitted). * @param value the value. * * @throws IllegalArgumentException if <code>key</code> is * <code>null</code>. */ public void setValue(Comparable key, Number value) { int index = this.data.getIndex(key); PieDatasetChangeType ct = PieDatasetChangeType.ADD; if (index >= 0) { ct = PieDatasetChangeType.UPDATE; } this.data.setObject(key, new SelectableValue(value)); PieDatasetChangeInfo info = new PieDatasetChangeInfo(ct, index, index); fireDatasetChanged(info); }
From source file:org.jfree.data.pie.DefaultPieDataset.java
/** * Inserts a new value at the specified position in the dataset or, if * there is an existing item with the specified key, updates the value * for that item and moves it to the specified position. After the change * is made, this method sends a {@link DatasetChangeEvent} to all * registered listeners.//from w ww. j a v a2 s. com * * @param position the position (in the range 0 to getItemCount()). * @param key the key (<code>null</code> not permitted). * @param value the value (<code>null</code> permitted). * * @since 1.0.6 */ public void insertValue(int position, Comparable key, Number value) { this.data.insertValue(position, key, value); PieDatasetChangeType ct = PieDatasetChangeType.ADD; // TODO: unit tests for inserts where key already exists. fireDatasetChanged(new PieDatasetChangeInfo(ct, position, position)); }