com.approximatrix.charting.model
Class AbstractChartDataModel

java.lang.Object
  extended by com.approximatrix.charting.model.AbstractChartDataModel
All Implemented Interfaces:
ChartDataModel
Direct Known Subclasses:
AbstractDotPlotDataModel, DefaultChartDataModel, ObjectChartDataModel

public abstract class AbstractChartDataModel
extends java.lang.Object
implements ChartDataModel

This class implements the event-handling methods for a chart model.

Author:
mueller armstrong

Field Summary
protected  boolean autoscale
          Flag defining the automatic scaling of max and min values.
protected  javax.swing.event.EventListenerList listener
          The listener list.
protected  double maxcolumn
          Maximum and minimum column values to be displayed.
protected  java.lang.Number maxvalue
          Maximum and minimum values to be displayed.
protected  double mincolumn
          Maximum and minimum column values to be displayed.
protected  java.lang.Number minvalue
          Maximum and minimum values to be displayed.
 
Constructor Summary
AbstractChartDataModel()
          Creates new AbstractChartDataModel
 
Method Summary
 void addChartDataModelListener(ChartDataModelListener l)
          Adds a ChartDataModelListener.
 boolean equals(java.lang.Object o)
          Compares this ChartDataModel with another object.
 void fireChartDataModelChangedEvent(java.lang.Object src)
          Promotes a new ChartDataModelEvent.
 int getAxisBinding(int set)
          Returns the Axis Binding for a specific DataSet, ie the Axis on which the DataSet should be plotted
 java.lang.Class getColumnClass()
          Returns the class of the column values.
 java.lang.String getDataSetName(int set)
          Returns the title of the DataSet.
protected abstract  double getFirstColumnValue()
           
protected abstract  double getLastColumnValue()
           
 double getManualMaximumColumnValue()
          Deprecated. As of release 1.3, replaced by getManualMaximumX()
 java.lang.Number getManualMaximumValue()
          Deprecated. As of release 1.3, replaced by getManualMaximumY()
 java.lang.Number getManualMaximumX()
          Returns the maximum manual x-axis scale
 java.lang.Number getManualMaximumY()
          Returns the maximum manual y-axis scale
 double getManualMinimumColumnValue()
          Deprecated. As of release 1.3, replaced by getManualMinimumX()
 java.lang.Number getManualMinimumValue()
          Deprecated. As of release 1.3, replaced by getManualMinimumY()
 java.lang.Number getManualMinimumX()
          Returns the minimum manual x-axis scale
 java.lang.Number getManualMinimumY()
          Returns the minimum manual y-axis scale
protected abstract  java.util.TreeSet getOrderedValues(int axis)
           
 boolean isAutoScale()
          Returns true if autoscaling is enabled.
 boolean isColumnNumeric()
          Determines if the column values are numeric.
 boolean isManualScale()
          Deprecated. As of release 1.4, only autoscale flag will be considered
 void removeChartDataModelListener(ChartDataModelListener l)
          Removes a ChartDataModelListener.
 void setAutoScale(boolean b)
          Enables or disables chart autoscaling.
 void setAxisBinding(int set, int axis)
          Provides a default empty implementation.
 void setManualScale(boolean b)
          Deprecated. As of release 1.4, only autoscale flag will be considered
 void setMaximumColumnValue(double d)
          Deprecated. As of release 1.3, replaced by #setMaximumValueX()
 void setMaximumValue(java.lang.Number n)
          Deprecated. As of release 1.3, replaced by #setMaximumValueY()
 void setMaximumValueX(java.lang.Number n)
          Sets the maximum x-axis value.
 void setMaximumValueY(java.lang.Number n)
          Sets the maximum y-axis value.
 void setMinimumColumnValue(double d)
          Deprecated. As of release 1.3, replaced by #setMinimumValueX()
 void setMinimumValue(java.lang.Number n)
          Deprecated. As of release 1.3, replaced by #setMinimumValueY()
 void setMinimumValueX(java.lang.Number n)
          Sets the minimum x-axis value.
 void setMinimumValueY(java.lang.Number n)
          Sets the minimum y-axis value.
 void setValueAt(int set, int index, java.lang.Object value)
          Provides an empty implementation for not-editable DataModels.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.approximatrix.charting.model.ChartDataModel
getChartDataModelConstraints, getColumnValueAt, getColumnValueAt, getDataSetLength, getDataSetNumber, getValueAt, setChartDataModelConstraints
 

Field Detail

listener

protected javax.swing.event.EventListenerList listener
The listener list.


autoscale

