<section role="NotInToc" id="rich_progressBar">
   <title>
				&lt;
				rich:progressBar
				&gt;
				<emphasis role="since">
         <superscript> available since <emphasis role="version">3.2.0</emphasis>
         </superscript>
      </emphasis>
   </title>
   <section>
        <title>Description</title>
        <para>The <emphasis role="bold">
            <property>&lt;rich:progressBar&gt;</property>
        </emphasis> component is designed for displaying a progress bar which shows the current status of the process.   </para>
        
        <figure>
            <title>
            <emphasis role="bold">
               <property>&lt;rich:progressBar&gt;</property>
            </emphasis> component</title>
            <mediaobject> 
                <imageobject>
                    <imagedata fileref="images/progressBar_init.png"/> 
                </imageobject>
            </mediaobject>
        </figure>
    </section>
   <section>
        <title>Key Features</title> 
        <itemizedlist>
           
      
            <listitem>
            <para>Ajax or Client modes</para>
         </listitem>
            <listitem>
            <para>Option to control rerendering frequency</para>
         </listitem>
            <listitem>
            <para>Customizable status information label </para>
         </listitem>
             <listitem>
            <para>Highly customizable look and feel</para>
         </listitem>
            
        </itemizedlist>  
    </section>
   <section>
        <title>Details of Usage</title>
        <para>    
            As it was mentioned above, the <emphasis role="bold">
            <property>&lt;rich:progressBar&gt;</property>
         </emphasis>
            component displays the status of the ongoing process. 
        </para>
      
      <para>The <emphasis role="bold">
            <property>&lt;rich:progressBar&gt;</property>  
         </emphasis> component can run in two modes: <code>Ajax</code> (default) and <code>Client</code>.  
      </para>   
      <itemizedlist>
        <listitem>
            <para>
               <code>Ajax</code> - In this mode the component works the same way as <emphasis role="bold">
                  <property>&lt;a4j:poll/&gt;</property>
               </emphasis> which gets the current progress  value  from the sever, repeating after a set time interval.  </para>
          
        </listitem>
        <listitem>
            <para>
               <code>Client</code> - The current progress value in <property>Client</property> mode is set using JavaScript API </para>
        </listitem>
      </itemizedlist>
     <para>
       In order to define the mode you need to  use <emphasis>
            <property>"mode"</property>
         </emphasis> attribute.    
     </para>
     
      <para> 
       One of the key attributes of the component is <emphasis>
            <property>"interval"</property>
         </emphasis> which defines the frequency of status polling and rerenders the component when the value is updated.
      </para>
      <para>
        Polling is active while the <emphasis>
            <property>"enabled"</property>
         </emphasis> attribute is "true".</para>   
      <para>
        <emphasis role="bold">Example:</emphasis>
      </para> 
      <programlisting role="XML"><![CDATA[...
<rich:progressBar value="#{bean.incValue}" id="progrs" interval="900" enabled="true"/>
... ]]></programlisting>                                                                                                                                                                                                                                                                  
      <para>
        With the help of <emphasis>
            <property>"timeout"</property>
         </emphasis> attribute you can define the waiting time on a particular request.
        If a response is not received during this time the request is aborted. 
      </para>
      
      
      <para>
        Status of the process is calculated basing on values of the following attributes: 
      <itemizedlist>
            <listitem>
               <para>     
                  <emphasis>
                     <property>"value"</property>
                  </emphasis> is a value binding to the current progress value
          </para>     
            </listitem>
            <listitem>
               <para>
                  <emphasis>
                     <property>"minValue"</property>
                  </emphasis> (default value is "0") sets minimal progress value  
          </para>
            </listitem>
            <listitem>
               <para>
                  <emphasis>
                     <property>"maxValue"</property>
                  </emphasis> (default value is "100") sets maximum  progress value 
          </para>
            </listitem>
         </itemizedlist>
      </para>
      
      
        <para>
            <emphasis role="bold">Example:</emphasis>
        </para>                                                                                                                                                                                                                                                                    
      <programlisting role="XML"><![CDATA[...
<rich:progressBar value="#{bean.incValue}"  minValue="50"  maxValue="400"/>
... ]]></programlisting>   
      <para>This is the result</para>
      <figure>
        <title>Progress bar</title>  
        <mediaobject>
            <imageobject>
               <imagedata fileref="images/progressBar2.png"/>
            </imageobject>
        </mediaobject>     
      </figure>                                                                                                                                                                                                                                                             
      <!--para>
        The   <emphasis><property> &quot;label&quot;</property></emphasis>  attribute is responsible for displaying informational 
        data, information on the progress bar, if it&apos;s not displayed using  children components. 
        If this attribute is not set and the children components are not used either, no textual information 
        regarding ongoing process will be indicated. 
        In order to indicate the current status you need to pass the value to this attribute. Please  see an example.
      </para>         
      <para>
        <emphasis role="bold">Example:</emphasis>
      </para>
      <programlisting role="XML"><![CDATA[<![CDATA[...	
<rich:progressBar value="#{bean.incValue}" id="progrs" label="{value}%"/>
...]]>]]></programlisting>

 <para>
  Displaying information on a progress bar can be also performed using
  
  <emphasis role="bold"><property>&lt;h:outputText&gt;</property></emphasis>    within 
  <emphasis role="bold"><property>&lt;rich:progressBar&gt;</property>  </emphasis> tags passing the progress value to the value of the JSF tag.  
