<?xml version='1.0' encoding='UTF-8'?>
<chapter>
  
      <para><table frame="all">
 <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.ajax4jsf.Status</entry>
            </row>
            <row>
              <entry>component-family</entry>
              <entry>javax.faces.Panel</entry>
            </row>
            <row>
              <entry>component-class</entry>
              <entry>org.ajax4jsf.component.html.HtmlAjaxStatus</entry>
            </row>
            <row>
              <entry>renderer-type</entry>
              <entry>org.ajax4jsf.components.AjaxStatusRenderer</entry>
            </row>
          </tbody>
        </tgroup>
      </table></para>
    
    <section>
      <title>Creating on a page</title>
      <para>There are two ways to define elements indicating a request status :</para>
	  <itemizedlist>
          <listitem>
            With <emphasis >
                <property>&quot;StartText&quot;/&quot;StopText&quot;</property>
              </emphasis> atributes:
			<programlisting role="XML"><![CDATA[<a4j:status startText="Progress" stopText="Done" for="stat1">]]></programlisting>
            <para>In this case, text elements for the corresponding status are generated.</para>
          </listitem>
        </itemizedlist>
		<itemizedlist>
          <listitem>
            With &quot;Start&quot;/&quot;Stop&quot; facets definition:
			<programlisting role="XML"><![CDATA[<a4j:status for="stat2">
	<f:facet name="start">
		<h:graphicImage value="ajax_process.gif" />
	</f:facet>
	<f:facet name="stop">
		<h:graphicImage value="ajax_stoped.gif" />
	</f:facet>
</a4j:status>]]></programlisting>
            <para>In this case, the elements are generated for each  status and correspond the facets content.</para>
          </listitem>
        </itemizedlist>
    </section>
	  <section>
      <title>Dynamical creation of a component from Java code</title>

  <para>
      <emphasis role="bold">Example:</emphasis>
 </para>
	    <programlisting role="JAVA"><![CDATA[import org.ajax4jsf.component.html.HtmlAjaxStatus;
...
HtmlAjaxStatus  myStatus = new HtmlAjaxStatus();
...]]></programlisting>
    </section>
    <section>
      <title>Key attributes and ways of usage</title>
      <para>There are  two ways for the components or containers definition, which Ajax requests status is tracked by a component.<itemizedlist>
          <listitem>
           Definition with the <emphasis >
        <property>&quot;for&quot;</property>
       </emphasis> 
attribute on the <emphasis role="bold">
          <property>&lt;a4j:status&gt;</property>
        </emphasis> component. Here <emphasis >
        <property>&quot;for&quot;</property>
       </emphasis> 
attribute should point at an Ajax container (<emphasis role="bold"><property>&lt;a4j:region&gt;</property></emphasis>) &quot;id&quot;, which requests are tracked by a component.
          </listitem>
        </itemizedlist><itemizedlist>
          <listitem>
            Definition with the <emphasis >
        <property>&quot;status&quot;</property>
       </emphasis> 
attribute obtained by any RichFaces library action component. The attribute should point at the <emphasis role="bold">
          <property>&lt;a4j:status&gt;</property>
        </emphasis>  component &quot;id&quot;. Then this  <emphasis role="bold">
          <property>&lt;a4j:status&gt;</property>
        </emphasis> component   shows the status for the request fired from this action component.
          </listitem>
        </itemizedlist></para>
      <para>The component creates two <emphasis role="bold"><property>&lt;span&gt;</property></emphasis> or <emphasis role="bold"><property>&lt;div&gt;</property></emphasis>
	  elements depending on attribute "layout"
	  with content defined for each status, one of the elements (start) is initially hidden. At the beginning of an Ajax request, elements state is inversed, hence the second element is shown and the first is hidden. At the end of a response processing, elements display states return to its initial values.</para>
      <para><emphasis role="bold">Example:</emphasis>
      </para>
	  <programlisting role="XML"><![CDATA[<a4j:status startText="Started" stopText="stopped" />]]></programlisting>
      <para>is decoded on a page as:</para><programlisting role="XML"><![CDATA[<span id="j_id20:status.start" style="display: none">
      Started
</span>
<span id="j_id20:status.stop">
        Stopped
</span>]]></programlisting>
      <para>And after the generation of an Ajax response is changed to:</para>
	  <programlisting role="XML"><![CDATA[<span id="j_id20:status.start">
        Started
</span>
<span id="j_id20:status.stop" style="display: none">
        Stopped
</span>]]></programlisting>
      <para>There is a possibility to group a <emphasis role="bold"><property>&lt;a4j:status&gt;</property></emphasis> elements content into <emphasis role="bold"><property>&lt;div&gt;</property></emphasis> elements, instead of <emphasis role="bold"><property>&lt;span&gt;</property></emphasis>. To use it, just redefine the <emphasis >
        <property>&quot;layout&quot;</property>
       </emphasis> 
attribute from &quot;inline&quot;(default) to &quot;block&quot;.</para>
    </section>
  <section>
    <title>Relevant resources links</title>
	<para>
	  <ulink url="http://livedemo.exadel.com/richfaces-demo/richfaces/status.jsf?c=status">Here
	  </ulink>  you can see the example of <emphasis role="bold"
	    ><property>&lt;a4j:status&gt;</property></emphasis> usage and sources for the given example. 
	</para>
  </section>	
</chapter>
