From 1b2d5c5525f7f827a3d42a9add3f1bd2c77d6d23 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Mon, 21 Nov 2011 18:53:05 +0100 Subject: [PATCH] Sort albums by title in gallery mode. --- src/main/java/net/pterodactylus/sone/web/ImageBrowserPage.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/web/ImageBrowserPage.java b/src/main/java/net/pterodactylus/sone/web/ImageBrowserPage.java index 406a762..5bb75d1 100644 --- a/src/main/java/net/pterodactylus/sone/web/ImageBrowserPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ImageBrowserPage.java @@ -18,8 +18,9 @@ package net.pterodactylus.sone.web; import java.net.URI; -import java.util.HashSet; -import java.util.Set; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import net.pterodactylus.sone.data.Album; import net.pterodactylus.sone.data.Image; @@ -81,10 +82,11 @@ public class ImageBrowserPage extends SoneTemplatePage { String mode = request.getHttpRequest().getParam("mode", null); if ("gallery".equals(mode)) { templateContext.set("galleryRequested", true); - Set albums = new HashSet(); + List albums = new ArrayList(); for (Sone sone : webInterface.getCore().getSones()) { albums.addAll(sone.getAllAlbums()); } + Collections.sort(albums, Album.TITLE_COMPARATOR); templateContext.set("albums", albums); return; } -- 2.7.4