<?xml version='1.0' encoding='UTF-8'?>
<section>
  <sectioninfo>
    <keywordset>
      <keyword>scroller</keyword>
      <keyword>rich:Datascroller</keyword>
      <keyword>HtmlDatascroller</keyword>
      <keyword>tables</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.Datascroller</entry>
        </row>
        <row>
          <entry>component-class</entry>
          <entry>org.richfaces.component.html.HtmlDatascroller</entry>
        </row>
        <row>
          <entry>component-family</entry>
          <entry>org.richfaces.Datascroller</entry>
        </row>
        <row>
          <entry>renderer-type</entry>
          <entry>org.richfaces.DatascrollerRenderer</entry>
        </row>
        <row>
          <entry>tag-class</entry>
          <entry>org.richfaces.taglib.DatascrollerTag</entry>
        </row>
      </tbody>
    </tgroup>
  </table>

  <section>
    <title>Creating the Component with a Page Tag</title>
    <para>Here is a simple example as it could be used on a page:</para>

    <para>
      <emphasis role="bold">Example:</emphasis>
    </para>
    <programlisting role="XML"><![CDATA[...
    <h:dataTable id="table">
        ...
    </h:dataTable>
    ...
    <rich:datascroller for="table"/>
...
]]></programlisting>
  </section>
  <section>
    <title>Dynamical creation from Java code</title>

    <para>
      <emphasis role="bold">Example:</emphasis>
    </para>
    <programlisting role="JAVA"><![CDATA[import org.richfaces.component.html.HtmlDatascroller;
...	
HtmlDatascroller myScroll = new HtmlDatascroller();
...
]]></programlisting>
  </section>
  <section>
    <title>Details of Usage</title>
    <para>The <emphasis role="bold">
      <property>&lt;rich:Datascroller&gt;</property>
    </emphasis> component provides table scrolling functionalitity the same as tomahawk scroller but
      with Ajax requests usage.</para>
    <para>The component should be placed into footer of the parent table or be bound to it with the <emphasis>
      <property>&quot;for&quot;</property>
    </emphasis> attribute.</para>
    <para>The table should also have the defined <emphasis>
      <property>&quot;rows&quot;</property>
    </emphasis> attribute limiting the quantity of inputted table rows.</para>
    <para>The scroller could limit the maximum quantity of rendered links on the table pages with
      the help of the <emphasis>
        <property>&quot;maxPages&quot;</property>
      </emphasis> attribute.</para>
    <para>Component provides two controllers groups for switching:</para>
    <itemizedlist>
      <listitem>Page numbers for switching onto a particular page</listitem>
      <listitem>The controls of fast switching: <emphasis>
        <property>&quot;first&quot;,</property>
      </emphasis>
        <emphasis>
          <property>&quot;last&quot;,</property>
        </emphasis>
        <emphasis>
          <property>&quot;next&quot;,</property>
        </emphasis>
        <emphasis>
          <property>&quot;previous&quot;,</property>
        </emphasis>
        <emphasis>
          <property>&quot;fastforward&quot;,</property>
        </emphasis>
        <emphasis>
          <property>&quot;fastrewind&quot;</property>
        </emphasis></listitem>
    </itemizedlist>
    <para>The controls of fast switching are created adding the facets component with the
      corresponding name:</para>
    
    <para>
      <emphasis role="bold">Example:</emphasis>
    </para>
    <programlisting role="XML"><![CDATA[ ...
    <rich:datascroller for="table" maxPages="10">
        <f:facet name="first">
            <h:outputText value="First"/>
        </f:facet>
        <f:facet name="last">
            <h:outputText value="Last"/>
        </f:facet>
    </rich:Datascroller>
...
]]></programlisting>
    <figure>
      <title>Datascroller controls</title>
      <mediaobject>
        <imageobject>
          <imagedata fileref="images/datascroller2.gif"/>
        </imageobject>
      </mediaobject>
    </figure>
    <para>The screenshot shows one controller from each group.</para>
    <para> There are also facets used to create the disabled states: <emphasis>
      <property>&quot;first_disabled&quot;,</property>
    </emphasis>
      <emphasis>
        <property>&quot;last_disabled&quot;,</property>
      </emphasis>
      <emphasis>
        <property>&quot;next_disabled&quot;,</property>
      </emphasis>
      <emphasis>
        <property>&quot;previous_disabled&quot;,</property>
      </emphasis>
      <emphasis>
        <property>&quot;fastforward_disabled&quot;,</property>
      </emphasis>
      <emphasis>
        <property>&quot;fastrewind_disabled&quot;</property>
      </emphasis>. </para>
    <para>For the <emphasis>
      <property>&quot;fastforward&quot;/&quot;fastrewind&quot;</property>
    </emphasis> controls customization the additional <emphasis>
      <property>&quot;fastStep&quot;</property>
    </emphasis> attribute is used. The attribute indicates pages quantity to switch onto when fast
      scrolling is used. </para>
    <para>The <emphasis>
      <property>&quot;pageIndexVar&quot;</property>
    </emphasis> and <emphasis>
      <property>&quot;pagesVar&quot;</property>
    </emphasis> attributes provide an ability to show the current page and the number of pages in
      the dataScroller. These attributes are used for definition the names of variables, that will
      be used in the facet with name<emphasis>
        <property>&quot;pages&quot;.</property>
      </emphasis> An example can be found below: </para>
    <para>
      <emphasis role="bold">Example:</emphasis>
    </para>
    <programlisting role="XML"><![CDATA[ ...
      <h:form>
            <rich:dataTable value="#{capitalsBean.capitals}" var="cap" rows="5">
                  <rich:column>
                         <h:outputText value="#{cap.name}"></h:outputText>
                  </rich:column>
                  <f:facet name="footer">
                        <rich:datascroller pageIndexVar="pageIndex" pagesVar="pages">
                                <f:facet name="pages">
                                      <h:outputText value="#{pageIndex} / #{pages}"></h:outputText>
                                </f:facet>
                        </rich:datascroller>
                  </f:facet>
            </rich:dataTable>
      </h:form>
...
]]></programlisting>
    <para> It&apos;s possible to insert optional separators between controls. For this purpose use a <emphasis>
      <property>&quot;controlSeparator&quot;</property>
    </emphasis> facet. An example is placed below. </para>
    <programlisting role="XML"><![CDATA[ ...
      <f:facet name="controlSeparator">
            <h:graphicImage value="/image/sep.gif"/>
      </f:facet>
...
]]></programlisting>
    
  </section>
  <section>
    <title>Look-and-Feel Customization</title>
    <para>For skinnability implementation, the components use a <emphasis><property>style class
          redefinition method</property>.</emphasis></para>
    <para>Default style classes are mapped on <emphasis><property>skin
      parameters</property>.</emphasis></para>
    <para>To redefine appearance of all dataScrollers at once, there are two ways:</para>
    <itemizedlist>
      <listitem>to redefine corresponding skin parameters</listitem>
      <listitem>to add <emphasis>
          <property>style classes</property>
        </emphasis> used by the dataScroller to your page style sheets</listitem>
    </itemizedlist>
  </section>
  <section>
    <title>Skin parameters redefinition</title>
    <table>
      <title>Skin Parameters for the rapper element</title>
      <tgroup cols="2">
        <thead>
          <row>
            <entry>Skin parameters</entry>
            <entry>CSS properties</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry>tableBackgroundColor</entry>
            <entry>background-color</entry>
          </row>
          <row>
            <entry>panelBorderColor</entry>
            <entry>border-color</entry>
          </row>
        </tbody>
      </tgroup>
    </table>

    <table>
      <title>Skin Parameters for Button 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>
          <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>
        </tbody>
      </tgroup>
    </table>

    <table>
      <title>Skin Parameters for Active Button element</title>
      <tgroup cols="2">
        <thead>
          <row>
            <entry>Skin parameters</entry>
            <entry>CSS properties</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry>generalTextColor</entry>
            <entry>border-top-color</entry>
          </row>
          <row>
            <entry>generalTextColor</entry>
            <entry>color</entry>
          </row>
          <row>
            <entry>generalFamilyFont</entry>
            <entry>font-family</entry>
          </row>
          <row>
            <entry>generalSizeFont</entry>
            <entry>font-size</entry>
          </row>
        </tbody>
      </tgroup>
    </table>

    <table>
      <title>Skin Parameters for Inactive Button element</title>
      <tgroup cols="2">
        <thead>
          <row>
            <entry>Skin parameters</entry>
            <entry>CSS properties</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry>headerBackgroundColor</entry>
            <entry>border-top-color</entry>
          </row>
          <row>
            <entry>headerBackgroundColor</entry>
            <entry>color</entry>
          </row>
          <row>
            <entry>generalFamilyFont</entry>
            <entry>font-family</entry>
          </row>
          <row>
            <entry>generalSizeFont</entry>
            <entry>font-size</entry>
          </row>
        </tbody>
      </tgroup>
    </table>

    <figure>
      <title>Datascroller style classes</title>
      <mediaobject>
        <imageobject>
          <imagedata fileref="images/datascroller3.gif"/>
        </imageobject>
      </mediaobject>
    </figure>

    <para>On the screenshot, there are classes names that define specified elements.</para>

    <table>
      <title>Component skin class</title>
      <tgroup cols="2">
        <thead>
          <row>
            <entry>Class name</entry>
            <entry>Class description</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry>rich-dtascroller-table</entry>
            <entry>Wrapping class for the component</entry>
          </row>
          <row>
            <entry>Rich-datascr-button</entry>
            <entry>Customization class for button</entry>
          </row>
        </tbody>

      </tgroup>
    </table>
    <table>
      <title>Additional classes for buttons</title>
      <tgroup cols="2">
        <thead>
          <row>
            <entry>Class name</entry>
            <entry>Class description</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry>Rich-datascr-act</entry>
            <entry>Customization class for active button</entry>
          </row>
          <row>
            <entry>Rich-datascr-inact</entry>
            <entry>Customization class for inactive button</entry>
          </row>
        </tbody>
      </tgroup>
    </table>
    <para>To redefine an appearance of all scrollers on a page, just redefine one of these classes</para>
    <para>And to redefine the appearance of the particular scroller, one may use corresponding class
      attributes on the component.</para>
  </section>
  <section>
    <title>Relevant resources links</title>
    <para>
      <ulink
        url="http://livedemo.exadel.com/richfaces-demo/richfaces/dataTableScroller.jsf?c=dataTableScroller"
        >Here</ulink> you can see the example of <emphasis role="bold"
        >&lt;rich:dataScroller&gt;</emphasis> usage and sources for the given example. </para>
    <para> The solution about how to do correct pagination using datascroller (load a part of data from
      database) can be found on the <ulink
        url="http://www.jboss.com/index.html?module=bb&amp;op=viewtopic&amp;p=4060199#4060199"
        >RichFaces Users Forum</ulink>. </para>
    <para>How to use <emphasis role="bold">&lt;rich:dataTable&gt;</emphasis> and <emphasis
      role="bold">&lt;rich:dataScroller&gt;</emphasis> in a context of Extended
      Data Model see <ulink
        url="http://www.jboss.com/index.html?module=bb&amp;op=viewtopic&amp;t=115636"
        >here</ulink>.</para>
  </section>
</section>
