<?xml version='1.0' encoding='UTF-8'?>
<section>
<sectioninfo>
<keywordset>
<keyword>control</keyword>
<keyword>rich:toggleControl</keyword>
<keyword>HtmlToggleControl</keyword>
<keyword>switching</keyword>
</keywordset>
</sectioninfo>
  
     <table>
	  <title>Component identification parameters</title>
      <tgroup cols="2">
	  <thead>
            <row>
                  <entry>Name</entry>
                  <entry>Value</entry>
            </row>
        </thead>
        <tbody>
          <row>
            <entry>component-type</entry>
            <entry>org.richfaces.ToggleControl</entry>
          </row>
          <row>
            <entry>component-class</entry>
            <entry>org.richfaces.component.html.HtmlToggleControl</entry>
          </row>
          <row>
            <entry>component-family</entry>
            <entry>org.richfaces.ToggleControl</entry>
          </row>
          <row>
            <entry>renderer-type</entry>
            <entry>org.richfaces.ToggleControlRenderer</entry>
		  </row>
		  <row>
			<entry>tag-class</entry>
            <entry>org.richfaces.taglib.ToggleControlTag</entry>
          </row>
        </tbody>
      </tgroup>
    </table>
  
  <section>
    <title>Creating the Component with a Page Tag</title>
    <para>To create the simplest variant on a page use the following syntax:</para>

    <para>
      <emphasis role="bold">Example:</emphasis>
    </para>
    <programlisting role="XML"><![CDATA[...
    <rich:toggleControl for="panel"/>
        ...
        <rich:togglePanel id="panel" stateOrder="[facets order to be switched]">
            <!--//Set of Facets-->
        </rich:togglePanel>
...
]]></programlisting>
  </section>
  <section>
    <title>Creating the Component Dynamically Using Java</title>

    <para>
      <emphasis role="bold">Example:</emphasis>
    </para>
    <programlisting role="JAVA"><![CDATA[import org.richfaces.component.html.HtmlToggleControl;
...
HtmlToggleControl myControl = new HtmlToggleControl();
...
]]></programlisting>
  </section>
  <section>
    <title>Details of Usage</title>
    <para>As it was mentioned <link linkend="toggleControl">above</link>, the <property>control</property> could be in any place in 
    layout and linked to a switching panel that is managed with <emphasis 

><property>&quot;for&quot;</property></emphasis> attribute (in the <emphasis 

><property>&quot;for&quot;</property></emphasis> attribute the full component <emphasis><property>&quot;id&quot;</property></emphasis> is specified according to naming
 containers).</para>
<para>The <property>togglePanel</property> could be also switched from the side of the control instead of being strictly defined 
in <emphasis 
><property>&quot;switchOrder&quot;</property></emphasis> attribute of <emphasis role="bold"><property>&lt;rich:togglePanel&gt;</property>.</emphasis></para>
<para><emphasis role="bold">Example:</emphasis></para>
    <programlisting role="XML"><![CDATA[...
    <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>
...
]]></programlisting>
<para>In this example the switching is performed on facets specified in the <emphasis 
><property>&quot;switchToState&quot;</property></emphasis> attribute.</para>
  </section>
  
	<section>
	<title>Look-and-Feel Customization</title>
	  <para>For skinnability implementation, the components use a <emphasis>
	    <property>style class redefinition method.</property></emphasis></para>
	  <para>To redefine the appearance of all <emphasis role="bold">
	    <property>&lt;rich:toggleControl&gt;</property>
	  </emphasis> components at once, you should add to your style sheets <emphasis>
	    <property>style class</property>
	  </emphasis> used by a <emphasis role="bold">
	    <property>&lt;rich:toggleControl&gt;</property>
	  </emphasis> component.
</para>
	</section>
  
  <section>
    <title>Definition of Custom Style Classes</title>
    <table>
      <title>Classes names that define a component appearance</title>
      <tgroup cols="2">
        <thead>
          <row>
            <entry>Class name</entry>
            <entry>Description</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry>rich-tglctrl</entry>
            <entry>Defines styles for a toggle control</entry>
          </row>
          
        </tbody>
      </tgroup>
    </table>
    <para>In order to redefine styles for all <emphasis role="bold">
      <property>&lt;rich:toggleControl&gt;</property>
    </emphasis> components on a page using CSS, it&apos;s enough to create a class with the
      same name and define necessary properties in it.</para>
    
    <para>To change styles of particular <emphasis role="bold">
      <property>&lt;rich:toggleControl&gt;</property>
    </emphasis> components define your own style class in the corresponding <emphasis
      role="bold">
      <property>&lt;rich:toggleControl&gt;</property>
    </emphasis>attributes.</para>
  </section>
</section>