protected boolean autoscale
Flag defining the automatic scaling of max and min values.


maxcolumn

protected double maxcolumn
Maximum and minimum column values to be displayed.


mincolumn

protected double mincolumn
Maximum and minimum column values to be displayed.


maxvalue

protected java.lang.Number maxvalue
Maximum and minimum values to be displayed.


minvalue

protected java.lang.Number minvalue
Maximum and minimum values to be displayed.

Constructor Detail

AbstractChartDataModel

public AbstractChartDataModel()
Creates new AbstractChartDataModel

Method Detail

removeChartDataModelListener

public void removeChartDataModelListener(ChartDataModelListener l)
Removes a ChartDataModelListener.

Specified by:
removeChartDataModelListener in interface ChartDataModel
Parameters:
l - the ChartDataListener

addChartDataModelListener

public void addChartDataModelListener(ChartDataModelListener l)
Adds a ChartDataModelListener.

Specified by:
addChartDataModelListener in interface ChartDataModel
Parameters:
l - the ChartDataModelListener

isColumnNumeric

public boolean isColumnNumeric()
Determines if the column values are numeric.

Specified by:
isColumnNumeric in interface ChartDataModel
Returns:
false per default

setValueAt

public void setValueAt(int set,
                       int index,
                       java.lang.Object value)
Provides an empty implementation for not-editable DataModels.

Specified by:
setValueAt in interface ChartDataModel
Parameters:
set - the DataSet in which the value should be set
index - the index in the DataSet where the value should be stored
value - the value object

getColumnClass

public java.lang.Class getColumnClass()
Returns the class of the column values.

Specified by:
getColumnClass in interface ChartDataModel
Returns:
Object.class per default

fireChartDataModelChangedEvent

public void fireChartDataModelChangedEvent(java.lang.Object src)
Promotes a new ChartDataModelEvent.

Specified by:
fireChartDataModelChangedEvent in interface ChartDataModel
Parameters:
src - the source object of the event.

getAxisBinding

public int getAxisBinding(int set)
Returns the Axis Binding for a specific DataSet, ie the Axis on which the DataSet should be plotted

Specified by:
getAxisBinding in interface ChartDataModel
Parameters:
set - the DataSet whose Axis binding should be determined
Returns:
DataSet.FIRST_YAXIS by default.

setAxisBinding

public void setAxisBinding(int set,
                           int axis)
Provides a default empty implementation.

Specified by:
setAxisBinding in interface ChartDataModel
Parameters:
set - the DataSet
axis - the Axis binding

setAutoScale

public void setAutoScale(boolean b)
Description copied from interface: ChartDataModel
Enables or disables chart autoscaling. This setting is overridden by the manual axis scaling flag.

Specified by:
setAutoScale in interface ChartDataModel
Parameters:
b - true to enable autoscaling, false otherwise

isAutoScale

public boolean isAutoScale()
Description copied from interface: ChartDataModel
Returns true if autoscaling is enabled. Does not depend on the manual scaling flag.

Specified by:
isAutoScale in interface ChartDataModel
Returns:
true if autoscaling is enabled, false otherwise

setManualScale

public void setManualScale(boolean b)
Deprecated. As of release 1.4, only autoscale flag will be considered

Enables the manual axis scaling. Set the desired maximum and minimum values using the setMaximum...Value functions.

Specified by:
setManualScale in interface ChartDataModel

isManualScale

public boolean isManualScale()
Deprecated. As of release 1.4, only autoscale flag will be considered

Returns true if the manual axis scaling is enabled. This overrides the enabled automatic axis scaling.

Specified by:
isManualScale in interface ChartDataModel

setMaximumColumnValue

public void setMaximumColumnValue(double d)
Deprecated. As of release 1.3, replaced by #setMaximumValueX()

Sets the maximum x-axis value.

Specified by:
setMaximumColumnValue in interface ChartDataModel

setMinimumColumnValue

public void setMinimumColumnValue(double d)
Deprecated. As of release 1.3, replaced by #setMinimumValueX()

Sets the minimum x-axis value.

Specified by:
setMinimumColumnValue in interface ChartDataModel

setMaximumValue

public void setMaximumValue(java.lang.Number n)
Deprecated. As of release 1.3, replaced by #setMaximumValueY()

Sets the maximum y-axis value.

Specified by:
setMaximumValue in interface ChartDataModel

setMinimumValue

public void setMinimumValue(java.lang.Number n)
Deprecated. As of release 1.3, replaced by #setMinimumValueY()

Sets the minimum y-axis value.

Specified by:
setMinimumValue in interface ChartDataModel

