From: Erik Brakkee Date: Wed, 2 Oct 2013 17:59:33 +0000 (+0200) Subject: Corrected page numbering. X-Git-Url: http://wamblee.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fmaster;p=photos Corrected page numbering. --- 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);