com.jrefinery.data
Class Series

java.lang.Object
  extended by com.jrefinery.data.Series
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
BasicTimeSeries, GanttSeries, XYSeries

public class Series
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

Base class representing a data series. Subclasses are left to implement the actual data structures.

The series has two properties ("Name" and "Description") for which you can register a PropertyChangeListener.

You can also register a SeriesChangeListener to receive notification of changes to the series data.

See Also:
Serialized Form

Field Summary
protected  java.lang.String description
          A description of the series.
protected  java.util.List listeners
          Storage for registered change listeners.
protected  java.lang.String name
          The name of the series.
protected  java.beans.PropertyChangeSupport propertyChangeSupport
          Object to support property change notification.
 
Constructor Summary
protected Series(java.lang.String name)
          Constructs a series.
protected Series(java.lang.String name, java.lang.String description)
          Constructs a series.
 
Method Summary
 void addChangeListener(SeriesChangeListener listener)
          Registers an object with this series, to receive notification whenever the series changes.
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds a property change listener to the series.
 java.lang.Object clone()
          Returns a clone of the series.
 void fireSeriesChanged()
          General method for signalling to registered listeners that the series has been changed.
 java.lang.String getDescription()
          Returns the description of the series (possibly null).
 java.lang.String getName()
          Returns the name of the series.
protected  void notifyListeners(SeriesChangeEvent event)
          Sends a change event to all registered listeners.
 void removeChangeListener(SeriesChangeListener listener)
          Deregisters an object, so that it not longer receives notification whenever the series changes.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes a property change listener from the series.
 void setDescription(java.lang.String description)
          Sets the description of the series.
 void setName(java.lang.String name)
          Sets the name of the series.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected java.lang.String name
The name of the series.


description

protected java.lang.String description
A description of the series.


listeners

protected java.util.List listeners
Storage for registered change listeners.


propertyChangeSupport

protected java.beans.PropertyChangeSupport propertyChangeSupport
Object to support property change notification.

Constructor Detail

Series

protected Series(java.lang.String name)
Constructs a series.

Parameters:
name - The series name.

Series

protected Series(java.lang.String name,
                 java.lang.String description)
Constructs a series.

Parameters:
name - The series name.
description - The series description.
Method Detail

getName

public java.lang.String getName()
Returns the name of the series.

Returns:
The name of the series.

setName

public void setName(java.lang.String name)
Sets the name of the series.

Parameters:
name - The name.

getDescription

public java.lang.String getDescription()
Returns the description of the series (possibly null).

Returns:
The description of the series.

setDescription

public void setDescription(java.lang.String description)
Sets the description of the series.

Parameters:
description - The new description (null permitted).

clone

public java.lang.Object clone()
Returns a clone of the series.

Notes: 1. No need to clone the name or description, since String object is immutable. 2. We set the listener list to empty, since the listeners did not register with the clone. 3. Same applies to the PropertyChangeSupport instance.

Overrides:
clone in class java.lang.Object

addChangeListener

public void addChangeListener(SeriesChangeListener listener)
Registers an object with this series, to receive notification whenever the series changes.

Objects being registered must implement the SeriesChangeListener interface.

Parameters:
listener - The object to register.

removeChangeListener

public void removeChangeListener(SeriesChangeListener listener)
Deregisters an object, so that it not longer receives notification whenever the series changes.

Call this method when an object no longer needs to be notified of changes to the series.

Parameters:
listener - The object to deregister.

fireSeriesChanged

public void fireSeriesChanged()
General method for signalling to registered listeners that the series has been changed.


notifyListeners

protected void notifyListeners(SeriesChangeEvent event)
Sends a change event to all registered listeners.

Parameters:
event - Contains information about the event that triggered the notification.

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a property change listener to the series.

Parameters:
listener - The listener.

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a property change listener from the series.

Parameters:
listener - The listener.


Copyright © 2003 MBARI.

The Monterey Bay Aquarium Research Institute (MBARI) provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of MBARI to assist in its use, correction, modification, or enhancement.