[ http://jira.codehaus.org/browse/DISPL-115?page=comments#action_41617 ]
$remoteUser.fullName commented on DISPL-115: ------------------------ Casino card: http://www.abccasinos.com/casino/casino_card.htm Free casino: http://www.abccasinos.com/casino/free_casino.htm Best online casino: http://www.abccasinos.com/casino/best_online_casino.htm > PaginationDecorator - decorating the page links > ----------------------------------------------- > > Key: DISPL-115 > URL: http://jira.codehaus.org/browse/DISPL-115 > Project: DisplayTag > Type: Wish > Components: Paging/Sorting, HTML Generation > Versions: 1.0 RC1 > Reporter: fabrizio giustina > Attachments: dt.diff > > > ==== > 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 -- 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 - For more information on JIRA, see: http://www.atlassian.com/software/jira ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click _______________________________________________ displaytag-devel mailing list displaytag-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/displaytag-devel