A navigation for a PageableListView that holds links to other pages of the
PageableListView.
For each row (one page of the list of pages) a
PagingNavigationLink will
be added that contains a
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</>
</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(ListItem listItem)
{
final int page = ((Integer)listItem.getModelObject()).intValue();
final PagingNavigationLink link = new PagingNavigationLink("pageLink", pageableListView, page);
if (page > 0)
{
listItem.add(new Label("separator", "|"));
}
else
{
listItem.add(new Label("separator", ""));
}
link.add(new Label("pageNumber", String.valueOf(page + 1)));
link.add(new Label("pageLabel", "page"));
listItem.add(link);
}
With:
<td wicket:id="navigation">
<span wicket:id="separator"/>
<a wicket:id="pageLink" href="#">
<span wicket:id="pageLabel"/><span wicket:id="pageNumber"/>
</a>
</td>
renders like:
page1 | page2 | page3 | page4 | page5 | page6 | page7 | page8 | page9
Assuming a PageableListView with 1000 entries and not more than 10 lines
shall be printed per page, the navigation bar would have 100 entries. |