gpl.fredy.generate
Class DoubleSpinnerModel

java.lang.Object
  extended by mseries.ui.DefaultSpinnerModel
      extended by gpl.fredy.generate.DoubleSpinnerModel
All Implemented Interfaces:
mseries.ui.SpinnerModel

public class DoubleSpinnerModel
extends mseries.ui.DefaultSpinnerModel

Model for MSpinner to manage Double. The range of parameters are expressed in the constructors


Field Summary
protected  double max
          The default maximum value
protected  double min
          The default minimum value
protected  double step
           
 
Constructor Summary
DoubleSpinnerModel()
           
DoubleSpinnerModel(java.lang.Double start, java.lang.Comparable max, java.lang.Comparable min, double step, boolean roll)
          Constructor
DoubleSpinnerModel(double start, double max, double min, double step, boolean roll)
          Constructor
 
Method Summary
 java.lang.Comparable getMaximum()
          Returns the current maximum value
 java.lang.Comparable getMinimum()
          Returns the current minimum value
 java.lang.Object getNextValue()
          Advances and returns the current value in the sequence according to the step, maximum value and roll attribute
 java.lang.Object getPreviousValue()
          Retracts and returns the current value in the sequence according to the step, minimum value and roll attribute
 java.lang.Object getValue()
          Returns the current value of the field
 void setMaximum(java.lang.Comparable max)
          Used to force a maximum value when the field is incremented using the up button
 void setMaximum(double max)
          Used to force a maximum value when the field is incremented using the up button
 void setMinimum(java.lang.Comparable min)
          Used to force a minimum value when the field is decremented using the down button
 void setMinimum(double min)
          Used to force a minimum value when the field is decremented using the down button
 void setStep(int step)
          Doesn't need to do anything for Integers, the step is set when the model is constructed.
 void setValue(double newValue)
          Sets the value
 void setValue(java.lang.Object newValue)
          Sets the value
 
Methods inherited from class mseries.ui.DefaultSpinnerModel
addChangeListener, notifyListeners, removeChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

min

protected double min
The default minimum value


max

protected double max
The default maximum value


step

protected double step
Constructor Detail

DoubleSpinnerModel

public DoubleSpinnerModel()

DoubleSpinnerModel

public DoubleSpinnerModel(java.lang.Double start,
                          java.lang.Comparable max,
                          java.lang.Comparable min,
                          double step,
                          boolean roll)
Constructor

Parameters:
start - the initial value
max - the maximum value
min - the minimum value
step - the amount to increment/decrement the value by when getNextValue/getPreviousValue are executed
roll - true if the value rolls over the maximum back to the minimum

DoubleSpinnerModel

public DoubleSpinnerModel(double start,
                          double max,
                          double min,
                          double step,
                          boolean roll)
Constructor

Parameters:
start - the initial value
max - the maximum value
min - the minimum value
step - the amount to increment/decrement the value by when getNextValue/getPreviousValue are executed
roll - true if the value rolls over the maximum back to the minimum
Method Detail

setStep

public void setStep(int step)
Doesn't need to do anything for Integers, the step is set when the model is constructed.

Specified by:
setStep in interface mseries.ui.SpinnerModel
Overrides:
setStep in class mseries.ui.DefaultSpinnerModel

getValue

public java.lang.Object getValue()
Returns the current value of the field

Specified by:
getValue in interface mseries.ui.SpinnerModel
Overrides:
getValue in class mseries.ui.DefaultSpinnerModel
Returns:
the current value of the field

setValue

public void setValue(double newValue)
Sets the value

Parameters:
newValue - the new value

setValue

public void setValue(java.lang.Object newValue)
Sets the value

Specified by:
setValue in interface mseries.ui.SpinnerModel
Overrides:
setValue in class mseries.ui.DefaultSpinnerModel
Parameters:
newValue - the new value

getNextValue

public java.lang.Object getNextValue()
Advances and returns the current value in the sequence according to the step, maximum value and roll attribute

Specified by:
getNextValue in interface mseries.ui.SpinnerModel
Overrides:
getNextValue in class mseries.ui.DefaultSpinnerModel
Returns:
the next value

getPreviousValue

public java.lang.Object getPreviousValue()
Retracts and returns the current value in the sequence according to the step, minimum value and roll attribute

Specified by:
getPreviousValue in interface mseries.ui.SpinnerModel
Overrides:
getPreviousValue in class mseries.ui.DefaultSpinnerModel
Returns:
the next value

setMinimum

public void setMinimum(java.lang.Comparable min)
Used to force a minimum value when the field is decremented using the down button

Parameters:
min - the minimum value

setMinimum

public void setMinimum(double min)
Used to force a minimum value when the field is decremented using the down button

Parameters:
min - the minimum value

getMinimum

public java.lang.Comparable getMinimum()
Returns the current minimum value

Returns:
The current minimum value

setMaximum

public void setMaximum(java.lang.Comparable max)
Used to force a maximum value when the field is incremented using the up button

Parameters:
max - the maximum value

setMaximum

public void setMaximum(double max)
Used to force a maximum value when the field is incremented using the up button

Parameters:
max - the maximum value

getMaximum

public java.lang.Comparable getMaximum()
Returns the current maximum value

Returns:
The current maximum value