<?xml version='1.0' encoding='UTF-8'?>
<section>
  <sectioninfo>
    <keywordset>
      <keyword>panel</keyword>
      <keyword>rich:simpleTogglePanel</keyword>
      <keyword>HtmlSimpleTogglePanel</keyword>
      <keyword>switch</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.SimpleTogglePanel</entry>
        </row>
        <row>
          <entry>component-class</entry>
          <entry>org.richfaces.component.html.HtmlSimpleTogglePanel</entry>
        </row>
        <row>
          <entry>component-family</entry>
          <entry>org.richfaces.SimpleTogglePanel</entry>
        </row>
        <row>
          <entry>renderer-type</entry>
          <entry>org.richfaces.SimpleTogglePanelRenderer</entry>
        </row>
        <row>
          <entry>tag-class</entry>
          <entry>org.richfaces.taglib.SimpleTogglePanelTag</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:simpleTogglePanel>
        ...
    </rich:simpleTogglePanel>
...
]]></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.HtmlSimpleTogglePanel;
...
HtmlSimpleTogglePanel myPanel = new HtmlSimpleTogglePanel();
...
]]></programlisting>
  </section>
  <section>
    <title>Details of Usage</title>
    <para>The component is a simplified version of <property>toggle panel</property> that initially
      has a defined layout as a panel with a header playing a role of a mode switching control. On a
      component header element, it&apos;s possible to define a label using an attribute with the
      same name.</para>

    <para>Switching mode could be defined with the <emphasis>
        <property>&quot;switchType&quot;</property>
      </emphasis> attribute with three possible parameters.</para>
    <itemizedlist>
      <listitem> Server (DEFAULT)<para>The common submission is performed around
            <property>simpleTogglePanel</property> and a page is completely rendered on a called
          panel. Only one at a time panel is uploaded onto the client side.</para>
      </listitem>
      <listitem> Ajax<para>AJAX form submission is performed around the panel, content of the called
          panel is uploaded on Ajax request and additionally specified elements in the <emphasis>
            <property>&quot;reRender&quot;</property>
          </emphasis> attribute are rendered. Only one at a time panel is uploaded on the client
          side.</para>
      </listitem>
      <listitem> Client<para> All panels are uploaded on the client side. Switching from the active
          to the hidden panel is performed with client JavaScript.</para>
      </listitem>
    </itemizedlist>
    <para>The component could also have an <emphasis>
        <property>&quot;expanded&quot;</property>
      </emphasis> (true/false) attribute responsible for keeping a panel state. It gives an
      opportunity to manage a <property>simpleTogglePanel</property> state from a model.</para>
    <itemizedlist>
      <listitem> onmouseover </listitem>
      <listitem> onclick </listitem>
      <listitem> onmouseout </listitem>
      <listitem> etc. </listitem>
    </itemizedlist>
    <figure>
      <title>&lt;rich:simpleTooglePanel&gt; states</title>
      <mediaobject>
        <imageobject>
          <imagedata fileref="images/simpleTogglePanel2.png"/>
        </imageobject>
      </mediaobject>
    </figure>

  </section>
  <section>
    <title>Look-and-Feel Customization</title>
    <para>For skinnability implementation, the components use a <emphasis>
      <property>style class redefinition method.</property>
    </emphasis> Default style classes are mapped on <emphasis>
      <property>skin parameters.</property>
    </emphasis></para>
    
    <para>There are two ways to redefine the appearance of all <emphasis role="bold">
      <property>&lt;rich:simpleTooglePanel&gt;</property>
    </emphasis> components at once:</para>
    
    <itemizedlist>
      <listitem>
        <para>Redefine the corresponding skin parameters</para>
      </listitem>
      
      <listitem>
        <para>Add to your style sheets <emphasis>
          <property>style classes</property>
        </emphasis> used by a <emphasis role="bold">
          <property>&lt;rich:simpleTooglePanel&gt;</property>
        </emphasis> component</para>
      </listitem>
    </itemizedlist>
  </section>
  
  <section>
    <title>Skin Parameters Redefinition</title>
    <table>
      <title>Skin parameters for a whole component</title>
      <tgroup cols="2">
        <thead>
          <row>
            <entry>Skin parameters</entry>
            <entry>CSS properties</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry>generalBackgroundColor</entry>
            <entry>background-color</entry>
          </row>
          <row>
            <entry>panelBorderColor</entry>
            <entry>border-color</entry>
          </row>
        </tbody>
      </tgroup>
    </table>
    <table>
      <title>Skin parameters for a header element</title>
      <tgroup cols="2">
        <thead>
          <row>
            <entry>Skin parameters</entry>
            <entry>CSS properties</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry>headerBackgroundColor</entry>
            <entry>background-color</entry>
          </row>
          <row>
            <entry>headerBackgroundColor</entry>
            <entry>border-color</entry>
          </row>
          <row>
            <entry>headerSizeFont</entry>
            <entry>font-size </entry>
          </row>
          <row>
            <entry>headTextColor</entry>
            <entry>color</entry>
          </row>
          <row>
            <entry>headerWeightFont</entry>
            <entry>font-weight</entry>
          </row>
          <row>
            <entry>headerFamilyFont</entry>
            <entry>font-family</entry>
          </row>
        </tbody>
      </tgroup>
    </table>
    <table>
      <title>Skin parameters for a body element</title>
      <tgroup cols="2">
        <thead>
          <row>
            <entry>Skin parameters</entry>
            <entry>CSS properties</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry>generalBackgroundColor</entry>
            <entry>background-color</entry>
          </row>
          <row>
            <entry>generalSizeFont</entry>
            <entry>font-size</entry>
          </row>
          <row>
            <entry>panelTextColor</entry>
            <entry>color</entry>
          </row>
          <row>
            <entry>generalFamilyFont</entry>
            <entry>font-family</entry>
          </row>
        </tbody>
      </tgroup>
    </table>
  </section>
  <section>
    <title>Definition of Custom Style Classes</title>
    
    <para>On the screenshot there are classes names that define styles for component elements.</para>
    
    <figure>
      <title>Style classes</title>
      <mediaobject>
        <imageobject>
          <imagedata fileref="images/simpleTogglePanel3.png"/>
        </imageobject>
      </mediaobject>
    </figure>

    <table>
      <title>Classes names that define a component appearance</title>
      <tgroup cols="2">
        <thead>
          <row>
            <entry>Class name</entry>
            <entry>Class description</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry>rich-stglpanel</entry>
            <entry>Defines styles for a wrapper  &lt;div&gt; element of a component</entry>
          </row>
          <row>
            <entry>rich-stglpanel-header</entry>
            <entry>Defines styles for header element of a component</entry>
          </row>
          <row>
            <entry>rich-stglpnl-marker</entry>
            <entry>Defines styles for a wrapper  &lt;div&gt; element of a marker</entry>
          </row>
          
          <row>
            <entry>rich-stglpanel-body</entry>
            <entry>Defines styles for a component content</entry>
          </row>
        </tbody>
      </tgroup>
    </table>
   
    
    <table>
      <title>Style component classes</title>
      <tgroup cols="2">
        <thead>
          <row>
            <entry>Class name</entry>
            <entry>Class description</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry>styleClass</entry>
            <entry>The class defines panel common style. It&apos;s used in the outside <emphasis
                role="bold">
                <property>&lt;div&gt;</property>
              </emphasis>element</entry>
          </row>
          <row>
            <entry>bodyClass</entry>
            <entry>applicable to panels body elements</entry>
          </row>
          <row>
            <entry>headerClass</entry>
            <entry>applicable to header elements</entry>
          </row>
        </tbody>
      </tgroup>
    </table>
    
    <para>In order to redefine styles for all <emphasis role="bold">
      <property>&lt;rich:simpleTogglePanel&gt;</property>
    </emphasis> components on a page using CSS, it&apos;s enough to create classes with the
      same names and define necessary properties in them.</para>
    
    <para>To change styles of particular <emphasis role="bold">
      <property>&lt;rich:simpleTogglePanel&gt;</property>
    </emphasis> components, define your own style classes in the corresponding <emphasis
      role="bold">
      <property>&lt;rich:simpleTogglePanel&gt;</property>
    </emphasis>attributes.</para>
  </section>
  <section>
    <title>Relevant Resources Links</title>
    <para>
      <ulink
        url="http://livedemo.exadel.com/richfaces-demo/richfaces/simpleTogglePanel.jsf?c=simpleTogglePanel"
        >Here</ulink> you can see the example of <emphasis role="bold"
        ><property>&lt;rich:simpleTogglePanel&gt;</property>s</emphasis> usage and sources for the given example.
    </para>
  </section>
</section>
