<?xml version="1.0" encoding="UTF-8"?>
<section>
    <sectioninfo>
        <keywordset>
            <keyword>rich:progressBar</keyword>
            <keyword>progressBar</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.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>
    <section>
        <title>Creating the Component with a Page Tag</title>
        <para>Here is a simple example of how the component can be used on a page: </para>
        <para>
            <emphasis role="bold">Example:</emphasis>
        </para>
        <programlisting role="XML"><![CDATA[...
<rich:progressBar value="#{bean.incValue1}"/>
...]]></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.progressBar;
...	
HtmlProgressBar myProgressBar = new progressBar();
...]]></programlisting>
    </section>
    <!-- Start  Details of Usage-->
    <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>&quot;mode&quot;</property></emphasis> attribute.    
     </para>
      
      
      
      
      <para> 
       One of the key attributes of the component is <emphasis><property>&quot;interval&quot;</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>&quot;enabled&quot;</property></emphasis> attribute is &quot;true&quot;.</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>&quot;timeout&quot;</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>&quot;value&quot;</property></emphasis> is a value binding to the current progress value
          </para>     
        </listitem>
        <listitem>
          <para>
            <emphasis><property>&quot;minValue&quot;</property></emphasis> (default value is &quot;0&quot;) sets minimal progress value  
          </para>
        </listitem>
        <listitem>
          <para>
            <emphasis><property>&quot;maxValue&quot;</property></emphasis> (default value is &quot;100&quot;) 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[...	
<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[...
<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> &quot;label&quot;</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>

   
      <!--para>  
      The   <emphasis><property> &quot;progressVar&quot;</property></emphasis> attribute serves to provide an option for a
      value substitution on the page. It defines a variable that contains the 
      data taken from 
      <emphasis><property>&quot;value&quot;</property></emphasis> attribute. 
      The sole purpose of the 
      <emphasis><property> &quot;progressVar&quot;</property></emphasis> 
      attribute is to provide a way to use the data placed into the 
      <emphasis><property>&quot;value&quot;</property></emphasis> attribute. 
      Please study carefully the following code example:
      </para-->
      
      <para>
        The  <emphasis><property>&quot;progressVar&quot;</property></emphasis> attribute defines request scoped variable that could be used
        for substitution purpose.  This variable contains the data taken from <emphasis><property>&quot;value&quot;</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> &quot;progressVar&quot;</property></emphasis> attribute
  gets the &quot;progress&quot; value which contains data taken from 
 <emphasis><property>&quot;value&quot;</property></emphasis>
   attribute of  a 
  <emphasis role="bold"><property>&lt;rich:progressBar&gt;</property>  </emphasis>
        and transfers the received data to the &quot;value&quot; attribute of <property>&lt;h:outputText&gt;</property>, to make the data appear on the page. 
        </para-->
      
      <para>
        In the shown example <emphasis><property> &quot;progressVar&quot;</property></emphasis> attribute
        defines a variable &quot;progress&quot; with the value taken from <emphasis><property>&quot;value&quot;</property></emphasis>
        attribute of the <emphasis role="bold"><property>&lt;rich:progressBar&gt;</property></emphasis> component.
        The &quot;progress&quot; variable performs substitution passing the current progress value to the
        <emphasis><property>&quot;value&quot;</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>

      <!--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>&quot;parameters&quot;</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=&quot;param:&apos;#{bean.incValue1}&apos;&quot;</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 component can also employ  <emphasis><property> &quot;initial&quot;</property></emphasis> and <emphasis><property> &quot;complete&quot;</property></emphasis> facets to display the states of the process: 
          <emphasis><property>&quot;initial&quot;</property></emphasis> facet is displayed when the progress value is less or equal to <emphasis><property> &quot;minValue&quot;</property></emphasis>, and the  <emphasis><property>&quot;complete&quot;</property></emphasis> facet is shown when the value is greater or equal to <emphasis><property> &quot;maxValue&quot;</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>&quot;process&quot;</property></emphasis> attribute usage you can find <link linkend="process">here</link>.
      </para>
    
    </section>
    <!-- End. Details of Usage-->
    
    <!-- JavaScript API-->  
 <section>
        <title>JavaScript API</title>
        <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>
    </section>
    <!-- End of JavaScript API-->   
    
	<section>
		<title>Facets</title>
		<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 &quot;minValue&quot;</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 &quot;maxValue&quot;</entry>
						</row>
					</tbody>
				</tgroup>
		</table>
	</section>
	
    <!-- Look-and-Feel Customization-->  
    
    <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:progressBar&gt;</property>
        </emphasis> components at once: <itemizedlist>
            <listitem><para>Redefine the corresponding skin parameters</para></listitem>
            <listitem><para> Add to your style sheets style classes used by a <emphasis role="bold">
                <property>&lt;rich:progressBar&gt;</property>
            </emphasis> component</para></listitem>
        </itemizedlist>
        </para>
    </section>
       
  <!-- Skin Parameters Redefinition-->  
 <section>
    <title>Skin Parameters Redefinition</title>

   <table>
     <title>Skin parameters redefinition for the progressBar without a label</title>
     <tgroup cols="2">
       <thead>
         <row>
           <entry>Skin parameters</entry>
           <entry>CSS properties</entry>
         </row>
       </thead>
       <tbody>
         <row>
           <entry>controlBackgroundColor</entry>
           <entry>background-color</entry>
         </row>
         <row>
           <entry>panelBorderColor</entry>
           <entry>border-color</entry>
         </row>
       </tbody>
     </tgroup>
   </table>
   
   <table>
     <title>Skin parameters redefinition for the completed progress area of the progressBar without a label</title>
     <tgroup cols="2">
       <thead>
         <row>
           <entry>Skin parameters</entry>
           <entry>CSS properties</entry>
         </row>
       </thead>
       <tbody>
         <row>
           <entry>selectControlColor</entry>
           <entry>background-color</entry>
         </row>
       </tbody>
     </tgroup>
   </table>
   
    <table>
      <title>Skin parameters redefinition for the progressBar with a label</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>
          <row>
            <entry>generalFamilyFont</entry>
            <entry>font-family</entry>
          </row>
          <row>
            <entry>generalSizeFont</entry>
            <entry>font-size</entry>
          </row>
          <row>
            <entry>controlTextColor</entry>
            <entry>color</entry>
          </row>
        </tbody>
      </tgroup>
    </table>

   <table>
     <title>Skin parameters redefinition for the label of the progressBar</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 the completed progress area of the progressBar with a label</title>
     <tgroup cols="2">
       <thead>
         <row>
           <entry>Skin parameters</entry>
           <entry>CSS properties</entry>
         </row>
       </thead>
       <tbody>
         <row>
           <entry>selectControlColor</entry>
           <entry>background-color</entry>
         </row>
         <row>
           <entry>controlBackgroundColor</entry>
           <entry>color</entry>
         </row>
       </tbody>
     </tgroup>
   </table>
   
   <table>
     <title>Skin parameters redefinition for the remained progress area of the progressBar with a label</title>
     <tgroup cols="2">
       <thead>
         <row>
           <entry>Skin parameters</entry>
           <entry>CSS properties</entry>
         </row>
       </thead>
       <tbody>
         <row>
           <entry>controlBackgroundColor</entry>
           <entry>background-color</entry>
         </row>
         <row>
           <entry>controlTextColor</entry>
           <entry>color</entry>
         </row>
       </tbody>
     </tgroup>
   </table>
    
  </section>
  <!-- END Skin Parameters Redefinition-->  

  <!-- Definition of Custom Style Classes-->  

  <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/progressBar_cn.png"/>
        </imageobject>
      </mediaobject>
    </figure>
    
    <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&apos;s necessary to define width of the component in pixels only.</para>
    </note>

    <para>In order to redefine styles for all <emphasis role="bold">
      <property>&lt;rich:progressBar&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="pBclasses">above</link>) and define necessary properties in them.
    </para> 
    
    <para>
      <emphasis role="bold">Example:</emphasis>
    </para>
    <programlisting role="CSS"><![CDATA[...
.richfacesSkin .mceButton {									
    border: 1px #FF0000 solid;						
}	
...]]></programlisting>  
    
    <para>This is the result:</para>
    
    <figure>
      <title>Redefinition styles with predefined classes</title>
      <mediaobject>
        <imageobject>
          <imagedata fileref="images/progressBar_pc.png"/>
        </imageobject>
      </mediaobject>
    </figure>
    <para>In the example above background color of the remained part of progress area was changed.</para>
      
    <para>It&apos;s also possible to change styles of a particular 
      <emphasis role="bold"> <property>&lt;rich:progressBar&gt;</property></emphasis> component. In this case you should create own style classes and use them in corresponding 
      <emphasis role="bold"><property>&lt;rich:progressBar&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: #ebf3fd;
}
...]]></programlisting>  
    <para>The <emphasis><property>&quot;styleClass&quot;</property></emphasis> attribute for <emphasis role="bold"
      ><property>&lt;rich:progressBar&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:progressBar value="#{bean.incValue1}" styleClass="myClass"/>
]]></programlisting>    
    
    <para>This is the result:</para>
    
    <figure>
      <title>Modificaton of a look and feel with own classes and <emphasis><property>styleClass</property></emphasis> attributes</title>
      <mediaobject>
        <imageobject>
          <imagedata fileref="images/progressBar_pc.png"/>
        </imageobject>
      </mediaobject>
    </figure>  
    
    <para>As it could be seen on the picture above, background color of the remained part of progress area was changed.</para>
    
    
  </section>
  <section>
    <title>Relevant Resources Links</title>
    <para>
      <ulink url="http://livedemo.exadel.com/richfaces-demo/richfaces/progressBar.jsf?c=progressBar">Here</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>
   
  </section>
</section>
