Package voltage.core

# Class VoltageSwitch

java.lang.Object
voltage.core.VoltageComponent
voltage.core.VoltageSwitch

public class VoltageSwitch extends VoltageComponent
A multi-state switch

- ## Field Summary

  ### Fields inherited from class voltage.core.VoltageComponent

  `componentName, displayName`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `VoltageSwitch(String name, String displayName, VoltageModule module, int initState)`
  Constructor
  `VoltageSwitch(String name, VoltageModule module, int initState)`
  Constructor

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `GetDefaultState()`
  Returns the default state.
  `int`
  `GetNumStates()`
  Returns the number of states possible for this switch.
  `String`
  `GetTooltipText()`
  Gets the tooltip for the state.
  `void`
  `SetInitialState(int initState)`
  Sets the initial state of the switch.
  `void`
  `SetMouseSensitivity(double sensitivity)`
  Sets the mouse sensitivity.
  `void`
  `SetState(int newState)`
  Set a new state for the switch.
  `void`
  `SetStateNames(List<String> stringArrayList)`
  Set the state names that can appear in tooltips.
  `void`
  `SetValue(double newValue, boolean bUpdateGUI)`
  Sets the value or state of the switch.
  `void`
  `SetValueNoNotification(double newValue, boolean bUpdateGUI)`
  Sets the value or state of the switch without sending a notification.

  ### Methods inherited from class voltage.core.VoltageComponent

  `AddChildComponent, GetComponentID, GetDisplayName, GetHeight, GetMaxValue, GetMinValue, GetRect, GetSkin, GetTransparency, GetUserProperty, GetValue, GetWidth, GetX, GetY, IsEnabled, IsVisible, RemoveChildComponent, SetCanBeAutomated, SetEnabled, SetPosition, SetRect, SetRect, SetSize, SetSkin, SetTransparency, SetUnits, SetUserProperty, SetValue, SetVisible, SetWantsMouseNotifications, SetZOrder, SkewNormalizedValue, UpdateGUIValue, WantsMouseNotifications`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### VoltageSwitch

    public VoltageSwitch(String name, VoltageModule module, int initState)
    Constructor
    Parameters:
      `name` - internal name.
      `module` - the module this belongs to.
      `initState` - the default state of the switch - Valid values are 0 to number of states -1

  - ### VoltageSwitch

    public VoltageSwitch(String name, String displayName, VoltageModule module, int initState)
    Constructor
    Parameters:
      `name` - internal name.
      `displayName` - the display name.
      `module` - the module this belongs to.
      `initState` - the default state of the switch - Valid values are 0 to number of states -1

- ## Method Details

  - ### SetState

    public void SetState(int newState)
    Set a new state for the switch.
    Parameters:
      `newState` - is value from 0 to the number of states -1 .

  - ### SetStateNames

    public void SetStateNames(List<String> stringArrayList)
    Set the state names that can appear in tooltips.
    Parameters:
      `stringArrayList` - a list of state names.

  - ### SetMouseSensitivity

    public void SetMouseSensitivity(double sensitivity)
    Sets the mouse sensitivity.
    Parameters:
      `sensitivity` - sets the mouse sensitivity indicating how far the mouse has to drag to traverse the whole range of the switch (0.1 to 4.0 ) Normal sensitivity is 1.0

  - ### SetValue

    public void SetValue(double newValue, boolean bUpdateGUI)
    Sets the value or state of the switch.
    Overrides:
      `SetValue` in class `VoltageComponent`
    Parameters:
      `newValue` - a value from 0 to the number of states -1.
      `bUpdateGUI` - set to true to update the graphics.

  - ### SetValueNoNotification

    public void SetValueNoNotification(double newValue, boolean bUpdateGUI)
    Sets the value or state of the switch without sending a notification.
    Overrides:
      `SetValueNoNotification` in class `VoltageComponent`
    Parameters:
      `newValue` - a value from 0 to the number of states -1.
      `bUpdateGUI` - set to true to update the graphics.

  - ### GetTooltipText

    public String GetTooltipText()
    Gets the tooltip for the state. If the state has been named, this will return the text fo the state.
    Overrides:
      `GetTooltipText` in class `VoltageComponent`
    Returns:
      The tool tip text for this control
    See Also:
      - `SetStateNames(java.util.List<java.lang.String>)`

  - ### GetDefaultState

    public int GetDefaultState()
    Returns the default state.
    Returns:
      the default state which should be from 0 to the number of states - 1.

  - ### GetNumStates

    public int GetNumStates()
    Returns the number of states possible for this switch.
    Returns:
      the number of states.

  - ### SetInitialState

    public void SetInitialState(int initState)
    Sets the initial state of the switch.
    Parameters:
      `initState` - the initial state to set the switch. From (0 to number of states - 1 )