Feature Requests item #899791, was opened at 2004-02-18 10:38 Message generated for change (Comment added) made by jpski You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=536616&aid=899791&group_id=73068
Category: None Group: v 1.0-b2 Status: Open Resolution: None Priority: 5 Submitted By: Jeremy Przasnyski (jpski) Assigned to: Nobody/Anonymous (nobody) Summary: PaginationDecorator - decorating the page links Initial Comment: 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 ---------------------------------------------------------------------- >Comment By: Jeremy Przasnyski (jpski) Date: 2004-02-18 11:04 Message: Logged In: YES user_id=762064 Forgot to mention, my changes are based off displaytag-1.0-b2 if someone uses the patch. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=536616&aid=899791&group_id=73068 ------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click _______________________________________________ displaytag-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/displaytag-devel