<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>JMatter Blog: Paging</title>
    <link>http://jmatter.org/articles/2007/03/07/paging</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Simplify</description>
    <item>
      <title>Paging</title>
      <description>&lt;p&gt;We've all had to implement this feature as developers.
Today, many frameworks such as Tapestry for example,
will provide components out of the box that will automatically
take care of paging a listing on your behalf.&lt;/p&gt;

&lt;p&gt;JMatter also provides paging out of the box.  When I sat 
down and started to think about this feature, I saw a 
certain pattern.  One's first, naive implementation of 
paging might consist of a simple forward and back navigation
buttons:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;  &amp;lt;   &amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Shortly afterwards comes the request for the ability to navigate
to the first and last page in a listing, and so they are added:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;  &amp;lt;&amp;lt;   &amp;lt;      &amp;gt;   &amp;gt;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then embellished, like so:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;  &amp;lt;&amp;lt;   &amp;lt;   [Page 3]   &amp;gt;   &amp;gt;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Over time, paging has evolved to let you navigate to a number
of pages in the vicinity of the current page:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;  1 2 ..  7  [Page 8] 9 .. 13 14
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This is what most web-based applications do today.&lt;/p&gt;

&lt;p&gt;What I realized is that paging, taken to its eventual limit,
is essentially embodied in the behaviour of a scrollbar.  Most
scrollbars provide continous scrolling.  Whereas in the case of
paging, the scrolling is more discrete.  The more pages there
are, the less this discrete behaviour is apparent.  What's nice
about today's scrollbars is that their size is inversely proportional
to the length of the list.  The larger the list, the smaller they
are.  Scrollbars have the advantage of giving you more of a visual
perspective of where you are in the list.  And you can simply drag
the scrollbutton to any location along its dimension.&lt;/p&gt;

&lt;p&gt;JMatter's Swing-based view mechanism defines a view implementation:
a component named PageScrollBar which extends Swing's JScrollBar,
shown at the bottom of the following listing:&lt;/p&gt;

&lt;p&gt;&lt;img src="/tips/paging.png" alt="Paging Desktop Matters Sessions"/&gt;&lt;/p&gt;

&lt;p&gt;As usual, developers of JMatter applications need not concern themselves
with this at all.  It's bundled into the framework and it just works.
If however you feel the need to customize the way this scrollbar looks
or behaves, it's easy enough with a little Swing experience to make
the desired revisions.&lt;/p&gt;</description>
      <pubDate>Wed, 07 Mar 2007 17:10:00 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:4b0773d9-fa03-40a4-b4f7-da8fcbe3cc25</guid>
      <author>Eitan Suez</author>
      <link>http://jmatter.org/articles/2007/03/07/paging</link>
    </item>
  </channel>
</rss>
