jvx.gui

## Class PuColorBar

- java.lang.Object
- - jv.object.PsObject
  - - jvx.gui.PuColorBar

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, PsUpdateIf

      public class PuColorBar
      extends PsObject

  Java AWT component representing a color bar. It shows color representations for all values in the interval [minValue, maxValue].

  Optional (if controls are enabled), some textfields appear below the color bar, where the user can change the min/max values for the color range.

  There are three representations of values:

  - As an absolute value.
  - As a unit value, where 0 matches minValue and 1 matches maxValue. Values which are `<0 or >1` are allowed and lie outside the view of the color bar.
  - As a color index in [0, 1]. The unit values are affine transformed and then cropped to [0, 1] resulting in the corresponding color index. The affine transformation is defined by the choice of transformMin, transformMax in [0, 1], which specify the range of the color table in the unit interval.
  See Also:
    Serialized Form
  Author:
    Matthias Nieser
  Version:
    12.12.2006, 2.00 revised (mn) Split into PuColorBar and PuColorBar_IP.
    09.12.2006, 1.15 revised (kp) Adjusted to Java 1.1.
    11.11.2006, 1.10 revised (mn) Added context menu and controls, cleaned code.
    26.09.2006, 1.00 created (mn)

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `int` | `COLOR_MAP_3COLS` Use PuTripleColorTable as color table.
    `int` | `COLOR_MAP_BOOLEAN` Use PuBooleanColorTable as color table.
    `int` | `COLOR_MAP_JAVAVIEW` Use PuJvColorTable as color table.
    `int` | `INTERP_CONSTANT_LEFT` Interpolation rule.
    `int` | `INTERP_CONSTANT_RIGHT` Interpolation rule.
    `int` | `INTERP_LINEAR` Interpolation rule.

    - ### Fields inherited from class jv.object.PsObject

      `HAS_BOUNDARY_PANEL, HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_LABEL_PANEL, HAS_MATERIAL_PANEL, HAS_TEXTURE_PANEL, HAS_VECTOR_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_FOCUSSED, IS_PICKED, IS_SELECTED, IS_USED, NUM_TAGS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PuColorBar()` Construct a new ColorBar without controls.
    `PuColorBar(boolean controls)` Construct a new ColorBar.
    `PuColorBar(boolean controls, boolean allowMark, boolean allowContextMenu)` Construct a new ColorBar.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `allowContextMenu(boolean allow)` Set whether the context menu is enabled.
    `void` | `allowMark(boolean allow)` Set whether the user is allowed to mark regions in the color bar.
    `java.awt.Color` | `getBackColor()` Set background color for excluded elements.
    `PuColorBarCanvas` | `getCanvas()` Get canvas of color bar.
    `java.awt.Color` | `getColor(double value)` Get color of an absolute value.
    `java.awt.Color` | `getMarkColor()` Set color for marked elements.
    `void` | `init()` If instance has missing name then assign default name 'Object_NUMBER' where number is the total number of already created instances.
    `boolean` | `isContextMenuAllowed()` Whether the context menu is enabled.
    `boolean` | `isMarkAllowed()` Whether the user is allowed to mark regions in the color bar.
    `boolean` | `isMarked(double value)` Whether an absolute value is marked.
    `void` | `setBackColor(java.awt.Color bc)` Set background color for excluded elements.
    `void` | `setBounds(double minValue, double maxValue)` Set minimum and maximum bound for color map.
    `void` | `setColorTable(int ind)` Set color map to one of the predefined color maps.
    `void` | `setColorTable(PuColorMapIf colorTable)` Set the color table.
    `void` | `setEnabled(boolean state)`
    `void` | `setMarkColor(java.awt.Color mc)` Set color for marked elements.
    `void` | `setMaxMark(double maxMark)` Set right boundary of marked region in [0, 1].
    `void` | `setMaxValue(double maxValue)` Set maximum bound for color map as absolute value.
    `void` | `setMinMark(double minMark)` Set left boundary of marked region in [0, 1].
    `void` | `setMinValue(double minValue)` Set minimum bound for color map as absolute value.
    `void` | `setTransformMax(double transformMax)` Set maximum bound for color map in [0, 1].
    `void` | `setTransformMin(double transformMin)` Set minimum bound for color map in [0, 1].
    `double` | `transformAbsoluteValueToColorIndex(double value)` Transforms an absolute value to the corresponding position in [0, 1] of the color in the color map.
    `boolean` | `update(java.lang.Object event)` Update all inspector panels, send update to all registered update listeners and finally update parent.

    - ### Methods inherited from class jv.object.PsObject

      `addInspector, addUpdateListener, assureInspector, clearTag, clone, clone, clone, copy, getFather, getInfoPanel, getInspector, getName, getNumObjects, getSymbol, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, newInspector, newInspector, removeInspector, removeInspector, removeUpdateListener, setName, setParent, setSymbol, setTag, toString, updatePanels`

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

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

