control rich:toggleControl HtmlToggleControl switching

Component identification parameters

Name | Value
--- | ---
component-type | org.richfaces.ToggleControl
component-class | org.richfaces.component.html.HtmlToggleControl
component-family | org.richfaces.ToggleControl
renderer-type | org.richfaces.ToggleControlRenderer
tag-class | org.richfaces.taglib.ToggleControlTag

## Creating the Component with a Page Tag

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

Example:

    ...
        <rich:toggleControl for="panel"/>
            ...
            <rich:togglePanel id="panel" stateOrder="[facets order to be switched]">
                <!--//Set of Facets-->
            </rich:togglePanel>
    ...

## Creating the Component Dynamically Using Java

Example:

    import org.richfaces.component.html.HtmlToggleControl;
    ...
    HtmlToggleControl myControl = new HtmlToggleControl();
    ...

## Details of Usage

As it was mentioned above, the control could be in any place in layout and linked to a switching panel that is managed with "for" attribute (in the "for" attribute the full component "id" is specified according to naming containers).

The togglePanel could be also switched from the side of the control instead of being strictly defined in "switchOrder" attribute of <rich:togglePanel>.

Example:

    ...
        <rich:togglePanel id="panel" initialState="empty" switchType="client">
            <f:facet name="first">
                <h:panelGroup>
                    <rich:toggleControl for="helloForm:panel" value="Empty " switchToState="empty"/>
                    <rich:toggleControl for="helloForm:panel" value=" Second" switchToState="second"/>
                    ...//Some Content
                </h:panelGroup>
            </f:facet>
    	<f:facet name="second">
                <h:panelGroup>
                    <rich:toggleControl for="helloForm:panel" value="Empty " switchToState="empty"/>
                    <rich:toggleControl for="helloForm:panel" value=" first" switchToState="first"/>
                    ...//Some Content
                </h:panelGroup>
            </f:facet>
            <f:facet name="empty">
                <h:panelGroup>
                    <rich:toggleControl for="helloForm:panel" value="first " switchToState="first"/>
                    <rich:toggleControl for="helloForm:panel" value=" second" switchToState="second"/>
                </h:panelGroup>
            </f:facet>
        </rich:togglePanel>
    ...

In this example the switching is performed on facets specified in the "switchToState" attribute.

## Look-and-Feel Customization

For skinnability implementation, the components use a style class redefinition method.

To redefine the appearance of all <rich:toggleControl> components at once, you should add to your style sheets style class used by a <rich:toggleControl> component.

## Definition of Custom Style Classes

Classes names that define a component appearance

Class name | Description
--- | ---
rich-tglctrl | Defines styles for a toggle control

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

To change styles of particular <rich:toggleControl> components define your own style class in the corresponding <rich:toggleControl> attributes.