<?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>Creating the Component Dynamically Using Java</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>&lt;rich:datascroller&gt; controls</title>
      <mediaobject>
        <imageobject>
          <imagedata fileref="images/datascroller2.png"/>
        </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.png"/>
      </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> 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:datascroller&gt;</property>
    </emphasis> components at once:</para>
    
    <itemizedlist>
      <listitem>
        <para>Redefine the corresponding skin parameters</para>
      </listitem>
      
      <listitem>
        <para>Add to your style sheets <emphasis>
          <property>style classes</property>
        </emphasis> used by a <emphasis role="bold">
          <property>&lt;rich:datascroller&gt;</property>
        </emphasis> component</para>
      </listitem>
    </itemizedlist>
  </section>
  
  <section>
    <title>Skin Parameters Redefinition</title>
    <table>
      <title>Skin parameters redefinition for a wrapper 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 redefinition for a button</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 redefinition for an active button</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 redefinition for an inactive button</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>
    </section>

    <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>Style classes</title>
      <mediaobject>
        <imageobject>
          <imagedata fileref="images/datascroller3.png"/>
        </imageobject>
      </mediaobject>
    </figure>

    <table>
      <title>Classes names that define a component appearance</title>
      <tgroup cols="2">
        <thead>
          <row>
            <entry>Class name</entry>
            <entry>Description</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry>rich-datascr</entry>
            <entry>Defines styles for a wrapper  &lt;div&gt; element of a datascroller</entry>
          </row>
          <row>
            <entry>rich-dtascroller-table</entry>
            <entry>Defines styles for a wrapper table element of a datascroller</entry>
          </row>
          <row>
            <entry>rich-datascr-button</entry>
            <entry>Defines styles for a button</entry>
          </row>
          
          <row>
            <entry>rich-datascr-ctrls-separator</entry>
            <entry>Defines styles for a separator between buttons</entry>
          </row>
        </tbody>

      </tgroup>
    </table>
    <table>
      <title>Classes names that define a buttons appearance</title>
      <tgroup cols="2">
        <thead>
          <row>
            <entry>Class name</entry>
            <entry>Description</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry>rich-datascr-act</entry>
            <entry>Defines styles for an active button</entry>
          </row>
          <row>
            <entry>rich-datascr-inact</entry>
            <entry>Defines styles for an inactive button</entry>
          </row>
          <row>
            <entry>rich-datascr-button-dsbld</entry>
            <entry>Defines styles for a disabled button</entry>
          </row>
        </tbody>
      </tgroup>
    </table>
      <para>In order to redefine styles for all <emphasis role="bold">
        <property>&lt;rich:datascroller&gt;</property>
      </emphasis> components on a page using CSS, it&apos;s enough to create classes with the
        same names and define necessary properties in them.</para>
      
      <para>To change styles of particular <emphasis role="bold">
        <property>&lt;rich:datascroller&gt;</property>
      </emphasis> components, define your own style classes in the corresponding <emphasis
        role="bold">
        <property>&lt;rich:datascroller&gt;</property>
      </emphasis>attributes.</para>
      
      <para>CSS code piece used on a page:</para>
      
      <para>
        <emphasis role="bold">Example:</emphasis>
      </para>
      <programlisting role="CSS"><![CDATA[...
.rich-datascr-button{
    color: #A52A2A;
}
.myClass{
    font-size: xx-large;
}
...]]></programlisting>
      <para>The component is defined in the following way:</para>
      
      <para>
        <emphasis role="bold">Example:</emphasis>
      </para>
      <programlisting role="XML"><![CDATA[<rich:datascroller ... inputClass="myClass" .../>]]></programlisting>
      
  </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"
        ><property>&lt;rich:datascroller&gt;</property></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"><property>&lt;rich:dataTable&gt;</property></emphasis> and <emphasis
      role="bold"><property>&lt;rich:datascroller&gt;</property></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>
