<?xml version='1.0' encoding='UTF-8'?>
<chapter>
          <chapterinfo>
                    <keywordset>
                              <keyword>a4j:repeat</keyword>
                    </keywordset>
          </chapterinfo>
          <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.Repeat</entry>
                                                  </row>
                                                  <row>
                                                  <entry>component-family</entry>
                                                  <entry>javax.faces.Data</entry>
                                                  </row>
                                                  <row>
                                                  <entry>component-class</entry>
                                                  <entry>org.ajax4jsf.component.html.HtmlAjaxRepeat</entry>
                                                  </row>
                                                  <row>
                                                  <entry>renderer-type</entry>
                                                  <entry>org.ajax4jsf.components.RepeatRenderer</entry>
                                                  </row>
                                        </tbody>
                              </tgroup>
                    </table>
          </para>

          <section>
                <title>Creating the Component with a Page Tag</title>
                    <para>
                          To create the simplest variant on a page use the following syntax:
                    </para>
                <programlisting role="XML"><![CDATA[<a4j:repeat id="detail" value="#{bean.props}" var="detail">
	<h:outputText value="#{detail.someProperty}"/>
</a4j:repeat>]]></programlisting>
                    <para>
                          The output is generated according to a collection contained in <code>bean.props</code> with the <code>detail</code> key passed to child components.
                    </para>
          </section>
          <section>
                    <title>Creating the Component Dynamically Using Java</title>

                    <para>
                              <emphasis role="bold">Example:</emphasis>
                    </para>
                    <programlisting role="JAVA"><![CDATA[import org.ajax4jsf.component.html.HtmlAjaxRepeat;
...
HtmlAjaxRepeat repeater = new HtmlAjaxRepeat ();
...
]]></programlisting>
          </section>
          <section>
                    <title>Details of usage</title>
                    <para>
                          The <emphasis role="bold"><property>&lt;a4j:repeat&gt;</property></emphasis> component is similar to Facelets <emphasis role="bold"><property>&lt;ui:repeat&gt;</property></emphasis> tag, 
                          which is used to iterate through a collection of objects binded with JSF page as EL expression. 
                          The main difference of the <emphasis role="bold"><property>&lt;a4j:repeat&gt;</property></emphasis> is a possibility to update particular components (it's children) instead of all using Ajax requests. 
                          The feature that makes the component different is a special <emphasis><property>&quot;ajaxKeys&quot;</property></emphasis> attribute that defines row that are updated after an Ajax request. 
                          As a result it becomes easier to update several child components separately without updating the whole page.
                    </para>
                
     
                    <programlisting role="XML"><![CDATA[...
<table>
      <tbody>
            <a4j:repeat value="#{repeatBean.items}" var="item" ajaxKeys="#{updateBean.updatedRow}">
                  <tr>
                        <td><h:outputText value="#{item.code}" id="item1" /></td>
                        <td><h:outputText value="#{item.price}" id="item2" /></td>
                  </tr>
            </a4j:repeat>
      </tbody>
</table>
 ...]]></programlisting>
                    
                <para>
                      The example above the <emphasis role="bold"><property>&lt;a4j:repeat&gt;</property></emphasis> points to an method that contains row keys to be updated. 
                </para>
                <note>
                      <title>Note:</title>
                      <para>
                            The <emphasis role="bold"><property>&lt;a4j:repeat&gt;</property></emphasis> component is defined as fully updated, 
                            but really updated there are only the row keys which defined in the <emphasis><property>&quot;ajaxKeys&quot;</property></emphasis> attribute. 
                      </para>
                </note>
                
                
                    <para>
                          One more benefit of this component is absence of strictly defined markup as JSF HTML DataTable and TOMAHAWK DataTable has. 
                          Hence the components could be used more flexibly anywhere where it&apos;s necessary to output the results of selection from some collection.
                    </para>
                    
                <para>The next example shows collection output as a plain HTML list:</para>
                    <programlisting role="XML"><![CDATA[<ul>
      <a4j:repeat ...>
	    <li>...<li/>
	               ...
	    <li>...<li/>
      </a4j:repeat>
</ul>]]></programlisting>
                    <para>All other general attributes are defined according to the similar
                              attributes of iterative components (<emphasis role="bold">
                                        <property>&lt;h:dataTable&gt;</property>
                              </emphasis> or <emphasis role="bold">
                                        <property>&lt;ui:repeat&gt;</property>
                              </emphasis>) and are used in the same way.</para>
          </section>

          <section>
                    <title>Relevant resources links</title>
                    <para>
                              Vizit the <ulink url="http://livedemo.exadel.com/richfaces-demo/richfaces/repeat.jsf?c=repeat">Repeat page</ulink> at RichFaces LiveDemo for examples of component usage and their sources.
                    </para>
          </section>
</chapter>
