plugins.adufour.ezplug
Class EzVarNumeric<N extends java.lang.Number>

java.lang.Object
  extended by plugins.adufour.ezplug.EzComponent
      extended by plugins.adufour.ezplug.EzVar<N>
          extended by plugins.adufour.ezplug.EzVarNumeric<N>
Type Parameters:
N - the type of number to use in this variable
All Implemented Interfaces:
VarListener<N>
Direct Known Subclasses:
EzVarDouble, EzVarFloat, EzVarInteger

public abstract class EzVarNumeric<N extends java.lang.Number>
extends EzVar<N>

Superclass of all variables holding a number-type variable. This class provides generic methods and graphical interface elements common to all number-type variables

Author:
Alexandre Dufour

Field Summary
 
Fields inherited from class plugins.adufour.ezplug.EzComponent
name, visible
 
Constructor Summary
protected EzVarNumeric(Var<N> variable, N[] defaultValues, int defaultValueIndex, boolean allowUserInput)
           
protected EzVarNumeric(Var<N> variable, VarEditorModel<N> constraint)
           
 
Method Summary
 N getMaxValue()
          Gets the maximum value of this variable
 N getMinValue()
          Gets the minimum value of this variable
 N getStep()
          Gets the step value of this variable
 void setMaxValue(java.lang.Comparable<N> maxValue)
          Sets the minimum value for the JSpinner component
 void setMinValue(java.lang.Comparable<N> minValue)
          Sets the minimum value for the JSpinner component
 void setStep(N step)
          Sets the step between consecutive values
 void setValues(N value, java.lang.Comparable<N> min, java.lang.Comparable<N> max, N step)
          Sets the news value of the variable.
 
Methods inherited from class plugins.adufour.ezplug.EzVar
addTo, addVarChangeListener, addVisibilityTriggerTo, dispose, fireVariableChanged, getDefaultValues, getValue, getValue, getVarEditor, getVariable, isEnabled, referenceChanged, removeAllVarChangeListeners, removeVarChangeListener, setDefaultValues, setEnabled, setOptional, setToolTipText, setValue, setVisible, toString, updateVisibilityChain, valueChanged
 
Methods inherited from class plugins.adufour.ezplug.EzComponent
getGroup, getVisible, isVisible, setGroup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EzVarNumeric

protected EzVarNumeric(Var<N> variable,
                       VarEditorModel<N> constraint)

EzVarNumeric

protected EzVarNumeric(Var<N> variable,
                       N[] defaultValues,
                       int defaultValueIndex,
                       boolean allowUserInput)
Method Detail

getMinValue

public N getMinValue()
Gets the minimum value of this variable

Throws:
java.lang.UnsupportedOperationException - If the graphical component of this variable is not a JSpinner object

setMinValue

public void setMinValue(java.lang.Comparable<N> minValue)
                 throws java.lang.UnsupportedOperationException
Sets the minimum value for the JSpinner component

Parameters:
minValue -
Throws:
java.lang.UnsupportedOperationException - If the graphical component of this variable is not a JSpinner object

getStep

public N getStep()
                                   throws java.lang.UnsupportedOperationException
Gets the step value of this variable

Throws:
java.lang.UnsupportedOperationException - If the graphical component of this variable is not a JSpinner object

setStep

public void setStep(N step)
             throws java.lang.UnsupportedOperationException
Sets the step between consecutive values

Parameters:
step -
Throws:
java.lang.UnsupportedOperationException - If the graphical component of this variable is not a JSpinner object

getMaxValue

public N getMaxValue()
Gets the maximum value of this variable

Throws:
java.lang.UnsupportedOperationException - If the graphical component of this variable is not a JSpinner object

setMaxValue

public void setMaxValue(java.lang.Comparable<N> maxValue)
Sets the minimum value for the JSpinner component

Parameters:
maxValue -
Throws:
java.lang.UnsupportedOperationException - If the graphical component of this variable is not a JSpinner object

setValues

public void setValues(N value,
                      java.lang.Comparable<N> min,
                      java.lang.Comparable<N> max,
                      N step)
Sets the news value of the variable. This method only works if the component is a JSpinner object

Parameters:
value - the new value
max - the new max bound
min - the new min bound
step - the new step
Throws:
java.lang.UnsupportedOperationException - If the graphical component of this variable is not a JSpinner object