Class RangeSlider

    • Constructor Detail

      • RangeSlider

        public RangeSlider​(int renderModes,
                           com.jogamp.math.Vec2f size,
                           float knobScale,
                           com.jogamp.math.Vec2f minMax,
                           float unitSize,
                           float value)
        Constructs a RangeSlider, i.e. its shapes and controls.

        This slider comprises a background bar and a positional round knob, with getValue() at center position.

        The spatial size gets automatically updated at Shape.validate(GL2ES2)

        Parameters:
        renderModes - Graph's Region render modes, see create(..).
        size - spatial dimension of this slider box. A horizontal slider has width >= height.
        knobScale - multiple of slider-bar height for getKnobThickness()
        minMax - minimum- and maximum-value of slider
        unitSize - size of one unit (element) in sliding direction
        value - current value of slider
      • RangeSlider

        public RangeSlider​(int renderModes,
                           com.jogamp.math.Vec2f size,
                           com.jogamp.math.Vec2f minMax,
                           float unitSize,
                           float pageSize,
                           float value)
        Constructs a RangeSlider, i.e. its shapes and controls.

        This slider comprises a framing bar and a rectangular page-sized knob, with getValue() at page-start position.

        The spatial size and pageSize gets automatically updated at Shape.validate(GL2ES2)

        Parameters:
        renderModes - Graph's Region render modes, see create(..).
        size - spatial dimension of this slider box. A horizontal slider has width >= height.
        minMax - minimum- and maximum-value of slider
        unitSize - size of one unit (element) in sliding direction
        pageSize - size of one virtual-page, triggers rendering mode from knob to rectangle
        value - current value of slider
    • Method Detail

      • getMarks

        public Group getMarks()
      • addMark

        public Shape addMark​(float value,
                             com.jogamp.math.Vec4f color)
      • getSize

        public final com.jogamp.math.Vec2f getSize()
        Returns spatial dimension of this slider
      • getKnobThickness

        public final float getKnobThickness()
        Returns spatial knob thickness orthogonal to sliding direction
      • getKnobLength

        public final float getKnobLength()
        Returns spatial knob length in sliding direction
      • getRange

        public float getRange()
        Returns getMinMax() range.
      • getValue

        public float getValue()
        Returns current slider value
      • getValuePct

        public float getValuePct()
        Returns current slider value in percentage of getRange(),
      • setUnitSize

        public RangeSlider setUnitSize​(float v)
        Sets the size of one unit (element) in sliding direction
      • getUnitSize

        public float getUnitSize()
        Returns the size of one unit (element) in sliding direction
      • setInverted

        public RangeSlider setInverted​(boolean v)
        Sets whether this slider uses an inverted value range, e.g. top 0% and bottom 100% for an vertical inverted slider instead of bottom 0% and top 100% for a vertical non-inverted slider.
      • setMinMax

        public RangeSlider setMinMax​(com.jogamp.math.Vec2f minMax,
                                     float value)
        Sets slider value range and current value, also updates related pageSize parameter if used.
        Parameters:
        minMax - minimum- and maximum-value of slider
        value - new value of slider, clipped against getMinMax()
        Returns:
        this instance of chaining
      • setMinMax

        public RangeSlider setMinMax​(com.jogamp.math.Vec2f minMax)
        Sets slider value range, also updates related pageSize parameter if used.
        Parameters:
        minMax - minimum- and maximum-value of slider
        Returns:
        this instance of chaining
      • setMinMaxPgSz

        public RangeSlider setMinMaxPgSz​(com.jogamp.math.Vec2f minMax,
                                         float value,
                                         float pageSz)
        Parameters:
        minMax - minimum- and maximum-value of slider
        value - new value of slider, clipped against minMax
        pageSz - the page-size, which will be clipped to minMax
        Returns:
        this instance of chaining
      • setMinMaxPgSz

        public RangeSlider setMinMaxPgSz​(com.jogamp.math.Vec2f minMax,
                                         float pageSz)
        Parameters:
        minMax - minimum- and maximum-value of slider
        pageSz - the page-size, which will be clipped to minMax
        Returns:
        this instance of chaining
      • setValue

        public RangeSlider setValue​(float v)
        Sets slider value
        Parameters:
        v - new value of slider, clipped against getMinMax()
        Returns:
        this instance of chaining
      • setColor

        public final Shape setColor​(float r,
                                    float g,
                                    float b,
                                    float a)
        Sets the slider knob color.

        If this slider comprises a rectangular page-sized knob, its rectangular frame also shares the same color with alpha 1.0f.

        Base color w/o color channel, will be modulated w/ pressed- and toggle color

        Default RGBA value is 0.80f, 0.80f, 0.80f, 0.7f

        Overrides:
        setColor in class Shape
        See Also:
        Shape.markShapeDirty()
      • setColor

        public Shape setColor​(com.jogamp.math.Vec4f c)
        Sets the slider knob color.

        If this slider comprises a rectangular page-sized knob, its rectangular frame also shares the same color with alpha 1.0f.

        Base color w/o color channel, will be modulated w/ pressed- and toggle color

        Default RGBA value is 0.80f, 0.80f, 0.80f, 0.7f

        Overrides:
        setColor in class Shape
        See Also:
        Shape.markShapeDirty()
      • setActiveKnobColorMod

        public Shape setActiveKnobColorMod​(com.jogamp.math.Vec4f c)
        Sets the knob active modulation color

        Default RGBA value is 0.1f, 0.1f, 0.1f, 1f

      • setBackgroundBarColor

        public Shape setBackgroundBarColor​(float r,
                                           float g,
                                           float b,
                                           float a)
        Sets the slider background bar color, if this slider comprises only a positional round knob.

        Default RGBA value is 0.60f, 0.60f, 0.60f, 0.5f

      • setBackgroundBarColor

        public Shape setBackgroundBarColor​(com.jogamp.math.Vec4f c)
        Sets the slider background bar color, if this slider comprises only a positional round knob.

        Default RGBA value is 0.60f, 0.60f, 0.60f, 0.5f

      • setPressedColorMod

        public final Shape setPressedColorMod​(float r,
                                              float g,
                                              float b,
                                              float a)
        Set pressed color, modulating Shape.getColor() if Shape.isPressed().

        Default pressed color, modulation -factor w/o color channel, modulated base-color. ~0.65 (due to alpha)

        Default RGBA value is 0.70f, 0.70f, 0.70f, 0.8f

        Sets the slider bar and knob pressed color modulation.

        Overrides:
        setPressedColorMod in class Shape
      • getDescription

        public String getDescription()
        Return string description of current slider setting.