org.vishia.gral.widget

## Class GralSwitchExclusiveButtonMng

- java.lang.Object
- - org.vishia.gral.widget.GralSwitchExclusiveButtonMng

- All Implemented Interfaces:
    VariableAccess_ifc

      public class GralSwitchExclusiveButtonMng
      extends java.lang.Object
      implements VariableAccess_ifc

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `(package private) java.lang.String` | `currentButtonText`
    `private java.util.List<GralWidget>` | `listSwitchButtons`
    `GralUserAction` | `switchAction`

    - ### Fields inherited from interface org.vishia.byteData.VariableAccess_ifc

      `version`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GralSwitchExclusiveButtonMng()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(GralWidget widgd)`
    `double` | `getDouble()` Gets the value from this variable.
    `float` | `getFloat()` Gets the value from this variable.
    `int` | `getInt()` Gets a integer value from this variable.
    `long` | `getLastRefreshTime()` Gets the time stamp when this variable was refreshed lastly.
    `long` | `getLong()` Gets a long value from this variable.
    `java.lang.String` | `getString()` Gets the value from this variable.
    `char` | `getType()` Returns the type of the variable:
    `boolean` | `isRefreshed()` Returns true if the variable was refresed after it was requested.
    `boolean` | `isRequestedValue(long timeEarlyRequested, boolean retryFaultyVariables)` Returns true if the request is newer than the last refresh.
    `void` | `remove(GralWidget widgd)`
    `void` | `requestValue()` Requests a new value from the target device with the `System.currentTimeMillis()`
    `void` | `requestValue(long timeRequested)` Requests a new value from the target device.
    `void` | `requestValue(long timeRequested, java.lang.Runnable run)` Requests a new value from the target device.
    `double` | `setDouble(double value)` Sets the value from this variable.
    `float` | `setFloat(float value)` Sets the value from this variable.
    `int` | `setInt(int value)` Sets the value into the variable.
    `long` | `setLong(long value)` Sets the value into the variable.
    `void` | `setRefreshed(long time)`
    `java.lang.String` | `setString(java.lang.String value)` Sets the value into the variable

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

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

- - ### Field Detail

    - #### listSwitchButtons

          private final java.util.List<GralWidget> listSwitchButtons

    - #### currentButtonText

          java.lang.String currentButtonText

    - #### switchAction

          public GralUserAction switchAction

  - ### Constructor Detail

    - #### GralSwitchExclusiveButtonMng

          public GralSwitchExclusiveButtonMng()

  - ### Method Detail

    - #### add

          public void add(GralWidget widgd)

    - #### remove

          public void remove(GralWidget widgd)

    - #### getInt

          public int getInt()

      Description copied from interface: `org.vishia.byteData.VariableAccess_ifc`
      Gets a integer value from this variable. The variable contains the information, whether it is long, short etc. If the variable contains a long value greater as the integer range, an IllegalArgumentException may be thrown or not, it depends on the implementation. If the variable is a float or double it may be convert to the integer format. If the variable is a boolean, it is converted to 0 or 1.
      Specified by:
        `getInt` in interface `VariableAccess_ifc`
      Returns:
        the value.

    - #### setInt

          public int setInt(int value)

      Description copied from interface: `org.vishia.byteData.VariableAccess_ifc`
      Sets the value into the variable. If the variable is of byte or short type and the value is not able to present, an IllegalArgumentException may be thrown or not, it depends on the implementation.
      Specified by:
        `setInt` in interface `VariableAccess_ifc`
      Parameters:
        `value` - The value given as int.
      Returns:
        The value really set (maybe more imprecise).

    - #### getLong

          public long getLong()

      Description copied from interface: `org.vishia.byteData.VariableAccess_ifc`
      Gets a long value from this variable. The variable contains the information, whether it is long, short etc. If the variable is a float or double it may be convert to the long format. If the value is not able to present, an IllegalArgumentException may be thrown or not, it depends on the implementation. If the variable is a boolean, it is converted to 0 or 1.
      Specified by:
        `getLong` in interface `VariableAccess_ifc`
      Returns:
        the value.

    - #### setLong

          public long setLong(long value)

      Description copied from interface: `org.vishia.byteData.VariableAccess_ifc`
      Sets the value into the variable. If the variable is of byte, short or int type and the value is not able to present, an IllegalArgumentException may be thrown or not, it depends on the implementation.
      Specified by:
        `setLong` in interface `VariableAccess_ifc`
      Parameters:
        `value` - The value given as int.
      Returns:
        The value really set (maybe more imprecise).

    - #### getFloat

          public float getFloat()

      Description copied from interface: `org.vishia.byteData.VariableAccess_ifc`
      Gets the value from this variable. If the variable is in another format than float, a conversion to be will be done.
      Specified by:
        `getFloat` in interface `VariableAccess_ifc`
      Returns:
        the value.

    - #### setFloat

          public float setFloat(float value)

      Description copied from interface: `org.vishia.byteData.VariableAccess_ifc`
      Sets the value from this variable.
      Specified by:
        `setFloat` in interface `VariableAccess_ifc`
      Returns:
        the value.

    - #### getDouble

          public double getDouble()

      Description copied from interface: `org.vishia.byteData.VariableAccess_ifc`
      Gets the value from this variable. If the variable is in another format than double, a conversion to be will be done.
      Specified by:
        `getDouble` in interface `VariableAccess_ifc`
      Returns:
        the value.

    - #### setDouble

          public double setDouble(double value)

      Description copied from interface: `org.vishia.byteData.VariableAccess_ifc`
      Sets the value from this variable. If the variable is from float type, and the range (exponent) is able to present in float, the value will be stored in float with truncation of digits.
      Specified by:
        `setDouble` in interface `VariableAccess_ifc`
      Returns:
        the value.

    - #### getString

          public java.lang.String getString()

      Description copied from interface: `org.vishia.byteData.VariableAccess_ifc`
      Gets the value from this variable. If the variable is numerical, it is converted to a proper representation.
      Specified by:
        `getString` in interface `VariableAccess_ifc`
      Returns:
        the value.

    - #### setString

          public java.lang.String setString(java.lang.String value)

      Description copied from interface: `org.vishia.byteData.VariableAccess_ifc`
      Sets the value into the variable
      Specified by:
        `setString` in interface `VariableAccess_ifc`
      Parameters:
        `value` - The value given as String.
      Returns:
        The value really set (maybe shortened).

    - #### getType

          public char getType()

      Description copied from interface: `org.vishia.byteData.VariableAccess_ifc`
      Returns the type of the variable:
      Specified by:
        `getType` in interface `VariableAccess_ifc`
      Returns:
        B, S, I, J, F, D, s for byte, short, integer, long, float, double and string.

    - #### setRefreshed

          public void setRefreshed(long time)

      Specified by:
        `setRefreshed` in interface `VariableAccess_ifc`

    - #### getLastRefreshTime

          public long getLastRefreshTime()

      Description copied from interface: `org.vishia.byteData.VariableAccess_ifc`
      Gets the time stamp when this variable was refreshed lastly.
      Specified by:
        `getLastRefreshTime` in interface `VariableAccess_ifc`
      Returns:
        -1 if this function is not supported, 0 if this variable was never set.

    - #### isRefreshed

          public boolean isRefreshed()

      Description copied from interface: `org.vishia.byteData.VariableAccess_ifc`
      Returns true if the variable was refresed after it was requested. false if the variable was never requested or it was requested and not refreshed after them.
      Specified by:
        `isRefreshed` in interface `VariableAccess_ifc`

    - #### requestValue

          public void requestValue(long timeRequested)

      Description copied from interface: `org.vishia.byteData.VariableAccess_ifc`
      Requests a new value from the target device.
      Specified by:
        `requestValue` in interface `VariableAccess_ifc`
      Parameters:
        `timeRequested` - the current time, used to mark the request.

    - #### requestValue

          public void requestValue()

      Description copied from interface: `org.vishia.byteData.VariableAccess_ifc`
      Requests a new value from the target device with the `System.currentTimeMillis()`
      Specified by:
        `requestValue` in interface `VariableAccess_ifc`

    - #### requestValue

          public void requestValue(long timeRequested,
                                   java.lang.Runnable run)

      Description copied from interface: `org.vishia.byteData.VariableAccess_ifc`
      Requests a new value from the target device.
      Specified by:
        `requestValue` in interface `VariableAccess_ifc`
      Parameters:
        `timeRequested` - the current time
        `run` - method which should be invoked if the request is resolved, optional operation.

    - #### isRequestedValue

          public boolean isRequestedValue(long timeEarlyRequested,
                                          boolean retryFaultyVariables)

      Description copied from interface: `org.vishia.byteData.VariableAccess_ifc`
      Returns true if the request is newer than the last refresh.
      Specified by:
        `isRequestedValue` in interface `VariableAccess_ifc`
      Parameters:
        `timeEarlyRequested` - The earliest time where the variable is requested. If the request time is more early, it is not regarded. This is since 2016-01. An old request should be ignored but the time stamp of the request should be visible for debug or view the state.
        `retryFaultyVariables` - A variable which is set to invalid is requested though.
      Returns:
        true if a new value should be gotten from target.