From: David ‘Bombe’ Roden Date: Tue, 10 Jun 2014 12:41:35 +0000 (+0200) Subject: Add constants for the default sort field and order. X-Git-Tag: 0.9-rc1^2~3^2~252 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=d298ab80958db758d0888d2a51ec182637c47524;p=Sone.git Add constants for the default sort field and order. --- 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);