public abstract class

AbstractDataset

extends Object
implements ObjectInputValidation Serializable Cloneable Dataset
java.lang.Object
   ↳ org.jfree.data.general.AbstractDataset
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

An abstract implementation of the Dataset interface, containing a mechanism for registering change listeners.

Summary

Protected Constructors
AbstractDataset()
Constructs a dataset.
Public Methods
void addChangeListener(DatasetChangeListener listener)
Registers an object to receive notification of changes to the dataset.
Object clone()
Returns a clone of the dataset.
DatasetGroup getGroup()
Returns the dataset group for the dataset.
boolean hasListener(EventListener listener)
Returns true if the specified object is registered with the dataset as a listener.
void removeChangeListener(DatasetChangeListener listener)
Deregisters an object so that it no longer receives notification of changes to the dataset.
void setGroup(DatasetGroup group)
Sets the dataset group for the dataset.
void validateObject()
Validates the object.
Protected Methods
void fireDatasetChanged()
Notifies all registered listeners that the dataset has changed.
void notifyListeners(DatasetChangeEvent event)
Notifies all registered listeners that the dataset has changed.
[Expand]
Inherited Methods
From class java.lang.Object
From interface java.io.ObjectInputValidation
From interface org.jfree.data.general.Dataset

Protected Constructors

protected AbstractDataset ()

Constructs a dataset. By default, the dataset is assigned to its own group.

Public Methods

public void addChangeListener (DatasetChangeListener listener)

Registers an object to receive notification of changes to the dataset.

Parameters
listener the object to register.

public Object clone ()

Returns a clone of the dataset. The cloned dataset will NOT include the DatasetChangeListener references that have been registered with this dataset.

Returns
  • A clone.
Throws
CloneNotSupportedException if the dataset does not support cloning.

public DatasetGroup getGroup ()

Returns the dataset group for the dataset.

Returns
  • The group (never null).

public boolean hasListener (EventListener 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.

Parameters
listener the listener.
Returns
  • A boolean.

public void removeChangeListener (DatasetChangeListener listener)

Deregisters an object so that it no longer receives notification of changes to the dataset.

Parameters
listener the object to deregister.

public void setGroup (DatasetGroup group)

Sets the dataset group for the dataset.

Parameters
group the group (null not permitted).
See Also

public void validateObject ()

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.

Throws
InvalidObjectException If the object cannot validate itself.

Protected Methods

protected void fireDatasetChanged ()

Notifies all registered listeners that the dataset has changed.

protected void notifyListeners (DatasetChangeEvent event)

Notifies all registered listeners that the dataset has changed.

Parameters
event contains information about the event that triggered the notification.