From ed354ea3ecea219b4c27b4b24aaa5a9d4fff1de5 Mon Sep 17 00:00:00 2001 From: Erik Brakkee Date: Wed, 2 Oct 2013 19:59:33 +0200 Subject: [PATCH] Corrected page numbering. --- src/main/java/org/wamblee/photos/wicket/AlbumPanel.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/wamblee/photos/wicket/AlbumPanel.java b/src/main/java/org/wamblee/photos/wicket/AlbumPanel.java index a84c870..0b9666d 100644 --- a/src/main/java/org/wamblee/photos/wicket/AlbumPanel.java +++ b/src/main/java/org/wamblee/photos/wicket/AlbumPanel.java @@ -169,7 +169,7 @@ public class AlbumPanel extends Panel { 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") { { @@ -186,7 +186,7 @@ public class AlbumPanel extends Panel { 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); -- 2.31.1