<?xml version="1.0" encoding="UTF-8"?>
<section>
  <sectioninfo>
    <keywordset>
      <keyword>rich:panelMenuGroup</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.PanelMenuGroup</entry>
        </row>

        <row>
          <entry>component-class</entry>

          <entry>org.richfaces.component.html.HtmlPanelMenuGroup</entry>
        </row>

        <row>
          <entry>component-family</entry>

          <entry>org.richfaces.PanelMenuGroup</entry>
        </row>

        <row>
          <entry>renderer-type</entry>

          <entry>org.richfaces.PanelMenuGroupRenderer</entry>
        </row>

        <row>
          <entry>tag-class</entry>

          <entry>org.richfaces.taglib.PanelMenuGroupTag</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:panelMenu>
            <rich:panelMenuGroup label="Group1">
                  <!--Nested panelMenu components-->
            </rich:panelMenuGroup>
      </rich:panelMenu>
...]]></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.HtmlPanelMenuGroup; 	
...
HtmlPanelMenuGroup myPanelMenuGroup = new HtmlPanelMenuGroup();
...
]]></programlisting>
  </section>

  <section>
    <title>Details of Usage</title>

    <para>All attributes except <emphasis>
        <property>&quot;label&quot;</property>
      </emphasis> are optional. The <emphasis>
        <property>&quot;label&quot;</property>
      </emphasis> attribute defines text to be represented.</para>
    <para>Switching mode could be chosen with the<emphasis>
        <property> &quot;expandMode&quot;</property>
      </emphasis> attribute for the concrete panelMenu group.</para>
    <para>The <emphasis>
        <property>&quot;expandMode&quot;</property>
      </emphasis> attribute could be used with three possible parameters:</para>

    <itemizedlist>
      <listitem>
        <para><code>ServerM</code> (default)</para>
      </listitem>
    </itemizedlist>

    <para>Regular form submission request is used.</para>

    <itemizedlist>
      <listitem>
        <para><code>Ajax</code></para>
      </listitem>
    </itemizedlist>

    <para>Ajax submission is used for switching.</para>

    <itemizedlist>
      <listitem>
        <para><code>None</code></para>
      </listitem>
    </itemizedlist>

    <para><emphasis>
        <property>&quot;Action&quot;</property>
      </emphasis> and <emphasis>
        <property>&quot;actionListener&quot;</property>
      </emphasis> attributes are ignored. Items don&apos;t fire any submits itself. Behavior is
      fully defined by the components nested into items.</para>

    <para>There are three icon-related attributes. The <emphasis>
        <property>&quot;iconExpanded&quot;</property>
      </emphasis> attribute defines an icon for an expanded state. The <emphasis>
        <property>&quot;iconCollapsed&quot;</property>
      </emphasis> attribute defines an icon for a collapsed state. The <emphasis>
        <property>&quot;iconDisabled&quot;</property>
      </emphasis> attribute defines an icon for a disabled state.</para>

    <para>Default icons are shown on the picture below:</para>

    <figure>
      <title>Default icons</title>

      <mediaobject>
        <imageobject>
          <imagedata fileref="images/panelMenuGroup2.png"/>
        </imageobject>
      </mediaobject>
    </figure>

    <para>Here is an example:</para>

    <para>
      <emphasis role="bold">Example:</emphasis>
    </para>
    <programlisting role="XML"><![CDATA[...
      <rich:panelMenu>
            <rich:panelMenuGroup label="Group1" iconExpanded="disc" iconCollapsed="chevron">
                  <!--Nested panelMenu components-->
            </rich:panelMenuGroup>
      </rich:panelMenu>
...]]></programlisting>
    <para> As the result the pictures are shown below. The first one represents the collapsed state,
      the second one - expanded state:</para>

    <figure>
      <title>Collapsed state</title>

      <mediaobject>
        <imageobject>
          <imagedata fileref="images/panelMenuGroup3.png"/>
        </imageobject>
      </mediaobject>
    </figure>

    <figure>
      <title>Expanded state</title>

      <mediaobject>
        <imageobject>
          <imagedata fileref="images/panelMenuGroup4.png"/>
        </imageobject>
      </mediaobject>
    </figure>

    <para>It&apos;s also possible to define a path to the icon. Simple code is placed below.</para>

    <programlisting role="XML"><![CDATA[...
      <rich:panelMenu>
            <rich:panelMenuGroup label="Group1" iconExpanded="\images\img1.png" iconCollapsed="\images\img2.png">
                  <!--Nested menu components-->
            </rich:panelMenuGroup>
      </rich:panelMenu>
...]]></programlisting>
    <para>
      Information about the <emphasis><property>&quot;process&quot;</property></emphasis> attribute usage you can find <link linkend="process">&quot; Decide what to process &quot; </link> guide section.
    </para>
  </section>

  <section>
    <title>JavaScript API</title>
    <para>In Java Script code for expanding/collapsing group element creation it&apos;s
      necessary to use <code>expand()</code>/<code>collapse()</code> function.</para>

    <table>
      <title>JavaScript API</title>

      <tgroup cols="2">
        <thead>
          <row>
            <entry>Function</entry>

            <entry>Description</entry>
          </row>
        </thead>

        <tbody>
          <row>
            <entry>expand()</entry>

            <entry>Expand group element</entry>
          </row>

          <row>
            <entry>collapse()</entry>

            <entry>Collapse group element</entry>
          </row>
        </tbody>
      </tgroup>
    </table>

  </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:panelMenuGroup&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:panelMenuGroup&gt;</property>
        </emphasis> component</para>
      </listitem>
    </itemizedlist>
  </section>

  <section>
    <title> Skin Parameters Redefinition</title>

    <table>
      <title>Skin parameters redefinition for a table element of the first level group</title>

      <tgroup cols="2">
        <thead>
          <row>
            <entry>Skin parameters</entry>

            <entry>CSS properties</entry>
          </row>
        </thead>

        <tbody>
          <row>
            <entry>headerWeightFont</entry>

            <entry>font-weight</entry>
          </row>

          <row>
            <entry>generalFamilyFont</entry>

            <entry>font-family</entry>
          </row>

          <row>
            <entry>headerSizeFont</entry>

            <entry>font-size</entry>
          </row>

          <row>
            <entry>headerTextColor</entry>

            <entry>color</entry>
          </row>

          <row>
            <entry>headerBackgroundColor</entry>

            <entry>background-color</entry>
          </row>
        </tbody>
      </tgroup>
    </table>

    <table>
      <title>Skin parameters redefinition for a table element of second and next level groups</title>

      <tgroup cols="2">
        <thead>
          <row>
            <entry>Skin parameters</entry>

            <entry>CSS properties</entry>
          </row>
        </thead>

        <tbody>
          <row>
            <entry>headerWeightFont</entry>

            <entry>font-weight</entry>
          </row>

          <row>
            <entry>headerFamilyFont</entry>

            <entry>font-family</entry>
          </row>

          <row>
            <entry>headerSizeFont</entry>

            <entry>font-size</entry>
          </row>

          <row>
            <entry>generalTextColor</entry>

            <entry>color</entry>
          </row>

          <row>
            <entry>tableBorderColor</entry>

            <entry>border-top-color</entry>
          </row>
        </tbody>
      </tgroup>
    </table>

    <table>
      <title>Skin parameters redefinition for wrapper div element of the first level group</title>

      <tgroup cols="2">
        <thead>
          <row>
            <entry>Skin parameters</entry>

            <entry>CSS properties</entry>
          </row>
        </thead>

        <tbody>
          <row>
            <entry>panelBorderColor</entry>

            <entry>border-color</entry>
          </row>

        </tbody>
      </tgroup>
    </table>
    
    <table>
      <title>Skin parameters redefinition for a hovered group element</title>
      
      <tgroup cols="2">
        <thead>
          <row>
            <entry>Skin parameters</entry>
            
            <entry>CSS properties</entry>
          </row>
        </thead>
        
        <tbody>
          <row>
            <entry>additionalBackgroundColor</entry>
            
            <entry> background-color</entry>
          </row>
          
        </tbody>
      </tgroup>
    </table>
    
    <table>
      <title>Skin parameters redefinition for a disabled group element</title>
      
      <tgroup cols="2">
        <thead>
          <row>
            <entry>Skin parameters</entry>
            
            <entry>CSS properties</entry>
          </row>
        </thead>
        
        <tbody>
          <row>
            <entry>tabDisabledTextColor</entry>
            
            <entry>color</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>Classes names</title>
      
      <mediaobject>
        <imageobject>
          <imagedata fileref="images/panelMenuGroup_cn.png"/>
        </imageobject>
      </mediaobject>
    </figure>
    
    <figure>
      <title>Classes names</title>

      <mediaobject>
        <imageobject>
          <imagedata fileref="images/panelMenuGroup_cn2.png"/>
        </imageobject>
      </mediaobject>
    </figure>
    <table  id="panelMenuC">
      <title>Classes names that define an upper level groups</title>

      <tgroup cols="2">
        <thead>
          <row>
            <entry>Class name</entry>

            <entry>Description</entry>
          </row>
        </thead>

        <tbody>
  
          <row>
            <entry>rich-pmenu-top-group-self-icon</entry>

            <entry>Defines styles for a top group icon</entry>
          </row>

          <row>
            <entry>rich-pmenu-top-group-self-label</entry>

            <entry>Defines styles for a top group label</entry>
          </row>
        </tbody>
      </tgroup>
    </table>
    
    <table>
      <title>Classes names that define a second and lower level groups</title>
      
      <tgroup cols="2">
        <thead>
          <row>
            <entry>Class name</entry>
            
            <entry>Description</entry>
          </row>
        </thead>
        
        <tbody>
          
          <row>
            <entry>rich-pmenu-group</entry>
            
            <entry>Defines styles for a group</entry>
          </row>
          
          <row>
            <entry>rich-pmenu-group-self-icon</entry>
            
            <entry>Defines styles for a group icon</entry>
          </row>
          
          <row>
            <entry>rich-pmenu-group-self-label</entry>
            
            <entry>Defines styles for a group label</entry>
          </row>
        </tbody>
        
      </tgroup>
    </table>

    <table>
      <title>Classes names that define a group state</title>
      
      <tgroup cols="2">
        <thead>
          <row>
            <entry>Class name</entry>
            
            <entry>Description</entry>
          </row>
        </thead>
        
        <tbody>
          <row>
            <entry>rich-pmenu-hovered-element</entry>
            
            <entry>Defines styles for a hovered group element</entry>
          </row>
         
          <row>
            <entry>rich-pmenu-disabled-element</entry>
            
            <entry>Defines styles for a disabled group element</entry>
          </row>
        </tbody>
        
      </tgroup>
    </table>
    
    <para>In order to redefine styles for all <emphasis role="bold">
      <property>&lt;rich:panelMenuGroup&gt;</property>
    </emphasis> components on a page using CSS, it&apos;s enough to create classes with the
      same names (possible classes could be found in the tables <link linkend="panelMenuC"> above</link>) and define necessary properties in them. </para>
    
    <para>
      <emphasis role="bold">Example:</emphasis>
    </para>
    <programlisting role="CSS"><![CDATA[...
.rich-pmenu-disabled-element{
        color: #87b9ff;
}
...]]></programlisting>  
    
    <para>This is a result:</para>
    
    <figure>
      <title>Redefinition styles with predefined classes</title>
      <mediaobject>
        <imageobject>
          <imagedata fileref="images/panelMenuGroup_pc.png"/>
        </imageobject>
      </mediaobject>
    </figure>
    
    <para>In the example a disabled element  font style and color were changed.</para>
    
    <para>Also it&apos;s possible to change styles of particular <emphasis role="bold"
      ><property>&lt;rich:panelMenuGroup&gt;</property></emphasis> component. In this case you should create own style classes and use them in corresponding <emphasis role="bold"
        ><property>&lt;rich:panelMenuGroup&gt;</property></emphasis> <emphasis><property>styleClass</property></emphasis> attributes. An example is placed below:</para>
    
    <para>
      <emphasis role="bold">Example:</emphasis>
    </para>
    <programlisting role="CSS"><![CDATA[...
.myClass{
       background-color: #ecf4fe;
}
...]]></programlisting>  
    <para>The <emphasis><property>&quot;hoverClass&quot;</property></emphasis> attribute for <emphasis role="bold"
      ><property>&lt;rich:panelMenuGroup&gt;</property></emphasis> is defined as it&apos;s shown in the example below:</para>
    
    <para>
      <emphasis role="bold">Example:</emphasis>
    </para>
    <programlisting role="XML"><![CDATA[<rich:panelMenuGroup ... hoverClass="myClass"/>
]]></programlisting>    
    
    <para>This is a result:</para>
    
    <figure>
      <title>Redefinition styles with own classes and <emphasis><property>styleClass</property></emphasis> attributes</title>
      <mediaobject>
        <imageobject>
          <imagedata fileref="images/panelMenuGroup_oc.png"/>
        </imageobject>
      </mediaobject>
    </figure>  
    
    <para>As it could be seen on the picture above, the background color for hovered item was changed.</para>
    </section>
  
  <section>
    <title>Relevant resources links</title>
    <para>
      Some additional information about usage of component can be found 
      <ulink url="http://livedemo.exadel.com/richfaces-demo/richfaces/panelMenu.jsf?c=panelMenuGroup">on the component Live Demo page</ulink>.
    </para>
  </section>
</section>