getManualMaximumColumnValue

public double getManualMaximumColumnValue()
Deprecated. As of release 1.3, replaced by getManualMaximumX()

Description copied from interface: ChartDataModel
Returns the current maximum x-axis value used for manual scaling.

Specified by:
getManualMaximumColumnValue in interface ChartDataModel
Returns:
the maximum column value as a double for manual scaling

getManualMinimumColumnValue

public double getManualMinimumColumnValue()
Deprecated. As of release 1.3, replaced by getManualMinimumX()

Description copied from interface: ChartDataModel
Returns the current minimum x-axis value used for manual scaling.

Specified by:
getManualMinimumColumnValue in interface ChartDataModel
Returns:
the minimum column value as a double for manual scaling

getManualMaximumValue

public java.lang.Number getManualMaximumValue()
Deprecated. As of release 1.3, replaced by getManualMaximumY()

Description copied from interface: ChartDataModel
Returns the current maximum y-axis value used for manual scaling.

Specified by:
getManualMaximumValue in interface ChartDataModel
Returns:
the maximum for manual scaling

getManualMinimumValue

public java.lang.Number getManualMinimumValue()
Deprecated. As of release 1.3, replaced by getManualMinimumY()

Description copied from interface: ChartDataModel
Returns the current minimum y-axis value used for manual scaling.

Specified by:
getManualMinimumValue in interface ChartDataModel
Returns:
the minimum for manual scaling

getManualMaximumX

public java.lang.Number getManualMaximumX()
Returns the maximum manual x-axis scale

Specified by:
getManualMaximumX in interface ChartDataModel
Returns:
the maximum x-axis value, or null if not assigned
See Also:
ChartDataModel.getManualMaximumX()

getManualMaximumY

public java.lang.Number getManualMaximumY()
Returns the maximum manual y-axis scale

Specified by:
getManualMaximumY in interface ChartDataModel
Returns:
the maximum y-axis value, or null if not assigned
See Also:
ChartDataModel.getManualMaximumY()

getManualMinimumX

public java.lang.Number getManualMinimumX()
Returns the minimum manual x-axis scale

Specified by:
getManualMinimumX in interface ChartDataModel
Returns:
the minimum x-axis value, or null if not assigned
See Also:
com.approximatrix.charting.model.ChartDataModel#getManualMinumumX()

getManualMinimumY

public java.lang.Number getManualMinimumY()
Returns the minimum manual y-axis scale

Specified by:
getManualMinimumY in interface ChartDataModel
Returns:
the minimum y-axis value, or null if not assigned
See Also:
com.approximatrix.charting.model.ChartDataModel#getManualMinumumY()

setMaximumValueX

public void setMaximumValueX(java.lang.Number n)
Sets the maximum x-axis value.

Specified by:
setMaximumValueX in interface ChartDataModel
Parameters:
n - the new maximum x value
See Also:
ChartDataModel.setMaximumValueX(java.lang.Number)

setMaximumValueY

public void setMaximumValueY(java.lang.Number n)
Sets the maximum y-axis value.

Specified by:
setMaximumValueY in interface ChartDataModel
Parameters:
n - the new maximum y value
See Also:
ChartDataModel.setMaximumValueY(java.lang.Number)

setMinimumValueX

public void setMinimumValueX(java.lang.Number n)
Sets the minimum x-axis value.

Specified by:
setMinimumValueX in interface ChartDataModel
Parameters:
n - the new minimum x value
See Also:
ChartDataModel.setMinimumValueX(java.lang.Number)

setMinimumValueY

public void setMinimumValueY(java.lang.Number n)
Sets the minimum y-axis value.

Specified by:
setMinimumValueY in interface ChartDataModel
Parameters:
n - the new minimum y value
See Also:
ChartDataModel.setMinimumValueY(java.lang.Number)

getDataSetName

public java.lang.String getDataSetName(int set)
Returns the title of the DataSet.

Specified by:
getDataSetName in interface ChartDataModel
Parameters:
set - the DataSet identifier
Returns:
the the number of the DataSet per default.

equals

public boolean equals(java.lang.Object o)
Compares this ChartDataModel with another object.

Overrides:
equals in class java.lang.Object
Parameters:
o - the object to compare with
Returns:
true, if o is an AbstractChartDataModel, the number of DataSets is equal and all DataSet names and column values are equal.

getOrderedValues

protected abstract java.util.TreeSet getOrderedValues(int axis)

getFirstColumnValue

protected abstract double getFirstColumnValue()

getLastColumnValue

protected abstract double getLastColumnValue()