roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r559835 - in /roller/trunk/apps/weblogger: src/java/org/apache/roller/weblogger/pojos/wrapper/WeblogBookmarkFolderWrapper.java web/WEB-INF/velocity/weblog.vm
Date Thu, 26 Jul 2007 14:37:08 GMT
Author: snoopdave
Date: Thu Jul 26 07:37:07 2007
New Revision: 559835

URL: http://svn.apache.org/viewvc?view=rev&rev=559835
Log:
Fix for ROL-548 - Bookmark display macro not obeying sort order

Modified:
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/wrapper/WeblogBookmarkFolderWrapper.java
    roller/trunk/apps/weblogger/web/WEB-INF/velocity/weblog.vm

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/wrapper/WeblogBookmarkFolderWrapper.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/wrapper/WeblogBookmarkFolderWrapper.java?view=diff&rev=559835&r1=559834&r2=559835
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/wrapper/WeblogBookmarkFolderWrapper.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/wrapper/WeblogBookmarkFolderWrapper.java
Thu Jul 26 07:37:07 2007
@@ -22,7 +22,9 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
+import java.util.TreeSet;
 import org.apache.roller.weblogger.WebloggerException;
+import org.apache.roller.weblogger.pojos.BookmarkComparator;
 import org.apache.roller.weblogger.pojos.WeblogBookmark;
 import org.apache.roller.weblogger.pojos.WeblogBookmarkFolder;
 
@@ -115,7 +117,24 @@
         return wrappedCollection;
     }
     
-    
+    public List getBookmarksSorted() {
+        TreeSet initialCollection = new TreeSet(new BookmarkComparator());
+        initialCollection.addAll(this.pojo.getBookmarks());
+        
+        // iterate through and wrap
+        // we force the use of an ArrayList because it should be good enough to cover
+        // for any Collection type we encounter.
+        ArrayList wrappedCollection = new ArrayList(initialCollection.size());
+        Iterator it = initialCollection.iterator();
+        int i = 0;
+        while(it.hasNext()) {
+            wrappedCollection.add(i,WeblogBookmarkWrapper.wrap((WeblogBookmark) it.next()));
+            i++;
+        }
+        
+        return wrappedCollection;
+    }    
+        
     public List retrieveBookmarks(boolean subfolders)
             throws WebloggerException {
         

Modified: roller/trunk/apps/weblogger/web/WEB-INF/velocity/weblog.vm
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/web/WEB-INF/velocity/weblog.vm?view=diff&rev=559835&r1=559834&r2=559835
==============================================================================
--- roller/trunk/apps/weblogger/web/WEB-INF/velocity/weblog.vm (original)
+++ roller/trunk/apps/weblogger/web/WEB-INF/velocity/weblog.vm Thu Jul 26 07:37:07 2007
@@ -366,7 +366,7 @@
 *#
 #macro(_showBookmarkLinksList $folderObject $subfolders $expanding )
     #if ($expanding) #_showCommonJavascript() #end
-    #set($bookmarks = $folderObject.getBookmarks())
+    #set($bookmarks = $folderObject.getBookmarksSorted())
     #set($folders = $folderObject.getFolders())
     #set($divId = $utils.replace($folderObject.name, " ", "_" ))
     #if ($folderObject.name != "root" && $expanding && $subfolders &&
($folderObject.getBookmarks().size() > 0 || $folderObject.getFolders().size() > 0))



Mime
View raw message