- - ### Field Detail

    - #### COLOR_MAP_JAVAVIEW

          public final int COLOR_MAP_JAVAVIEW

      Use PuJvColorTable as color table.
      See Also:
        Constant Field Values

    - #### COLOR_MAP_3COLS

          public final int COLOR_MAP_3COLS

      Use PuTripleColorTable as color table.
      See Also:
        Constant Field Values

    - #### COLOR_MAP_BOOLEAN

          public final int COLOR_MAP_BOOLEAN

      Use PuBooleanColorTable as color table.
      See Also:
        Constant Field Values

    - #### INTERP_CONSTANT_LEFT

          public final int INTERP_CONSTANT_LEFT

      Interpolation rule. Each interval gets the color of its left node.
      See Also:
        Constant Field Values

    - #### INTERP_CONSTANT_RIGHT

          public final int INTERP_CONSTANT_RIGHT

      Interpolation rule. Each interval gets the color of its right node.
      See Also:
        Constant Field Values

    - #### INTERP_LINEAR

          public final int INTERP_LINEAR

      Interpolation rule. Linear interpolation between the nodes.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### PuColorBar

          public PuColorBar()

      Construct a new ColorBar without controls.

    - #### PuColorBar

          public PuColorBar(boolean controls)

      Construct a new ColorBar.
      Parameters:
        `controls` - Show controls below the bar.

    - #### PuColorBar

          public PuColorBar(boolean controls,
                            boolean allowMark,
                            boolean allowContextMenu)

      Construct a new ColorBar.
      Parameters:
        `controls` - Show controls below the bar.
        `allowMark` - Allow marked regions.
        `allowContextMenu` - Allow the context menu.

  - ### Method Detail

    - #### init

          public void init()

      If instance has missing name then assign default name 'Object_NUMBER' where number is the total number of already created instances.
      Overrides:
        `init` in class `PsObject`

    - #### update

          public boolean update(java.lang.Object event)

      Update all inspector panels, send update to all registered update listeners and finally update parent. Each of those updates has this object as event independent of the argument of this method.

      Central update method of this object. Must be overwritten if this class receives unknown events, say, from new children. Any subclass must class invoke super.update(event) on all events it does handle itself.

      Specified by:
        `update` in interface `PsUpdateIf`
      Overrides:
        `update` in class `PsObject`
      Parameters:
        `event` - carries a lot of information
      Returns:
        true if event has been handled, otherwise false
      See Also:
        `PsObject.setParent(jv.object.PsUpdateIf)`, `PsObject.getFather()`, `PsObject.addUpdateListener(jv.object.PsUpdateIf)`

    - #### getCanvas

          public PuColorBarCanvas getCanvas()

      Get canvas of color bar.

    - #### setTransformMin

          public void setTransformMin(double transformMin)

      Set minimum bound for color map in [0, 1].
      Version:
        26.09.2006, 1.00 created (mn)

    - #### setTransformMax

          public void setTransformMax(double transformMax)

      Set maximum bound for color map in [0, 1].
      Version:
        26.09.2006, 1.00 created (mn)

    - #### setMinValue

          public void setMinValue(double minValue)

      Set minimum bound for color map as absolute value.
      Version:
        26.09.2006, 1.00 created (mn)

    - #### setMaxValue

          public void setMaxValue(double maxValue)

      Set maximum bound for color map as absolute value.
      Version:
        26.09.2006, 1.00 created (mn)

    - #### setBounds

          public void setBounds(double minValue,
                                double maxValue)

      Set minimum and maximum bound for color map.
      Version:
        26.09.2006, 1.00 created (mn)

    - #### setMinMark

          public void setMinMark(double minMark)

      Set left boundary of marked region in [0, 1].

    - #### setMaxMark

          public void setMaxMark(double maxMark)

      Set right boundary of marked region in [0, 1].

    - #### setColorTable

          public void setColorTable(PuColorMapIf colorTable)

      Set the color table.

    - #### setColorTable

          public void setColorTable(int ind)

      Set color map to one of the predefined color maps. See the public constants COLOR_MAP_...
      Version:
        11.11.2006, 1.00 created (mn)

    - #### setBackColor

          public void setBackColor(java.awt.Color bc)

      Set background color for excluded elements.

    - #### getBackColor

          public java.awt.Color getBackColor()

      Set background color for excluded elements.

    - #### setMarkColor

          public void setMarkColor(java.awt.Color mc)

      Set color for marked elements.

    - #### getMarkColor

          public java.awt.Color getMarkColor()

      Set color for marked elements.

    - #### allowMark

          public void allowMark(boolean allow)

      Set whether the user is allowed to mark regions in the color bar.

    - #### isMarkAllowed

          public boolean isMarkAllowed()

      Whether the user is allowed to mark regions in the color bar.

    - #### allowContextMenu

          public void allowContextMenu(boolean allow)

      Set whether the context menu is enabled.

    - #### isContextMenuAllowed

          public boolean isContextMenuAllowed()

      Whether the context menu is enabled.

    - #### transformAbsoluteValueToColorIndex

          public double transformAbsoluteValueToColorIndex(double value)

      Transforms an absolute value to the corresponding position in [0, 1] of the color in the color map.
      Version:
        26.09.2006, 1.00 created (mn)

    - #### getColor

          public java.awt.Color getColor(double value)

      Get color of an absolute value.

    - #### isMarked

          public boolean isMarked(double value)

      Whether an absolute value is marked.

    - #### setEnabled

          public void setEnabled(boolean state)

"

The software JavaView? is copyright protected. All Rights Reserved.
"