For each row (one page of the list of pages) a {@link PagingNavigationLink}will be added that contains a {@link Label} with the page number of that link (1..n).
<td wicket:id="navigation"> <a wicket:id="pageLink" href="SearchCDPage.html"> <span wicket:id="pageNumber">1</span> </a> </td>thus renders like:
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
Override method populateItem to customize the rendering of the navigation. For instance:
protected void populateItem(LoopItem loopItem) { final int page = loopItem.getIteration(); final PagingNavigationLink link = new PagingNavigationLink("pageLink", pageableListView, page); if (page > 0) { loopItem.add(new Label("separator", "|")); } else { loopItem.add(new Label("separator", "")); } link.add(new Label("pageNumber", String.valueOf(page + 1))); link.add(new Label("pageLabel", "page")); loopItem.add(link); }With:
<span wicket:id="navigation"> <span wicket:id="separator"></span> <a wicket:id="pageLink" href="#"> <span wicket:id="pageLabel"></span><span wicket:id="pageNumber"></span> </a> </span>renders like:
page1 | page2 | page3 | page4 | page5 | page6 | page7 | page8 | page9Assuming a PageableListView with 1000 entries and not more than 10 lines shall be printed per page, the navigation bar would have 100 entries. Because this is not feasible PagingNavigation's navigation bar is pageable as well.
The page links displayed are automatically adjusted based on the number of page links to be displayed and a margin. The margin makes sure that the page link pointing to the current page is not at the left or right end of the page links currently printed and thus providing a better user experience.
Use setMargin() and setViewSize() to adjust the navigation's bar view size and margin.
Please @see PagingNavigator for a ready made component which already includes links to the first,previous, next and last page. @author Jonathan Locke @author Eelco Hillenius @author Juergen Donnerstag
|
|
|
|