</para>
<para>
<emphasis role="bold">Example:</emphasis>
</para>

<programlisting role="XML"><![CDATA[<![CDATA[...
<rich:progressBar value="#{bean.incValue1}">
<h:outputText value="#{bean.incValue1}"/>
</rich:progressBar>
...]]> </programlisting-->                                                                                                                                                                                                                                                                <para>
      There are two ways to display information on a progress bar:
    </para>
      <itemizedlist>
        <listitem>
            <para>Using <emphasis>
                  <property> "label"</property>
               </emphasis> attribute</para>
            <para>
               <emphasis role="bold">Example:</emphasis>
            </para>
            <programlisting role="XML"><![CDATA[...	
<rich:progressBar value="#{bean.incValue}" id="progrs" label="#{bean.incValue}"/>
...]]></programlisting>      
        </listitem>
     
        <listitem>
            <para>Using  any child(nested) components. One of the components that can be used is  <emphasis role="bold">
                  <property>&lt;h:outputText /&gt;</property>
               </emphasis>
            </para>
            <para>
               <emphasis role="bold">Example:</emphasis>
            </para>
            <programlisting role="XML"><![CDATA[...
<rich:progressBar value="#{bean.incValue}">
    <h:outputText value="#{bean.incValue} %"/>
</rich:progressBar>
... ]]></programlisting>
        </listitem>

      </itemizedlist>

      <!--Macrosubs-->
      
      <para>
        The <emphasis role="bold">
            <property>&lt;rich:progressBar&gt;</property>  
         </emphasis>
        component provides  3 predefined macrosubstitution parameters: 
       
        <itemizedlist>
            <listitem>
               <para>
                  <code>{value}</code>  contains the current value</para>
            </listitem>
            <listitem>
               <para>
                  <code>{minValue}</code>  contains min value</para>
            </listitem>
            <listitem>
               <para>
                  <code>{maxValue}</code>  contains max value</para>
            </listitem>
        </itemizedlist>
           
        You can use them as follows: 
      </para>
      <para>
        <emphasis role="bold">Example:</emphasis>
      </para>
      <programlisting role="XML"><![CDATA[...
<rich:progressBar value="#{bean.incValue1}" minValue="400" maxValue="900">
        <h:outputText value="Min value is {minValue}, current value is {value}, max value is {maxValue}"/>
</rich:progressBar> 
... ]]></programlisting>    
      <para>This is the result:</para>
      <figure>
        <title>Macrosubstitution</title>  
        <mediaobject>
            <imageobject>
               <imagedata fileref="images/progressBar3.png"/>
            </imageobject>
        </mediaobject>     
      </figure> 
      <!--END of  Macrosubs-->
      
      <!-- Parameters-->
      <!--para>
        The <emphasis><property>&quot;parameters&quot;</property></emphasis>
        is also a special attribute that can be used for substitutional purposes.      
        All you need is to define a value of your own parameter
        (e.g parameters=&quot;param:&apos;#{bean.incValue1}&apos;&quot;)
        and you can use it to pass the data. 
           </para-->                                                                                                                                                                                                                                                                  <para>
        The <emphasis>
            <property>"parameters"</property>
         </emphasis>
        is also a special attribute which defines parameters that  can be to get additional data from server (e.g. additional info about process status). 
        All you need is to define the value of your own parameter
        (e.g <code>parameters="param:'#{bean.incValue1}'"</code>)
        and you can use it to pass the data. 
      </para>                                                                                                                                                                                                                                                                  
      <para>
        <emphasis role="bold">Example:</emphasis>
      </para>
        
        <programlisting role="XML"><![CDATA[...
<rich:progressBar value="#{bean.incValue}" parameters="param:'#{bean.dwnlSpeed}'">
    <h:outputText value="download speed {param} KB/s"/>
</rich:progressBar>
... ]]></programlisting>     
      <para>This is the result:</para>
      <figure>
        <title>Usage of parameters</title>  
        <mediaobject>
            <imageobject>
               <imagedata fileref="images/progressBar4.png"/>
            </imageobject>
        </mediaobject>     
      </figure>    
      
 
 
      <!-- END Parameters-->

      <para>
        The  <emphasis>
            <property>"progressVar"</property>
         </emphasis> attribute (deprecated) defines request scoped variable that could be used
        for substitution purpose.  This variable contains the data taken from <emphasis>
            <property>"value"</property>
         </emphasis> attribute.
        Please, study carefully the following example.
      </para>
      <para>
        <emphasis role="bold">Example:</emphasis>
      </para>
      <programlisting role="XML"><![CDATA[...
<rich:progressBar value="#{bean.incValue1}" enabled="#{bean.enabled1}" id="progrs1" progressVar="progress">
    <h:outputText value="{progress}%"/>
</rich:progressBar>
... ]]></programlisting>                                                                                                                                                                                                                                                                  
      <para>In the shown example <emphasis>
            <property> "progressVar"</property>
         </emphasis> attribute
        defines a variable "progress" with the value taken from <emphasis>
            <property>"value"</property>
         </emphasis>
        attribute of the <emphasis role="bold">
            <property>&lt;rich:progressBar&gt;</property>
         </emphasis> component.
        The "progress" variable performs substitution passing the current progress value to the
        <emphasis>
            <property>"value"</property>
         </emphasis> attribute of the 
        <emphasis role="bold">
            <property>&lt;h:outputText&gt;</property>
         </emphasis>.
        This is how the current value of a progress appears on  
        the label of <emphasis role="bold">
            <property>&lt;rich:progressBar&gt;</property>
         </emphasis>.</para>
        
        <para>As the 
        <emphasis>
            <property> "progressVar"</property>
         </emphasis> attribute is deprecated, it's better to use 
        the predefined macrosubstitution parameter <code>{value}</code> instead. See how you can rewrite the above example with the help of <code>{value}</code>.
      </para>
      <para>
        <emphasis role="bold">Example:</emphasis>
      </para>
      <programlisting role="XML"><![CDATA[...
<rich:progressBar value="#{bean.incValue1}" enabled="#{bean.enabled1}" id="progrs1">
    <h:outputText value="{value}%"/>
</rich:progressBar>
... ]]></programlisting>
      
        <para>
          The component can also employ  <emphasis>
            <property> "initial"</property>
         </emphasis> and <emphasis>
            <property> "complete"</property>
         </emphasis> facets to display the states of the process: 
          <emphasis>
            <property>"initial"</property>
         </emphasis> facet is displayed when the progress value is less or equal to <emphasis>
            <property> "minValue"</property>
         </emphasis>, and the  <emphasis>
            <property>"complete"</property>
         </emphasis> facet is shown when the value is greater or equal to <emphasis>
            <property> "maxValue"</property>
         </emphasis>. Please see an example below.  
        </para>
        <para>
            <emphasis role="bold">Example:</emphasis>
        </para>
        <programlisting role="XML"><![CDATA[...
<rich:progressBar value="#{bean.incValue1}">
    <f:facet name="initial">
        <h:outputText value="Process not started"/>
    </f:facet>
    <f:facet name="complete">
        <h:outputText value="Process completed"/>
    </f:facet>
</rich:progressBar> 
 ... ]]></programlisting>       
      <para>
        Information about the <emphasis>
            <property>"process"</property>
         </emphasis> attribute usage you can find <link linkend="process">" Decide what to process " </link> guide section.
      </para>
    
    </section>
   <section>
      <title>Reference Data</title>
      <para>
         <ulink url="&tlddoc;rich/progressBar.html">Table of 
							&lt;rich:progressBar&gt; 
							 attributes</ulink>.
						</para>
      <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.ProgressBar</entry>
                </row>
                <row>
                    <entry>component-class</entry>
                    <entry>org.richfaces.component.html.HtmlProgressBar</entry>
                </row>
                <row>
                    <entry>component-family</entry>
                    <entry>org.richfaces.ProgressBar</entry>
                </row>
                <row>
                    <entry>renderer-type</entry>
                    <entry>org.richfaces.renderkit.ProgressBarRenderer</entry>
                </row>
                <row>
                    <entry>tag-class</entry>
                    <entry>org.richfaces.taglib.ProgressBarTag</entry>
                </row>
            </tbody>
        </tgroup>
      </table>
      <table> 
            <title>JavaScript API</title>
            <tgroup cols="2">
                <thead>
                    <row>
                        <entry>Function</entry>
                        <entry>Description</entry>
                      
                    </row>
                </thead>
                <tbody>
                    <!--Sorting API -->
                    <row>
                        <entry>enable()</entry>
                        <entry>Begins polling for Ajax mode </entry>
             
                    </row>
                    <row>
                        <entry>disable()</entry>
                        <entry>Stops polling for Ajax mode</entry>
          
                    </row>
                    
                    <row>
                        <entry>setValue(value)</entry>
                        <entry>Updates the progress of the process</entry>
                        
                    </row>
                    <row>
                        <entry>setLabel(label)</entry>
                        <entry>Update the label for the process</entry>
                        
                    </row>
                    
                    
                    
                    
                </tbody>
            </tgroup>
        </table>
      <table>
			      <title>Facets</title>
				     <tgroup cols="2">
					       <thead>
						         <row>
							           <entry>Facet name</entry>
							           <entry>Description</entry>
						         </row>
					       </thead>
					       <tbody>
						         <row>
							           <entry>initial</entry>
							           <entry>Defines the information content about the state of the process if the progress value is less or equal to "minValue"</entry>
						         </row>
						         <row>
							           <entry>complete</entry>
							           <entry>Defines the information content about the state of the process if the value is greater or equal to "maxValue"</entry>
						         </row>
					       </tbody>
				     </tgroup>
		    </table>
      <table id="pBclasses">
         <title>Classes names for the progressBar without a label</title>
         <tgroup cols="2">
            <thead>
               <row>
                  <entry>Class name</entry>
                  <entry>Description</entry>
               </row>
            </thead>
            <tbody>
               <row>
                  <entry>rich-progress-bar-shell</entry>
                  <entry>Defines styles for a wrapper &lt;div&gt; element of a progressBar</entry>
               </row>
               <row>
                  <entry>rich-progress-bar-uploaded</entry>
                  <entry>Defines styles for the completed progress area</entry>
               </row>
               <row>
                  <entry>rich-progress-bar-height</entry>
                  <entry>Defines height for a progressBar</entry>
               </row>
               <row>
                  <entry>rich-progress-bar-width</entry>
                  <entry>Defines width for a progressBar</entry>
               </row>
            </tbody>
         </tgroup>
      </table>
      <table>
         <title>Classes names for the progressBar with a label</title>
         <tgroup cols="2">
            <thead>
               <row>
                  <entry>Class name</entry>
                  <entry>Description</entry>
               </row>
            </thead>
            <tbody>
               <row>
                  <entry>rich-progress-bar-shell-dig</entry>
                  <entry>Defines styles for a wrapper &lt;div&gt; element of a progressBar</entry>
               </row>
               <row>
                  <entry>rich-progress-bar-uploaded-dig</entry>
                  <entry>Defines styles for the label</entry>
               </row>
               <row>
                  <entry>rich-progress-bar-remained</entry>
                  <entry>Defines styles for the remained progress area</entry>
               </row>
               <row>
                  <entry>rich-progress-bar-completed</entry>
                  <entry>Defines styles for the completed progress area</entry>
               </row>
               <row>
                  <entry>rich-progress-bar-height-dig</entry>
                  <entry>Defines height for a progressBar</entry>
               </row>
               <row>
                  <entry>rich-progress-bar-width</entry>
                  <entry>Defines width for a progressBar</entry>
               </row>
            </tbody>
         </tgroup>
      </table>
      <note>
         <title>Note:</title>
         <para>It's necessary to define width of the component in pixels only.</para>
      </note>
							You can find all necessary information about style classes redefinition in 
						<link linkend="customstyles">Definition of Custom Style Classes</link> 
							section.
						</section>
   <section>
      <title>Relevant Resources Links</title>
      <para>
         <ulink url="http://livedemo.exadel.com/richfaces-demo/richfaces/progressBar.jsf?c=progressBar">On the component Live Demo page</ulink>
      you can see the example of <emphasis role="bold">
            <property>&lt;rich:progressBar&gt;</property>
         </emphasis> usage and sources for the given example. </para>
         <para>Read <ulink url="http://www.jboss.org/community/wiki/SimplePingApplicationwithrichprogressBar">"Simple Ping Application with &lt;rich:progressBar&gt;"</ulink> article to find out how to show the progress of server ping process.</para>
         
   
  </section>
</section>
