com.odesys.chart
Class DefaultChartModel

java.lang.Object
  |
  +--com.odesys.chart.DefaultChartModel
All Implemented Interfaces:
ChartModel
Direct Known Subclasses:
DefaultBarChartModel, DefaultBubbleChartModel, DefaultLineChartModel, DefaultPieChartModel

public abstract class DefaultChartModel
extends java.lang.Object
implements ChartModel

This is the abstract superclass of all default ChartModel implementations. DefaultChartModel provides the common functionality such as the data Series, the automatic Colors, the ModelChangeListeneres collection etc.


Field Summary
protected  java.util.Vector m_series
           
protected  java.util.Vector m_seriesData
           
 
Fields inherited from interface com.odesys.chart.ChartModel
COLOR, LABEL, SERIES, VALUE
 
Constructor Summary
DefaultChartModel()
          Creates a new DefaultChartModel instance.
 
Method Summary
 ChartElement addElement(Series series)
          Adds a new ChartElement to the specified series
 void addModelChangeListener(ModelChangeListener modelListener)
          Adds a listener that is notified each time a change to the data model occurs.
 Series addSeries()
          Adds a new data Series to this model
abstract  ChartElement createChartElement(Series series)
          Factory method that creats a ChartElement for the specified Series
 Series createSeries()
          Factory method that creates a Series instance.
 java.util.Vector createSeriesElements(Series series)
          Factory method that creates a Vector of ChartElement for the specified Series.
 java.util.Enumeration elementsOf(Series series)
          Returns an Enumeration of the elements of the specified Series
 void fireModelChanged(ModelChangedEvent event)
          Notifies all registered ModelChangeListeners that this model has changed.
 ChartElement getElementAt(Series series, int index)
          Gets the ChartElement at the specified index in the specified Series
 Series getSeriesAt(int index)
          Gets the data Series at the specified index
 int getSeriesSize()
          Gets the number of data Series of this ChartModel
 int getSizeOf(Series series)
          Gets the number of the elements in the specified Series
 ChartElement insertElementAt(Series series, int index)
          Inserts a new ChartElement in the specified series at the specified index
 Series insertSeriesAt(int index)
          Inserts a new data Series at the specified index
 java.awt.Color nextColor()
          Returns the next automatic color.
 void removeElementAt(Series series, int index)
          Removes the ChartElement at the specified index from the specified series
 void removeModelChangeListener(ModelChangeListener modelListener)
          Removes a listener from this ChartModel.
 void removeSeriesAt(int index)
          Removes from this Model the Series at the specified index
 java.util.Enumeration series()
          Returns an Enumeration of all data Series of this model
 void setUpdateLocked(boolean updateLocked)
          Determines whether a ModelChangedEvent should be fired.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_series

protected java.util.Vector m_series

m_seriesData

protected java.util.Vector m_seriesData
Constructor Detail

DefaultChartModel

public DefaultChartModel()
Creates a new DefaultChartModel instance.
Method Detail

addModelChangeListener

public void addModelChangeListener(ModelChangeListener modelListener)
Description copied from interface: ChartModel
Adds a listener that is notified each time a change to the data model occurs.
Specified by:
addModelChangeListener in interface ChartModel

removeModelChangeListener

public void removeModelChangeListener(ModelChangeListener modelListener)
Description copied from interface: ChartModel
Removes a listener from this ChartModel.
Specified by:
removeModelChangeListener in interface ChartModel

fireModelChanged

public void fireModelChanged(ModelChangedEvent event)
Notifies all registered ModelChangeListeners that this model has changed.
Specified by:
fireModelChanged in interface ChartModel

setUpdateLocked

public void setUpdateLocked(boolean updateLocked)
Determines whether a ModelChangedEvent should be fired.
Parameters:
updateLocked - If set to true no ModelChangedEvents are fired, but the hints accumulate to make sure that no changes will be lost after updateLocked is set back to false.

getSeriesSize

public int getSeriesSize()
Description copied from interface: ChartModel
Gets the number of data Series of this ChartModel
Specified by:
getSeriesSize in interface ChartModel

series

public java.util.Enumeration series()
Description copied from interface: ChartModel
Returns an Enumeration of all data Series of this model
Specified by:
series in interface ChartModel

getSizeOf

public int getSizeOf(Series series)
Gets the number of the elements in the specified Series
Returns:
The number of the elements in the specified Series

elementsOf

public java.util.Enumeration elementsOf(Series series)
Returns an Enumeration of the elements of the specified Series
Returns:
Enumeration of the elements of the specified Series

createSeries

public Series createSeries()
Factory method that creates a Series instance.
Returns:
The new Series instance

createSeriesElements

public java.util.Vector createSeriesElements(Series series)
Factory method that creates a Vector of ChartElement for the specified Series. This implementation returns an empty Vector.
Returns:
The new Vector of ChartElements

createChartElement

public abstract ChartElement createChartElement(Series series)
Factory method that creats a ChartElement for the specified Series

nextColor

public java.awt.Color nextColor()
Returns the next automatic color.
Returns:
The next automatic color

addSeries

public Series addSeries()
Adds a new data Series to this model
Returns:
The new Series

insertSeriesAt

public Series insertSeriesAt(int index)
Inserts a new data Series at the specified index
Returns:
The new Series

getSeriesAt

public Series getSeriesAt(int index)
Gets the data Series at the specified index
Returns:
The Series at the specified index

removeSeriesAt

public void removeSeriesAt(int index)
Removes from this Model the Series at the specified index

addElement

public ChartElement addElement(Series series)
Adds a new ChartElement to the specified series
Returns:
The new ChartElement

insertElementAt

public ChartElement insertElementAt(Series series,
                                    int index)
Inserts a new ChartElement in the specified series at the specified index
Returns:
The new ChartElement

getElementAt

public ChartElement getElementAt(Series series,
                                 int index)
Gets the ChartElement at the specified index in the specified Series
Returns:
The ChartElement at the specified index in the specified Series

removeElementAt

public void removeElementAt(Series series,
                            int index)
Removes the ChartElement at the specified index from the specified series