lt.monarch.chart.models
Class AbstractDataModel

java.lang.Object
  extended by lt.monarch.chart.models.AbstractDataModel
All Implemented Interfaces:
java.io.Serializable, ArrayDataModel, DataModel, MatrixDataModel
Direct Known Subclasses:
ChartDataModel, StackedDataModel

public abstract class AbstractDataModel
extends java.lang.Object
implements ArrayDataModel, MatrixDataModel, java.io.Serializable

Abstract data model, which has both array data model and matrix data model interfaces. Implements casting to those interfaces and contains listener methods for the models.

See Also:
Serialized Form

Field Summary
Modifier and Type Field and Description
protected  java.util.Map<DataColumnType,DataModelColumn> columns
           
protected  java.util.ArrayList<java.lang.Object>[] data
          Data columns as array lists
protected  DefaultListenerList<ChartDataModelListener> dataListeners
           
protected  DataModelDimensions dimensions
           
protected  boolean suspended
           
 
Constructor Summary
Constructor and Description
AbstractDataModel()
           
 
Method Summary
Modifier and Type Method and Description
 void addColumn(DataColumnType type, DataModelColumn column)
          Adds new data column of the specified type to data model.
 void addListener(ChartDataModelListener listener)
          Adds the specified chart data model listener to receive chart data model change events from this chart data model.
 ArrayDataModel castToArray()
          Casts the data model to array.
 MatrixDataModel castToMatrix()
          Casts the data model to matrix.
 void dispose()
          Disposes data model
 void fireDataChanged(DataModelChangeEvent event)
          Forwards the given notification event to all ChartDataModelListener objects that registered themselves as listeners for this chart data model.
 DataModelDimensions getAddressDimensions()
          Address dimensions, which shows if the model is array or matrix.
 java.util.Map<DataColumnType,DataModelColumn> getColumns()
          Programmable data model columns
 int getValuesInPoint()
          Gets the count of the data columns at each point in the data model.
 void removeListener(ChartDataModelListener listener)
          Removes the specified chart data model listener so that it no longer receives chart data model change events from this chart data model.
 void resumeListeners()
          Resumes all listeners that are registered for this data model.
 void setColumns(java.util.Map<DataColumnType,DataModelColumn> columns)
          Programmable data model columns
 void suspendListeners()
          Suspends all listeners that are registered for this data model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface lt.monarch.chart.models.ArrayDataModel
getPointCount, getValueAt, setValueAt
 
Methods inherited from interface lt.monarch.chart.models.MatrixDataModel
getPointCount, getValueAt, setValueAt
 
Methods inherited from interface lt.monarch.chart.models.DataModel
hasColumn
 

Field Detail

columns

protected java.util.Map<DataColumnType,DataModelColumn> columns

suspended

protected boolean suspended

dataListeners

protected final DefaultListenerList<ChartDataModelListener> dataListeners

data

protected java.util.ArrayList<java.lang.Object>[] data
Data columns as array lists


dimensions

protected DataModelDimensions dimensions
Constructor Detail

AbstractDataModel

public AbstractDataModel()
Method Detail

addListener

public void addListener(ChartDataModelListener listener)
Description copied from interface: DataModel
Adds the specified chart data model listener to receive chart data model change events from this chart data model. If listener is null, no exception is thrown and no action is performed.

Specified by:
addListener in interface DataModel
Parameters:
listener - the chart data model listener

removeListener

public void removeListener(ChartDataModelListener listener)
Description copied from interface: DataModel
Removes the specified chart data model listener so that it no longer receives chart data model change events from this chart data model. If listener is null, no exception is thrown and no action is performed.

Specified by:
removeListener in interface DataModel
Parameters:
listener - the chart data model listener

getAddressDimensions

public DataModelDimensions getAddressDimensions()
Description copied from interface: DataModel
Address dimensions, which shows if the model is array or matrix.

Specified by:
getAddressDimensions in interface DataModel
Returns:
address dimensions

getValuesInPoint

public int getValuesInPoint()
Description copied from interface: DataModel
Gets the count of the data columns at each point in the data model.

Specified by:
getValuesInPoint in interface DataModel
Returns:
count of data columns at each data point

castToArray

public ArrayDataModel castToArray()
Description copied from interface: DataModel
Casts the data model to array.

Specified by:
castToArray in interface DataModel
Returns:
array data model

castToMatrix

public MatrixDataModel castToMatrix()
Description copied from interface: DataModel
Casts the data model to matrix.

Specified by:
castToMatrix in interface DataModel
Returns:
matrix data model

fireDataChanged

public void fireDataChanged(DataModelChangeEvent event)
Forwards the given notification event to all ChartDataModelListener objects that registered themselves as listeners for this chart data model.

Specified by:
fireDataChanged in interface DataModel
Parameters:
event - the event to be forwarded

addColumn

public void addColumn(DataColumnType type,
                      DataModelColumn column)
Description copied from interface: ArrayDataModel
Adds new data column of the specified type to data model. If data model previously contained given column, the old value is replaced by the specified value.

Specified by:
addColumn in interface ArrayDataModel
Parameters:
type - new data column type
column - new data column object

dispose

public void dispose()
Description copied from interface: DataModel
Disposes data model

Specified by:
dispose in interface DataModel

suspendListeners

public void suspendListeners()
Suspends all listeners that are registered for this data model. None of data model change events actions will be performed.


resumeListeners

public void resumeListeners()
Resumes all listeners that are registered for this data model. Only new data model change events actions will be performed. The old change events that were received when listeners were stopped are already omitted.


getColumns

public java.util.Map<DataColumnType,DataModelColumn> getColumns()
Programmable data model columns


setColumns

public void setColumns(java.util.Map<DataColumnType,DataModelColumn> columns)
Programmable data model columns