uk.org.toot.control
Class LawControl

java.lang.Object
  extended by java.util.Observable
      extended by uk.org.toot.control.Control
          extended by uk.org.toot.control.LawControl
Direct Known Subclasses:
FaderControl, FloatControl

public class LawControl
extends Control

A LawControl enables control of a float value using the specified control law.


Constructor Summary
LawControl(int id, java.lang.String name, ControlLaw law, float precision, float initialValue)
           
 
Method Summary
 void applyPreset(java.lang.String name)
           
 java.awt.Color getInsertColor()
           
 int getIntValue()
           
 ControlLaw getLaw()
           
 float getPrecision()
          Obtains the precision or granularity of the control, in the units that the control measures.
 java.lang.String[] getPresetNames()
           
 float getValue()
          Obtains this control's current value.
 java.lang.String getValueString()
          override for real value strings where possible
 void setInsertColor(java.awt.Color insertColor)
           
 void setIntValue(int value)
           
 void setValue(float value)
          Sets the current value for the control.
 
Methods inherited from class uk.org.toot.control.Control
getAnnotation, getControlPath, getControlPath, getId, getName, getParent, isAdjusting, isEnabled, isHidden, isIndicator, setAdjusting, setAnnotation, setEnabled, setHidden, setName, toString
 
Methods inherited from class java.util.Observable
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LawControl

public LawControl(int id,
                  java.lang.String name,
                  ControlLaw law,
                  float precision,
                  float initialValue)
Method Detail

getLaw

public ControlLaw getLaw()

getValue

public float getValue()
Obtains this control's current value.

Returns:
the current value

getValueString

public java.lang.String getValueString()
Description copied from class: Control
override for real value strings where possible

Overrides:
getValueString in class Control

setValue

public void setValue(float value)
Sets the current value for the control. The default implementation simply sets the value as indicated. If the value indicated is greater than the maximum value, or smaller than the minimum value, an IllegalArgumentException is thrown.

Parameters:
value - the desired new value
Throws:
java.lang.IllegalArgumentException - if the value indicated does not fall within the allowable range

getPrecision

public float getPrecision()
Obtains the precision or granularity of the control, in the units that the control measures. The precision is the size of the increment between discrete valid values for this control, over the set of supported floating-point values.

Returns:
the control's precision

getInsertColor

public java.awt.Color getInsertColor()

setInsertColor

public void setInsertColor(java.awt.Color insertColor)

setIntValue

public void setIntValue(int value)
Overrides:
setIntValue in class Control

getIntValue

public int getIntValue()
Overrides:
getIntValue in class Control

getPresetNames

public java.lang.String[] getPresetNames()

applyPreset

public void applyPreset(java.lang.String name)


Copyright © 2004, 2005, 2006, 2007 Steve Taylor. All Rights Reserved.