<?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>Here is a simple example as it could be used on a page: </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>On component generation the framework substitutes the default 
	class <emphasis ><property>rich-toggle-control</property></emphasis> into
	 styleClass of a generated component, i.e. to redefine at once all <property>toggle controls</property> appearance on a 
	 page, redefine this class in your CSS.</para>
	 <para>To define a particular <property>toggle controls</property> appearance, write down your own CSS properties and
	 classes in component style attributes (<emphasis 
><property>&quot;style&quot;</property>,</emphasis> <emphasis 
><property>&quot;styleClass&quot;</property></emphasis>)and the properties have been changed.</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>
  </section>
</section>