uic.model
Class SpinboxModel

java.lang.Object
  extended by uic.model.SpinboxModel
All Implemented Interfaces:
SpinboxModelInterface

public class SpinboxModel
extends Object
implements SpinboxModelInterface


Constructor Summary
SpinboxModel(double initialValue, double min, double max, double step)
          Constructor.
SpinboxModel(int initialValue, int min, int max, int step)
          Constructor.
SpinboxModel(Number initialValue, Number min, Number max)
          Constructor.
SpinboxModel(Number initialValue, Number min, Number max, Number step)
          Constructor.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
           
 Number getDelta()
           
 Number getMaximumValue()
          Return the maximum value possible.
 Number getMinimumValue()
          Return the minimum value possible.
 Number getNextValue()
           
 Number getPreviousValue()
           
 Number getStepSize()
           
 Number getValue()
           
 void removePropertyChangeListener(PropertyChangeListener listener)
           
 void setDelta(Number delta)
           
 void setMaximumValue(Number max)
           
 void setMinimumValue(Number min)
           
 void setRange(Number min, Number max)
          Sets the range of possible values.
 void setStepSize(Number step)
           
 void setValue(Number value)
          Sets the value of the model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpinboxModel

public SpinboxModel(Number initialValue,
                    Number min,
                    Number max)
Constructor. Creates a spinboxmodel without a stepsize

Parameters:
initialValue - the initial value of this model
min - the minimum value this model can contain
max - the maximum value this model can contain

SpinboxModel

public SpinboxModel(int initialValue,
                    int min,
                    int max,
                    int step)
Constructor.

Parameters:
initialValue - the initial value of this model
min - the minimum value this model can contain
max - the maximum value this model can contain
step - the steps that are allowed to increase the value with

SpinboxModel

public SpinboxModel(double initialValue,
                    double min,
                    double max,
                    double step)
Constructor.

Parameters:
initialValue - the initial value of this model
min - the minimum value this model can contain
max - the maximum value this model can contain
step - the steps that are allowed to increase the value with

SpinboxModel

public SpinboxModel(Number initialValue,
                    Number min,
                    Number max,
                    Number step)
Constructor.

Parameters:
initialValue - the initial value of this model
min - the minimum value this model can contain
max - the maximum value this model can contain
step - the steps that are allowed to increase the value with
Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Specified by:
addPropertyChangeListener in interface SpinboxModelInterface

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Specified by:
removePropertyChangeListener in interface SpinboxModelInterface

getValue

public Number getValue()
Specified by:
getValue in interface SpinboxModelInterface

setValue

public void setValue(Number value)
Sets the value of the model. SpinboxModel model = new SpinboxModel(0, 0, 10, 2); model.setValue(0); // will result in 0 in the ui model.setValue(2); // will result in 2 in the ui model.setValue(1); // will result in 2 in the ui SpinboxModel model = new SpinboxModel(1, 1, 10, 2); model.setValue(1); // will result in 1 in the ui model.setValue(3); // will result in 3 in the ui model.setValue(2); // will result in 3 in the ui

Specified by:
setValue in interface SpinboxModelInterface
Parameters:
value - the value to be set to the model
Throws:
IllegalArgumentException - when the value set is invalid according to the min/max/stepsize set.

getMinimumValue

public Number getMinimumValue()
Return the minimum value possible.

Specified by:
getMinimumValue in interface SpinboxModelInterface
Returns:
the minimum value
See Also:
to set the minimum value

setMinimumValue

public void setMinimumValue(Number min)

getMaximumValue

public Number getMaximumValue()
Return the maximum value possible.

Specified by:
getMaximumValue in interface SpinboxModelInterface
Returns:
the maximum value
See Also:
to set the maximum value

setMaximumValue

public void setMaximumValue(Number max)

setRange

public void setRange(Number min,
                     Number max)
Sets the range of possible values.

Parameters:
min - the minimum value
max - the maximum value
Throws:
IllegalArgumentException - when min <= max

getStepSize

public Number getStepSize()

setStepSize

public void setStepSize(Number step)

setDelta

public void setDelta(Number delta)

getDelta

public Number getDelta()

getNextValue

public Number getNextValue()
Specified by:
getNextValue in interface SpinboxModelInterface

getPreviousValue

public Number getPreviousValue()
Specified by:
getPreviousValue in interface SpinboxModelInterface


Copyright © 2002-2004 Thomas Zander Available under the Free Apache licence