org.hdpagination.config.pattern
Class YahooPageLinksPattern

java.lang.Object
  extended by org.hdpagination.config.pattern.BasePageLinksPattern
      extended by org.hdpagination.config.pattern.YahooPageLinksPattern
All Implemented Interfaces:
PageLinksPattern

public class YahooPageLinksPattern
extends BasePageLinksPattern
implements PageLinksPattern

Display 'Pagination Control' links as the following pattern or style:

First Prev 1 2 3 4 5 6 7 8 9 10 Next Last

The rules of display can be described as follows:
  • The page links contain a maximum set of page links defined by 'maxPageLinks2Display' property. If fewer pages of results exist, only show page links for the available pages.
  • When on pages 1 - (maxPageLinks2Display/2+1), the page links should always start at '1'. When on any page after (maxPageLinks2Display/2+1), the page links should start at the current page minus maxPageLinks2Display/2. For example,if maxPageLinks2Display is 10,then When on pages 1 - 6, the page links should always start at '1' When on any page after 6 (7 and onward), the page links should start at the current page minus 5. e.g., when on page 7, the first page will be 2 (7 - 5 = 2) and the last page will be 11 (still shows 10 pages.)
  • When on first page of results do not display the 'Previous' and 'First' page links
  • When on the last page of results do not display the 'Next' and 'Last' page links
  • Do not display a hyperlink for the current page in the page links
  • Since:
    1.0
    Author:
    Liangfeng Ren

    Field Summary
     
    Fields inherited from class org.hdpagination.config.pattern.BasePageLinksPattern
    FIRST_PAGE_BUNDLE_KEY, LAST_PAGE_BUNDLE_KEY, NEXT_PAGE_BUNDLE_KEY, PREVIOUS_PAGE_BUNDLE_KEY, resourceBundleName
     
    Constructor Summary
    YahooPageLinksPattern(int maxPages)
               
     
    Method Summary
     Output[] output(Page page, java.lang.Object request)
              Tell PaginationLinkTag which kinds of "Pagination Control" links should be displayed in page.
     void setDisplayFirstPageLink(boolean displayFirstPageLink)
              If the 'first' page navigation link should be displayed when current page is not the first page.
     void setDisplayLastPageLink(boolean displayLastPageLink)
              If the 'last' page navigation link should be displayed when current page is not the last page.
     
    Methods inherited from class org.hdpagination.config.pattern.BasePageLinksPattern
    getMessage, setEscapeHtmlChar, setResourceBundleName
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    YahooPageLinksPattern

    public YahooPageLinksPattern(int maxPages)
    Parameters:
    maxPages - The maximum number of page links between 'previous' and 'next' navigation links
    Method Detail

    setDisplayFirstPageLink

    public void setDisplayFirstPageLink(boolean displayFirstPageLink)
    If the 'first' page navigation link should be displayed when current page is not the first page. If this flag is set to false, the 'first' page link is never displayed in page even when on the first page.

    Parameters:
    displayFirstPageLink -

    setDisplayLastPageLink

    public void setDisplayLastPageLink(boolean displayLastPageLink)
    If the 'last' page navigation link should be displayed when current page is not the last page. If this flag is set to false, the 'last' page link is never displayed in page even when on the last page.

    Parameters:
    displayLastPageLink -

    output

    public Output[] output(Page page,
                           java.lang.Object request)
    Description copied from interface: PageLinksPattern
    Tell PaginationLinkTag which kinds of "Pagination Control" links should be displayed in page.

    In order to support Portlet environment, the type of the second argument (request) has been changed from HttpServletRequest to Object since version 1.2

    Specified by:
    output in interface PageLinksPattern
    request - the request is an instance of HttpServletRequest if running in Servlet environment, or an instance of PortletRequest if running in Portlet environment.
    Returns:
    Array of "Pagination Control" links or normal labels that will be displayed in page


    Copyright © 2008 HDPagination All Rights Reserved.