[freenet-cvs] r11910 - trunk/freenet/src/freenet/clients/http

mario at freenetproject.org mario at freenetproject.org
Sat Feb 24 21:21:36 UTC 2007


Author: mario
Date: 2007-02-24 21:21:31 +0000 (Sat, 24 Feb 2007)
New Revision: 11910

Modified:
   trunk/freenet/src/freenet/clients/http/BookmarkManager.java
Log:
add bookmark move {up|down} functionality


Modified: trunk/freenet/src/freenet/clients/http/BookmarkManager.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/BookmarkManager.java	2007-02-24 21:19:48 UTC (rev 11909)
+++ trunk/freenet/src/freenet/clients/http/BookmarkManager.java	2007-02-24 21:21:31 UTC (rev 11910)
@@ -151,4 +151,31 @@
 		this.bookmarks.remove(b);
 		if(store && started) node.storeConfig();
 	}
+	
+	public void moveBookmarkDown (Bookmark b, boolean store) {		
+		int i = this.bookmarks.indexOf(b);
+		if (i == -1) return;
+		
+		Bookmark bk = (Bookmark)this.bookmarks.get(i);
+		this.bookmarks.remove(i);
+		this.bookmarks.add((i+1)%(this.bookmarks.size()+1), bk);
+		
+		if(store && started) node.storeConfig();
+	}
+
+	public void moveBookmarkUp (Bookmark b, boolean store) {
+		int i = this.bookmarks.indexOf(b);
+		if (i == -1) return;
+		
+		Bookmark bk = (Bookmark)this.bookmarks.get(i);
+		this.bookmarks.remove(i);
+		if (--i < 0) i = this.bookmarks.size();
+		this.bookmarks.add(i, bk);
+		
+		if(store && started) node.storeConfig();
+	}
+	
+	public int getSize() {
+		return this.bookmarks.size();
+	}
 }




More information about the cvs mailing list