From: <fg...@us...> - 2011-04-10 07:24:25
|
Revision: 3413 http://openutils.svn.sourceforge.net/openutils/?rev=3413&view=rev Author: fgiust Date: 2011-04-10 07:24:18 +0000 (Sun, 10 Apr 2011) Log Message: ----------- TAGCLOUD-12 tags should be sorted case-insensitive Modified Paths: -------------- trunk/openutils-mgnltagcloud/src/main/java/net/sourceforge/openutils/mgnltagcloud/el/TagCloudElFunctions.java Modified: trunk/openutils-mgnltagcloud/src/main/java/net/sourceforge/openutils/mgnltagcloud/el/TagCloudElFunctions.java =================================================================== --- trunk/openutils-mgnltagcloud/src/main/java/net/sourceforge/openutils/mgnltagcloud/el/TagCloudElFunctions.java 2011-04-10 07:22:49 UTC (rev 3412) +++ trunk/openutils-mgnltagcloud/src/main/java/net/sourceforge/openutils/mgnltagcloud/el/TagCloudElFunctions.java 2011-04-10 07:24:18 UTC (rev 3413) @@ -1,7 +1,9 @@ +// PATCH al modulo openutils-mgnltagcloud per risolvere la http://jira.openmindlab.com/browse/TAGCLOUD-12 + /** * * Tagcloud module for Magnolia CMS (http://www.openmindlab.com/lab/products/mgnltagcloud.html) - * Copyright(C) 2010-2011, Openmind S.r.l. http://www.openmindonline.it + * Copyright(C) 2010-2010, Openmind S.r.l. http://www.openmindonline.it * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -118,9 +120,22 @@ * @param ascending sort direction * @return sorted tag cloud */ - public static Map<String, Integer> sortbyname(Map<String, Integer> tags, boolean ascending) + public static Map<String, Integer> sortbyname(Map<String, Integer> tags, final boolean ascending) { - return sort(tags, new ValueComparer<String, Integer>(tags, true, ascending)); + return sort(tags, new Comparator<String>() + { + + public int compare(String o1, String o2) + { + int compareResult = o1.compareToIgnoreCase(o2) * (ascending ? 1 : -1); + if (compareResult == 0) + { + return o1.compareTo(o2) * (ascending ? 1 : -1); + } + return compareResult; + } + + }); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |