<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.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>a.muse: Digg-Style Pagination in Java</title>
    <link>http://www.jessirae.com/blog/articles/2010/02/18/digg-style-pagination-in-java</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>Digg-Style Pagination in Java</title>
      <description>The following is something like a translation of &lt;a href="http://www.strangerstudios.com/sandbox/pagination/diggstyle.php"&gt;Digg-Style Pagination&lt;/a&gt; into java.
&lt;pre&gt;&lt;code&gt;public ArrayList getPagingLinks(){
    ArrayList pages = new ArrayList();
    if (pageCount &amp;lt; (7 + (adjacents * 2))){
        for(int i=1; i&amp;lt;=pageCount; i++){
            pages.add(i);
        }                
    } else if(currentPage &amp;lt; ((adjacents * 3) + 1)){
        for(int i=1; i&amp;lt;=(4 + (adjacents * 2)); i++){
            pages.add(i);
        }
        pages.add("e");
        pages.add(pageCount);
    } else if(((pageCount - (adjacents * 2)) &amp;gt; currentPage) &amp;#38;&amp;#38; (currentPage &amp;gt; (adjacents * 2))){
        pages.add(1);
        pages.add("e");
        for(int i=currentPage -adjacents; i&amp;lt;=currentPage +adjacents; i++){
            pages.add(i);
        }
        pages.add("e");
        pages.add(pageCount);
    } else{
        pages.add(1);
        pages.add("e");
        for(int i=pageCount - (adjacents *3); i&amp;lt;=pageCount; i++){
            pages.add(i);
        }  
    }
    return pages;
  }&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Basically, it creates a list of links to pages determined by the displayCount.  If the page number equals the current page or the page number is greater than the page count, then no link will be added, only the page number.&lt;/p&gt;
</description>
      <pubDate>Thu, 18 Feb 2010 17:35:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:9546ab7a-b58e-4166-ab82-c1e71362e93e</guid>
      <author>Jessica</author>
      <link>http://www.jessirae.com/blog/articles/2010/02/18/digg-style-pagination-in-java</link>
      <category>technology</category>
      <category>comments</category>
      <category>java</category>
      <category>digg</category>
      <category>pagination</category>
      <trackback:ping>http://www.jessirae.com/blog/articles/trackback/12843</trackback:ping>
    </item>
  </channel>
</rss>

