org.vishia.gral.base

## Class GralValueBar

- java.lang.Object
- - org.vishia.gral.base.GralWidget
  - - org.vishia.gral.base.GralValueBar

- All Implemented Interfaces:
    GetGralWidget_ifc, GralSetValue_ifc, GralWidget_ifc, Removeable

      public class GralValueBar
      extends GralWidget
      implements GralSetValue_ifc

  This is a common base class for a ValueBar-widget. It is designed as a container for the widget. The widget itself is derived from the graphical base class, for example from org.eclipse.swt.widgets.Canvas if the SWT-graphic is used, or from java.awt.canvas if Swing is used.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `GralValueBar.ColorValues`
    `class` | `GralValueBar.GraphicImplAccess`

    - ### Nested classes/interfaces inherited from class org.vishia.gral.base.GralWidget

      `GralWidget.ActionChangeSelect, GralWidget.ConfigData, GralWidget.DynamicData, GralWidget.ImplAccess`

    - ### Nested classes/interfaces inherited from interface org.vishia.gral.ifc.GralWidget_ifc

      `GralWidget_ifc.ActionChange, GralWidget_ifc.ActionChangeWhen`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected float[]` | `fLevels`
    `protected float` | `maxRange`
    `protected float` | `minRange`
    `protected java.lang.String[]` | `sColorLevels`
    `static int` | `version` Version, history and license.

    - ### Fields inherited from class org.vishia.gral.base.GralWidget

      `_wdgImpl, bEditable, bHasFocus, bShouldInitialize, buildMng, bVisibleState, cfg, contextMenu, dateUser, dyda, htmlHelp, itsMng, lastTimeSetVisible, name, repaintDelay, repaintDelayMax, sCmd, sFormat, sToolTip, sVersion, whatIs`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GralValueBar(java.lang.String name)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `setBorderAndColors(java.lang.String[] sParam)` Associates values to level and color.
    `void` | `setMinMax(float minValue, float maxValue)` Sets the border of the value range for showing.
    `void` | `setValue(float value)` Sets the bar and its color.

    - ### Methods inherited from class org.vishia.gral.base.GralWidget

      `chgPos, clearShowParam, createImplWidget_Gthread, getActionChange, getActionChangeStrict, getActionDrag, getActionDrop, getActionFocused, getActionShow, getBackColor, getCfgElement, getCmd, getCmd, getContentIdent, getContentInfo, getContextMenu, getData, getDataIx, getDataPath, getDataPath, getFloatValue, getFormat, getGralWidget, getHtmlHelp, getImpl, getItsPanel, getLongValue, getName, getShowMethod, getShowParam, getsToolTip, getText, getValue, getVariable, getVariableFromContentInfo, gralMng, isChanged, isEditable, isGraphicDisposed, isInFocus, isNotEditableOrShouldInitialize, isVisible, pos, refreshFromVariable, refreshFromVariable, registerWidget, remove, repaint, repaint, requestNewValueForVariable, setActionChange, setActionFocused, setActionMouse, setActionShow, setBackColor, setBackgroundColor, setBoundsPixel, setCfgElement, setCmd, setContentIdent, setContentInfo, setData, setDataIx, setDataPath, setDragEnable, setDropEnable, setEditable, setFocus, setFocus, setForegroundColor, setFormat, setHtmlHelp, setLineColor, setLongValue, setPanelMng, setPrimaryWidgetOfPanel, setText, setTextColor, setToolTip, setToPanel, setValue, setValue, setValue, setVisible, setVisibleState, setVisibleStateWidget, specifyActionChange, specifyContextMenu, stop, toString, XXXgetPixelPositionSize, XXXgetWidgetImplementation, XXXremoveWidgetImplementation, XXXrepaintGthread, XXXsetFocusGThread, XXXsetVisibleGThread`

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

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

    - ### Methods inherited from interface org.vishia.gral.ifc.GralSetValue_ifc

      `getContentInfo, getDataIx, getDataPath, setContentInfo, setDataIx, setDataPath, setLongValue, setText, setValue`

- - ### Field Detail

    - #### version

          public static final int version

      Version, history and license.
      - 2014-02-11 Hartmut new: new Widget concept
      - 2010-06-00 Hartmut created
      Copyright/Copyleft:
      For this source the LGPL Lesser General Public License, published by the Free Software Foundation is valid. It means:
      1. You can use this source without any restriction for any desired purpose.
      2. You can redistribute copies of this source to everybody.
      3. Every user of this source, also the user of redistribute copies with or without payment, must accept this license for further using.
      4. But the LPGL is not appropriate for a whole software product, if this source is only a part of them. It means, the user must publish this part of source, but doesn't need to publish the whole source of the own product.
      5. You can study and modify (improve) this source for own using or for redistribution, but you have to license the modified sources likewise under this LGPL Lesser General Public License. You mustn't delete this Copyright/Copyleft inscription in this source file.
      If you intent to use this source without publishing its usage, you can get a second license subscribing a special contract with the author.
      See Also:
        Constant Field Values

    - #### minRange

          protected float minRange

    - #### maxRange

          protected float maxRange

    - #### fLevels

          protected float[] fLevels

    - #### sColorLevels

          protected java.lang.String[] sColorLevels

  - ### Constructor Detail

    - #### GralValueBar

          public GralValueBar(java.lang.String name)

  - ### Method Detail

    - #### setMinMax

          public void setMinMax(float minValue,
                                float maxValue)

      Description copied from class: `GralWidget`
      Sets the border of the value range for showing. If it is a ValueBar, for exmaple, it is the value for 0% and 100% This routine is empty per default, should be overridden if it is necessary.
      Specified by:
        `setMinMax` in interface `GralSetValue_ifc`
      Overrides:
        `setMinMax` in class `GralWidget`

    - #### setBorderAndColors

          public void setBorderAndColors(java.lang.String[] sParam)

      Associates values to level and color.
      - The first and the last String is the min and max values.
      - All odd Strings (0, 2, ...) are values, the following String is the color.
      - For example {"-100","red","0","green","100","orange", "200"}
      The example shows a value bar from -100 to 200. A value < 0 is shown red, >100 is shown organge. This form of parameter allows a simple preparation from a simple String, for example

           String param = "-100,red,0,green,100,orange,200";
           String[] sParam = param.tokenize(",");

      Parameters:
        `sParam` - Even number of Strings.

    - #### setValue

          public void setValue(float value)

      Sets the bar and its color. A refresh of graphic is only done if the value change forces a change of pixel positions of the value bar. Less changes of value does not force refresh.
      Specified by:
        `setValue` in interface `GralSetValue_ifc`
      Overrides:
        `setValue` in class `GralWidget`
      Parameters:
        `value` - This routine may be overridden by some specialized widgets.
      See Also:
        `GralWidget.setValue(float)`