uk.org.toot.control
Class BooleanControl

java.lang.Object
  extended by java.util.Observable
      extended by uk.org.toot.control.Control
          extended by uk.org.toot.control.BooleanControl
Direct Known Subclasses:
BusControls.SoloIndicator, CompoundControl.BypassControl, MeterControls.ResetControl

public class BooleanControl
extends Control

A BooleanControl enables control of a boolean value.


Constructor Summary
BooleanControl(int id, java.lang.String name, boolean initialValue)
          Constructs a new boolean control object with the given parameters.
BooleanControl(int id, java.lang.String name, boolean initialValue, boolean momentary)
           
BooleanControl(int id, java.lang.String name, boolean initialValue, java.lang.String trueStateLabel, java.lang.String falseStateLabel)
          Constructs a new boolean control object with the given parameters.
 
Method Summary
 int getIntValue()
           
 java.awt.Color getStateColor(boolean state)
           
 java.lang.String getStateLabel(boolean state)
          Obtains the label for the specified state.
 boolean getValue()
          Obtains this control's current value.
 java.lang.String getValueString()
          override for real value strings where possible
 boolean isMomentary()
           
 boolean isWidthLimited()
           
 void momentaryAction()
           
 void setIntValue(int value)
           
 void setStateColor(boolean state, java.awt.Color color)
           
 void setValue(boolean value)
          Sets the current value for the control.
 java.lang.String toString()
          Provides a string representation of 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
 
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

BooleanControl

public BooleanControl(int id,
                      java.lang.String name,
                      boolean initialValue,
                      java.lang.String trueStateLabel,
                      java.lang.String falseStateLabel)
Constructs a new boolean control object with the given parameters.

Parameters:
initialValue - the initial control value
trueStateLabel - the label for the state represented by true, such as "true" or "on."
falseStateLabel - the label for the state represented by false, such as "false" or "off."

BooleanControl

public BooleanControl(int id,
                      java.lang.String name,
                      boolean initialValue)
Constructs a new boolean control object with the given parameters. The labels for the true and false states default to "true" and "false."

Parameters:
id - the id of the control represented by this float control object
initialValue - the initial control value

BooleanControl

public BooleanControl(int id,
                      java.lang.String name,
                      boolean initialValue,
                      boolean momentary)
Method Detail

isMomentary

public boolean isMomentary()

setValue

public void setValue(boolean value)
Sets the current value for the control. The default implementation simply sets the value as indicated. Some controls require that their line be open before they can be affected by setting a value.

Parameters:
value - desired new value.

momentaryAction

public void momentaryAction()

getValue

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

Returns:
current value.

setStateColor

public void setStateColor(boolean state,
                          java.awt.Color color)

getStateColor

public java.awt.Color getStateColor(boolean state)

getStateLabel

public java.lang.String getStateLabel(boolean state)
Obtains the label for the specified state.

Returns:
the label for the specified state, such as "true" or "on" for true, or "false" or "off" for false.

toString

public java.lang.String toString()
Provides a string representation of the control

Overrides:
toString in class Control
Returns:
a string description

getValueString

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

Overrides:
getValueString in class Control

setIntValue

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

getIntValue

public int getIntValue()
Overrides:
getIntValue in class Control

isWidthLimited

public boolean isWidthLimited()


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