rich:inplaceInput inplaceInput

Component identification parameters

Name | Value
--- | ---
component-type | org.richfaces.inplaceInput
component-family | org.richfaces.inplaceInput
renderer-type | org.richfaces.renderkit.inplaceInputRenderer
tag-class | org.richfaces.taglib.inplaceInputTag

## Creating the Component with a Page Tag

Here is a simple example of how the component can be used on a page:

Example:

    ...
    <rich:inplaceInput value="#{bean.value}"/>
    ...

## Creating the Component Dynamically Using Java

Example:

    import org.richfaces.component.html.inplaceInput;
    ...
    HtmlInpaceInput myInplaceInput = new InplaceInput();
    ...

## Details of Usage

As it was mentioned earlier the <rich:inplaceInput> component was designed to facilitate inputting and editing some parts of a text.

The component has three logical states:

- "View" state displays the text containing in a "value" attribute;

  "View" state

- "Editable"state - the text can be edited and saved;

  "Editable" state

- "Changed"state - displays the edited text and indicates that it was edited, changed

  "Changed" state

The main attribute of the component is "value" it displays the text on a page, the text can be edited by clicking (default action, which can be redefined) on it.

However, if "value" attribute is not defined, you can use "defaultLabel attribute " which will display some default text while "value" attribute stays undefined.

Example:

    ...
    <rich:inplaceInput value="#{bean.value}" defaultLabel="click to edit"/>
    ...

In the shown example, "value" attribute is not defined; therefore default text "Click to edit" is displayed since it is placed into the "defaultLabel" attribute.

Input data is saved (submitted) automatically when the input field loses focus. Nevertheless, you can use a "showControls" attribute, which make "save"and "cancel" buttons appear next to the input field.

Example:

    ...
    <rich:inplaceInput value="#{bean.value}" defaultLabel='click to edit' showControls="true"/>
    ...

Usage "showControls" attribute

You can also position the controls relatively to the input field, by means of " controlsHorizontalPosition" " controlsVerticalPosition " attributes. The " controlsHorizontalPosition" attribute has "left", "right" and "center" definitions. The " controlsVerticalPosition " attribute has "bottom", "center" and "top" definitions.

Positioning of "save" and "cancel" buttons

Redefinition of the "save" and "cancel" icons can be performed using "saveControlIcon" and "cancelControlIcon" attributes relatively. You need to define the path to where your images are located.

Example:

    ...
    <rich:inplaceInput value="#{bean.incValue}"  minValue="50"  maxValue="400"/>
    ...

## JavaScript API

JavaScript API

Function | Description
--- | ---
enable() | Begins polling for ajax mode
disable() | Stops polling for ajax mode
setValue(value) | Updates the progress of the process
setLabel(label) | Update the label for the process

## 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:progressBar> components at once:

- Redefine the corresponding skin parameters
- Add to your style sheets style classes used by a <rich:progressBar> component

## Skin Parameters Redefinition

Skin parameters redefinition for the "completed" part of the bar with no label

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

Skin parameters redefinition for the "completed" part of the bar with a label used

Skin parameters | CSS properties
--- | ---
panelBorderColor | border-color

Skin parameters redefinition for the “completed” part of the bar with a label used

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

Skin parameters redefinition for the "remained" part of the bar

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

Skin parameters redefinition for the bar itself with a label used

Skin parameters | CSS properties
--- | ---
panelBorderColor | border-color
generalFamilyFont | font-family
headerFamilyFont | font-family
generalSizeFont | font-size
controlTextColor | color

Skin parameters redefinition for the bar itself with no label used

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

## Definition of Custom Style Classes

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

Classes names

Classes names for the bar

Class name | Description
--- | ---
rich-progress-bar-shell | Defines styles for the background and the borders of the bar when label is not used
rich-progress-bar-shell-dig | Defines styles for background, font and border settings when label is used

Classes names that define "completed" part of the bar

Class name | Description
--- | ---
rich-progress-bar-uploaded | Defines styles for of "completed" progress area with no labels used
rich-progress-bar-uploaded-dig | Defines styles for that "completed" progress area with labels used
rich-progress-bar-completed | Defines styles for the "completed" progress area with a label used

Classes names that define "remained" part of the progress area

Class name | Description
--- | ---
rich-progress-bar-remained | Defines styles for the "remained" part of the bar

In order to redefine styles for all <rich:progressBar> components on a page using CSS, it's enough to create classes with the same names (possible classes could be found in the tables above) and define necessary properties in them.

Example:

    ...
    .rich-progress-bar-remained{
        background-color: #ebf3fd;
    }
    ...

This is the result:

Redefinition styles with predefined classes

In the example the "remained" part of progress area is modified with a background-color CSS property.

It's aslo possible to change styles of a particular <rich:progressBar> component. In this case you should create own style classes and use them in corresponding <rich:progressBar> styleClass attributes. An example is placed below:

Example:

    ...
    .RremainClass{  background-color: #ebf3fd;}
    ...

The "styleClass" attribute for <rich:progressBar> is defined as it’s shown in the example below:

Example:

    <rich:progressBar value="#{bean.incValue1}" styleClass="remainClass" />

This is a result:

Modificaton of a look and feel with own classes and styleClass attributes

As it could be seen on the picture above, the font style for output text was changed.

## Relevant Resources Links

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