RepeatingView pageLinks = new RepeatingView("pageLinks");
add(pageLinks);
Album album = getAlbum();
- for (int i = 0; i < album.size() / MAX_ROWS / MAX_COLUMNS; i++) {
+ for (int i = 0; i < (album.size() + MAX_ROWS * MAX_COLUMNS - 1) / MAX_ROWS / MAX_COLUMNS; i++) {
final int istart = i * MAX_ROWS * MAX_COLUMNS;
Link pageLink = new Link("pageLink") {
{
setResponsePage(HomePage.class, pars);
}
};
- pageLink.add(new Label("label", i + ""));
+ pageLink.add(new Label("label", (i + 1) + ""));
pageLinks.add(pageLink);
WebMarkupContainer container = new WebMarkupContainer(pageLinks.newChildId());
container.add(pageLink);