dragged handle control rich:inputNumberSlider HtmlInputNumberSlider

Component identification parameters

Name | Value
--- | ---
component-type | org.richfaces.inputNumberSlider
component-class | org.richfaces.component.html.HtmlInputNumberSlider
component-family | org.richfaces.inputNumberSlider
renderer-type | org.richfaces.InputNumberSliderRenderer
tag-class | org.richfaces.taglib.InputNumberSliderTag

## Creating the Component with a Page Tag

Here is a simple example as it could be used on a page:

Example:

    ...
        <rich:inputNumberSlider minValue="0" maxValue="100" step="1"/>
    ...

## Creating the Component Dynamically Using Java

Example:

    import org.richfaces.component.html.HtmlInputNumberSlider;
    ...
    HtmlInputNumberSlider mySlider = new HtmlInputNumberSlider();
    ...

## Details of Usage

<rich:inputNumberSlider> is used to facilitate your data input with rich UI Controls.

Here is the simplest variant of a slider definition with "minValue", "maxValue" and "step" (on default = "1") attributes, which define the beginning and the end of a numerical area and a slider property step.

Example:

    <rich:inputNumberSlider></rich:inputNumberSlider>

It generates on a page:

Generated inputNumberSlider

Using "showInput" (default is true) and "enableManualInput" (default value is true) attributes, it's possible to output the input area near the slider, and make it read-only or editable.

To remove input area use "showInput="false" :

Example:

    <rich:inputNumberSlider minValue="1"  maxValue="100" showInput="false"/>

It looks at page like:

InputNumberSlider without input field

It's also possible to switch off displaying of "boundary values" and a tooltip showing on a handle drawing. This could be performed with the help of the component defined attributes: "showBoundaryValues" which is responsible for "boundary values" displaying (default is true) and "showToolTip" which is responsible for tooltip displaying (default is true).

Moreover, to add e.g. some JavaScript effects, events defined on it are used.

- onchange
- onmouseover
- onclick
- onfocus
- onmouseout
- etc.

## Look-and-Feel Customization

For skinnability implementation, the components use a style class redefinition method. Default style classes are mapped on skin parameters.

There are two ways to redefine the appearance of all <rich:inputNumberSlider> components at once:

- Redefine the corresponding skin parameters

- Add to your style sheets style classes used by a <rich:imputNumberSlider> component

## Skin Parameters Redefinition

Skin parameters redefinition for a bar

Skin parameters | CSS properties
--- | ---
controlBackgroundColor | background-color

Skin parameters redefinition for numbers

Skin parameters | CSS properties
--- | ---
generalFamilyFont | font-family
generalSizeFont | font-size
generalTextColor | color
panelBorderColor | border-color
generalSizeFont | line-height

Skin parameters redefinition for a text field

Skin parameters | CSS properties
--- | ---
controlBackgroundColor | background-color
generalFamilyFont | font-family
generalSizeFont | font-size
controlTextColor | color
panelBorderColor | border-color
subBorderColor | border-bottom-color
subBorderColor | border-right-color

Skin parameters redefinition for a hint

Skin parameters | CSS properties
--- | ---
tipBackgroundColor | background-color
tipBorderColor | border-color
generalFamilyFont | font-family
generalSizeFont | font-size

## Definition of Custom Style Classes

On the screenshot there are classes names that define styles for component elements.

Style classes

Classes names that define a component appearance

Class name | Description
--- | ---
rich-slider | Defines styles for a wrapper table element of a component
rich-inslider-track | Defines styles for a bar
rich-inslider-handler | Defines styles for a slider handler
rich-inslider-handler-selected | Defines styles for a selected handler
rich-inslider-field | Defines styles for a text field
rich-inslider-right-num | Defines styles for the right number
rich-inslider-left-num | Defines styles for the left number
rich-inslider-tip | Defines styles for a hint

In order to redefine styles for all <rich:inputNumberSlider> components on a page using CSS, it's enough to create classes with the same names and define necessary properties in them.

To change styles of particular <rich:inputNumberSlider> components, define your own style classes in the corresponding <rich:inputNumberSlider> attributes.

CSS code piece used on a page:

Example:

    ...
        .rich-slider-handle{
            border:2px solid;
        }
        .myClass{
            font-style:italic;
        }
    ...

The component is defined in the following way:

Example:

    <rich:inputNumberSlider ... inputClass="myClass" .../>

Hence, header border width of all sliders is redefined on a page as well as a style font for an input field of a particular slider.

## Relevant Resources Links

Here you can see the example of <rich:inputNumberSlider> usage and sources for the given example.