org.hdpagination.config.pattern
Class DefaultPageLinksPattern
java.lang.Object
org.hdpagination.config.pattern.BasePageLinksPattern
org.hdpagination.config.pattern.DefaultPageLinksPattern
- All Implemented Interfaces:
- PageLinksPattern
public class DefaultPageLinksPattern
- 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
This pattern is very similar to YahooPageLinksPattern,
but there is some small difference.
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.
The page links should always start at '1', 1+maxPageLinks2Display,1+maxPageLinks2Display*2...1+maxPageLinks2Display*n.
For example if maxPageLinks2Display is 10 then it should always start at '1' when on page between 1-10
,start at '11' when on page between 11-20.
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
|
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultPageLinksPattern
public DefaultPageLinksPattern(int maxPages)
- Parameters:
maxPages - The maximum number of page links between 'previous' and 'next' navigation links
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.