From: <jbo...@li...> - 2005-11-04 22:51:37
|
Author: adamw Date: 2005-11-04 17:51:31 -0500 (Fri, 04 Nov 2005) New Revision: 1517 Modified: trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FeedsDescriptor.java trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnDirectory.java Log: http://jira.jboss.com/jira/browse/JBLAB-408 : feed sorting Modified: trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FeedsDescriptor.java =================================================================== --- trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FeedsDescriptor.java 2005-11-04 21:51:42 UTC (rev 1516) +++ trunk/forge/portal-extensions/forge-feeds/src/java/org/jboss/forge/feeds/FeedsDescriptor.java 2005-11-04 22:51:31 UTC (rev 1517) @@ -27,6 +27,8 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; @@ -119,7 +121,7 @@ // Creating the maps that will hold the feeds. feeds = new HashMap<String, Map<String, Feed>>(); - feedGroups = new HashMap<String, Set<String>>(); + feedGroups = new LinkedHashMap<String, Set<String>>(); feedDisplayNames = new HashMap<String, String>(); // Preparing maps which will hold feed definitions. @@ -387,7 +389,7 @@ Node n; NodeList nodes = root.getChildNodes(); - Set<String> feedGroup = new HashSet<String>(); + Set<String> feedGroup = new LinkedHashSet<String>(); feedGroups.put(XmlTools.getAttributeValue(root, "display-name"), feedGroup); Modified: trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnDirectory.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnDirectory.java 2005-11-04 21:51:42 UTC (rev 1516) +++ trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnDirectory.java 2005-11-04 22:51:31 UTC (rev 1517) @@ -24,6 +24,7 @@ import java.io.File; import java.io.FilenameFilter; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import org.jboss.shotoku.Directory; @@ -43,16 +44,21 @@ List<Node> ret = new ArrayList<Node>(); try { + String[] list = + new File(service.getFileSystemPath(id, fullPath + )).list(new FilenameFilter() { + public boolean accept(File dir, String name) { + if (new File(dir.getAbsolutePath() + File.separator + name) + .isDirectory()) + return false; + return true; + } + }); + + Arrays.sort(list); + // Filtering files from this directory and adding them. - for (String node : new File(service.getFileSystemPath(id, - fullPath)).list(new FilenameFilter() { - public boolean accept(File dir, String name) { - if (new File(dir.getAbsolutePath() + File.separator + name) - .isDirectory()) - return false; - return true; - } - })) { + for (String node : list) { String childFullPath = fullPath + '/' + node; ret.add(new SvnHeadNode(id, childFullPath, new File(service .getFileSystemPath(id, childFullPath)), node, svnCm)); @@ -69,17 +75,21 @@ try { // Filtering directories from this directory and adding them. - for (String directory : new File(service.getFileSystemPath(id, + String[] list = new File(service.getFileSystemPath(id, fullPath)).list(new FilenameFilter() { - public boolean accept(File dir, String name) { - if (name.equals(".svn")) - return false; - if (new File(dir.getAbsolutePath() + File.separator + name) - .isDirectory()) - return true; - return false; - } - })) { + public boolean accept(File dir, String name) { + if (name.equals(".svn")) + return false; + if (new File(dir.getAbsolutePath() + File.separator + name) + .isDirectory()) + return true; + return false; + } + }); + + Arrays.sort(list); + + for (String directory : list) { String childFullPath = fullPath + '/' + directory; ret.add(new SvnDirectory(id, childFullPath, new File(service .getFileSystemPath(id, childFullPath)), directory, |