org.jscience.swing.joggle
Class DefaultJoggleModel

java.lang.Object
  extended by org.jscience.swing.joggle.DefaultJoggleModel
All Implemented Interfaces:
JoggleModel

public class DefaultJoggleModel
extends java.lang.Object
implements JoggleModel

A default implementation of the JoggleModel interface.


Constructor Summary
DefaultJoggleModel()
          Creates a new DefaultJoggleModel with an initial value of 0.0, a transmissionRatio of 1.0 and no maximum and no minimum.
DefaultJoggleModel(double value)
          Creates a new DefaultJoggleModel with a transmissionRatio of 1.0 and no maximum and no minimum.
DefaultJoggleModel(double value, double transmissionRatio)
          Creates a new DefaultJoggleModel with the specified value and transmission ratio and no maximum and no minimum.
DefaultJoggleModel(double value, double transmissionRatio, double min, double max)
          Creates a new DefaultJoggleModel with the specified value, transmission ratio, minimum and maximum.
 
Method Summary
 void addChangeListener(javax.swing.event.ChangeListener l)
          DOCUMENT ME!
protected  void fireStateChanged()
          DOCUMENT ME!
 double getMaximum()
          DOCUMENT ME!
 double getMinimum()
          DOCUMENT ME!
 double getTransmissionRatio()
          Return the ratio the rotationAngle of a Joggle must be multiplied with to get the value in this model.
 double getValue()
          Returns the current value held in this model.
 void removeChangeListener(javax.swing.event.ChangeListener l)
          DOCUMENT ME!
 void setMaximum(double newMax)
          Sets the maximum to newMax and fits the minimum respectively the value to newMax if they are larger than newMax.
 void setMinimum(double newMin)
          Sets the minimum to newMin and fits the maximum respectively the value to newMin if they are less than newMin.
 void setTransmissionRatio(double newRatio)
          Sets the ratio the rotationAngle of a Joggle must be multiplied with to get the value in this model.
 void setValue(double newVal)
          Sets value to newVal but only if newVal is between the current minimum and maximum.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultJoggleModel

public DefaultJoggleModel()
Creates a new DefaultJoggleModel with an initial value of 0.0, a transmissionRatio of 1.0 and no maximum and no minimum.


DefaultJoggleModel

public DefaultJoggleModel(double value)
Creates a new DefaultJoggleModel with a transmissionRatio of 1.0 and no maximum and no minimum.

Parameters:
value - the initial value for this model

DefaultJoggleModel

public DefaultJoggleModel(double value,
                          double transmissionRatio)
Creates a new DefaultJoggleModel with the specified value and transmission ratio and no maximum and no minimum.

Parameters:
value - the initial value for this model
transmissionRatio - factor between the physical rotationAngle of a Joggle and the value in this model.

DefaultJoggleModel

public DefaultJoggleModel(double value,
                          double transmissionRatio,
                          double min,
                          double max)
Creates a new DefaultJoggleModel with the specified value, transmission ratio, minimum and maximum.

Parameters:
value - the initial value for this model
transmissionRatio - factor between the physical rotationAngle of a Joggle and the value in this model.
min - a lower limit this model's value is not able to exceed; use Double.NEGATIVE_INFINITY for no limitation
max - an upper limit this model's value is not able to exceed; use Double.POSITIVE_INFINITY for no limitation
Method Detail

setMaximum

public void setMaximum(double newMax)
Sets the maximum to newMax and fits the minimum respectively the value to newMax if they are larger than newMax.

Specified by:
setMaximum in interface JoggleModel
Parameters:
newMax - DOCUMENT ME!

getMaximum

public double getMaximum()
DOCUMENT ME!

Specified by:
getMaximum in interface JoggleModel
Returns:
DOCUMENT ME!

setMinimum

public void setMinimum(double newMin)
Sets the minimum to newMin and fits the maximum respectively the value to newMin if they are less than newMin.

Specified by:
setMinimum in interface JoggleModel
Parameters:
newMin - DOCUMENT ME!

getMinimum

public double getMinimum()
DOCUMENT ME!

Specified by:
getMinimum in interface JoggleModel
Returns:
DOCUMENT ME!

setValue

public void setValue(double newVal)
Sets value to newVal but only if newVal is between the current minimum and maximum.

Specified by:
setValue in interface JoggleModel
Parameters:
newVal - DOCUMENT ME!

getValue

public double getValue()
Returns the current value held in this model. This does not need to be the current rotationAngle of a Joggle. To get the rotationAngle of a Joggle you have to divide this value by the transmissionRatio.

Specified by:
getValue in interface JoggleModel
Returns:
DOCUMENT ME!
See Also:
getTransmissionRatio()

getTransmissionRatio

public double getTransmissionRatio()
Return the ratio the rotationAngle of a Joggle must be multiplied with to get the value in this model.

Specified by:
getTransmissionRatio in interface JoggleModel
Returns:
the ratio the rotationAngle of a Joggle must be multiplied with to get the value in this model.

setTransmissionRatio

public void setTransmissionRatio(double newRatio)
Sets the ratio the rotationAngle of a Joggle must be multiplied with to get the value in this model.

Parameters:
newRatio - factor between the physical rotationAngle of a Joggle and the value in this model.

addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener l)
DOCUMENT ME!

Specified by:
addChangeListener in interface JoggleModel
Parameters:
l - DOCUMENT ME!

removeChangeListener

public void removeChangeListener(javax.swing.event.ChangeListener l)
DOCUMENT ME!

Specified by:
removeChangeListener in interface JoggleModel
Parameters:
l - DOCUMENT ME!

fireStateChanged

protected void fireStateChanged()
DOCUMENT ME!