From d298ab80958db758d0888d2a51ec182637c47524 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 10 Jun 2014 14:41:35 +0200 Subject: [PATCH] Add constants for the default sort field and order. --- src/main/java/net/pterodactylus/sone/web/KnownSonesPage.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/web/KnownSonesPage.java b/src/main/java/net/pterodactylus/sone/web/KnownSonesPage.java index dd1b1fc..ee4973f 100644 --- a/src/main/java/net/pterodactylus/sone/web/KnownSonesPage.java +++ b/src/main/java/net/pterodactylus/sone/web/KnownSonesPage.java @@ -41,6 +41,9 @@ import com.google.common.collect.Ordering; */ public class KnownSonesPage extends SoneTemplatePage { + private static final String defaultSortField = "name"; + private static final String defaultSortOrder = "asc"; + /** * Creates a “known Sones” page. * @@ -66,8 +69,8 @@ public class KnownSonesPage extends SoneTemplatePage { String sortField = request.getHttpRequest().getParam("sort"); String sortOrder = request.getHttpRequest().getParam("order"); String filter = request.getHttpRequest().getParam("filter"); - templateContext.set("sort", (sortField != null) ? sortField : "name"); - templateContext.set("order", (sortOrder != null) ? sortOrder : "asc"); + templateContext.set("sort", (sortField != null) ? sortField : defaultSortField); + templateContext.set("order", (sortOrder != null) ? sortOrder : defaultSortOrder); templateContext.set("filter", filter); final Sone currentSone = getCurrentSone(request.getToadletContext(), false); Collection knownSones = Collections2.filter(webInterface.getCore().getSones(), Sone.EMPTY_SONE_FILTER); -- 2.7.4