Message:

  A new issue has been created in JIRA.

---------------------------------------------------------------------
View the issue:
  http://jira.codehaus.org/browse/DISPL-115

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: DISPL-115
    Summary: PaginationDecorator - decorating the page links
       Type: Wish

     Status: Unassigned
   Priority: Major

 Original Estimate: Unknown
 Time Spent: Unknown
  Remaining: Unknown

    Project: DisplayTag
 Components: 
             HTML Generation
             Paging/Sorting
   Versions:
             1.0 RC1

   Assignee: 
   Reporter: fabrizio giustina

    Created: Sun, 14 Nov 2004 3:24 PM
    Updated: Sun, 14 Nov 2004 3:24 PM

Description:
====
imported from sf tracker
id 899791 
submitted by Jeremy Przasnyski - jpski
http://sourceforge.net/support/tracker.php?aid=899791 
====

I had a requirement for a project I'm working on that specifies
a pagination nav bar that looks like this:
<< previous 1-20 | 21-40 | 41-49 next >>

displaytags provides a look for the pagination nav bar that looks
like this:
[first/prev] 1, 2, 3, 4 [next/last]

Using custom properties, it can be made to look like this:
<< previous 1 | 2 | 3 | 4 next >>

The page labels cannot be changed using the standard displaytags
code, so I modified the code to use a decorator to provide the
functionality. I've attached a diff that adds the requested
functionality.

Here's an example that yields the results required by the specs:

BEGIN JSP
<%@ taglib uri="display-tag" prefix="display" %>
...
<display:table
name="results"
property="items"
id="item"
pagesize="20"
decorator="dttest.SearchResultsDecorator"
paginationDecorator="dttest.SearchResultsPaginationDecorator"
requestURI="search.do">
<display:setProperty name="basic.show.header" value="false"/>
<display:setProperty name="paging.banner.group_size"
value="5"/>
<display:column property="labelWithMarkup"/>
</display:table>
...
END JSP

BEGIN Java (com/mmode/myphonepws/search/
SearchResultsPaginationDecorator.java)
package dttest;

import org.displaytag.decorator.PaginationDecorator;
import org.displaytag.pagination.NumberedPage;

/**
* @author jeremy
*
* This class implements the interface used to decorate the
pagination nav bar
* page labels according to the PRD specification. The look of
labels will look
* like this:
* << previous 1-20 | 21-40 | 41-49 next >>
*/
public class SearchResultsPaginationDecorator implements
PaginationDecorator {

/* (non-Javadoc)
* @see
org.displaytag.decorator.PaginationDecorator#decorate(org.displayt
ag.pagination.NumberedPage, int)
*/
public String decorate(NumberedPage page, int pageSize) {
int first = (page.getNumber()-1)*pageSize+1;
int last = first+page.getItemCount()-1;
return "" + first + "-" + last;
}
}
END Java




---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira



-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
displaytag-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/displaytag-devel

Reply via email to