public abstract class AbstractDataset extends java.lang.Object implements Dataset, java.lang.Cloneable, java.io.Serializable, java.io.ObjectInputValidation
Dataset interface, containing a
mechanism for registering change listeners.| Modifier and Type | Field and Description |
|---|---|
private DatasetGroup |
group
The group that the dataset belongs to.
|
private javax.swing.event.EventListenerList |
listenerList
Storage for registered change listeners.
|
private boolean |
notify
A flag that can be used to temporarily suppress dataset change event
notifications.
|
private static long |
serialVersionUID
For serialization.
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractDataset()
Constructs a dataset.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addChangeListener(DatasetChangeListener listener)
Registers an object to receive notification of changes to the dataset.
|
java.lang.Object |
clone()
Returns a clone of the dataset.
|
protected void |
fireDatasetChanged()
Notifies all registered listeners that the dataset has changed,
provided that the
notify flag has not been set to
false. |
DatasetGroup |
getGroup()
Returns the dataset group for the dataset.
|
boolean |
getNotify()
Returns the value of the notify flag.
|
boolean |
hasListener(java.util.EventListener listener)
Returns
true if the specified object is registered with
the dataset as a listener. |
protected void |
notifyListeners(DatasetChangeEvent event)
Notifies all registered listeners that the dataset has changed.
|
private void |
readObject(java.io.ObjectInputStream stream)
Restores a serialized object.
|
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 |
setNotify(boolean notify)
Sets the notify flag, which controls whether or not the
fireDatasetChanged()
method notifies listeners. |
void |
validateObject()
Validates the object.
|
private void |
writeObject(java.io.ObjectOutputStream stream)
Handles serialization.
|
private static final long serialVersionUID
private DatasetGroup group
private transient javax.swing.event.EventListenerList listenerList
private boolean notify
protected AbstractDataset()
public DatasetGroup getGroup()
getGroup in interface Datasetnull).setGroup(DatasetGroup)public void setGroup(DatasetGroup group)
setGroup in interface Datasetgroup - the group (null not permitted).getGroup()public boolean getNotify()
true. If this is false, calls to the
fireDatasetChanged() method will NOT trigger a dataset
change event.public void setNotify(boolean notify)
fireDatasetChanged()
method notifies listeners. Setting this flag to true will
trigger a DatasetChangeEvent because there may be
queued up changes.notify - the new flag value.public void addChangeListener(DatasetChangeListener listener)
addChangeListener in interface Datasetlistener - the object to register.removeChangeListener(DatasetChangeListener)public void removeChangeListener(DatasetChangeListener listener)
removeChangeListener in interface Datasetlistener - the object to deregister.addChangeListener(DatasetChangeListener)public boolean hasListener(java.util.EventListener listener)
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.listener - the listener.addChangeListener(DatasetChangeListener),
removeChangeListener(DatasetChangeListener)protected void fireDatasetChanged()
notify flag has not been set to
false.addChangeListener(DatasetChangeListener)protected void notifyListeners(DatasetChangeEvent event)
event - contains information about the event that triggered the
notification.addChangeListener(DatasetChangeListener),
removeChangeListener(DatasetChangeListener)public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
DatasetChangeListener references that have been registered with
this dataset.clone in class java.lang.Objectjava.lang.CloneNotSupportedException - if the dataset does not support
cloning.private void writeObject(java.io.ObjectOutputStream stream)
throws java.io.IOException
stream - the output stream.java.io.IOException - if there is an I/O problem.private void readObject(java.io.ObjectInputStream stream)
throws java.io.IOException,
java.lang.ClassNotFoundException
stream - the input stream.java.io.IOException - if there is an I/O problem.java.lang.ClassNotFoundException - if there is a problem loading a class.public void validateObject()
throws java.io.InvalidObjectException
validateObject in interface java.io.ObjectInputValidationjava.io.InvalidObjectException - If the object cannot validate itself.