org.jfree.data.general
abstract public class: AbstractDataset [javadoc |
source]
java.lang.Object
org.jfree.data.general.AbstractDataset
All Implemented Interfaces:
Cloneable, Dataset, ObjectInputValidation, Serializable
Direct Known Subclasses:
DefaultMultiValueCategoryDataset, DefaultOHLCDataset, CombinedDataset, XIntervalSeriesCollection, DynamicTimeSeriesCollection, SimpleHistogramDataset, XYIntervalSeriesCollection, SlidingCategoryDataset, HistogramDataset, DefaultContourDataset, DefaultXYDataset, XYBarDataset, DefaultCategoryDataset, YIntervalSeriesCollection, DefaultKeyedValuesDataset, DefaultPieDataset, MatrixSeriesCollection, SubSeriesDataset, DefaultStatisticalCategoryDataset, WaferMapDataset, XYSeriesCollection, TimePeriodValuesCollection, DefaultValueDataset, DefaultKeyedValueDataset, JDBCXYDataset, JDBCCategoryDataset, NonGridContourDataset, DefaultBoxAndWhiskerXYDataset, DefaultTableXYDataset, CategoryToPieDataset, JDBCPieDataset, AbstractXYDataset, CategoryTableXYDataset, AbstractXYZDataset, DefaultXYZDataset, AbstractIntervalXYDataset, TimeSeriesCollection, DefaultIntervalCategoryDataset, TimeTableXYDataset, DefaultIntervalXYDataset, DefaultHighLowDataset, DefaultMeterDataset, DefaultKeyedValues2DDataset, DefaultBoxAndWhiskerCategoryDataset, DefaultWindDataset, TaskSeriesCollection, AbstractSeriesDataset, SlidingGanttCategoryDataset, OHLCSeriesCollection, VectorSeriesCollection
An abstract implementation of the
Dataset interface, containing a
mechanism for registering change listeners.
| Method from org.jfree.data.general.AbstractDataset Detail: |
public void addChangeListener(DatasetChangeListener listener) {
this.listenerList.add(DatasetChangeListener.class, listener);
}
Registers an object to receive notification of changes to the dataset. |
public Object clone() throws CloneNotSupportedException {
AbstractDataset clone = (AbstractDataset) super.clone();
clone.listenerList = new EventListenerList();
return clone;
}
Returns a clone of the dataset. The cloned dataset will NOT include the
DatasetChangeListener references that have been registered with
this dataset. |
protected void fireDatasetChanged() {
notifyListeners(new DatasetChangeEvent(this, this));
}
Notifies all registered listeners that the dataset has changed. |
public DatasetGroup getGroup() {
return this.group;
}
Returns the dataset group for the dataset. |
public boolean hasListener(EventListener listener) {
List list = Arrays.asList(this.listenerList.getListenerList());
return list.contains(listener);
}
Returns true if the specified object is registered with
the dataset as a listener. Most applications won't need to call this
method, it exists mainly for use by unit testing code. |
protected void notifyListeners(DatasetChangeEvent event) {
Object[] listeners = this.listenerList.getListenerList();
for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == DatasetChangeListener.class) {
((DatasetChangeListener) listeners[i + 1]).datasetChanged(
event
);
}
}
}
Notifies all registered listeners that the dataset has changed. |
public void removeChangeListener(DatasetChangeListener listener) {
this.listenerList.remove(DatasetChangeListener.class, listener);
}
Deregisters an object so that it no longer receives notification of
changes to the dataset. |
public void setGroup(DatasetGroup group) {
if (group == null) {
throw new IllegalArgumentException("Null 'group' argument.");
}
this.group = group;
}
Sets the dataset group for the dataset. |
public void validateObject() throws InvalidObjectException {
fireDatasetChanged();
}
Validates the object. We use this opportunity to call listeners who have
registered during the deserialization process, as listeners are not
serialized. This method is called by the serialization system after the
entire graph is read.
This object has registered itself to the system with a priority of 10.
Other callbacks may register with a higher priority number to be called
before this object, or with a lower priority number to be called after
the listeners were notified.
All listeners are supposed to have register by now, either in their
readObject or validateObject methods. Notify them that this dataset has
changed. |