Author: nextgens
Date: 2007-11-20 21:50:59 +0000 (Tue, 20 Nov 2007)
New Revision: 15890

Modified:
   trunk/freenet/src/freenet/clients/http/BookmarkEditorToadlet.java
   trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java
   trunk/freenet/src/freenet/clients/http/bookmark/BookmarkItem.java
Log:
BookmarkToadlet: Add a tooltip to display the description.

I'm not sure that it's how that should be done.

Modified: trunk/freenet/src/freenet/clients/http/BookmarkEditorToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/BookmarkEditorToadlet.java   
2007-11-20 21:23:07 UTC (rev 15889)
+++ trunk/freenet/src/freenet/clients/http/BookmarkEditorToadlet.java   
2007-11-20 21:50:59 UTC (rev 15890)
@@ -225,7 +225,7 @@
                         form.addChild("br");
                         form.addChild("label", "for", "descB", 
(L10n.getString("BookmarkEditorToadlet.descLabel") + ' '));
                         form.addChild("br");
-                        form.addChild("textarea", new String[]{"id", "name", 
"row", "cols", "value"}, new String[]{"descB", "descB", "3", "70", (item == 
null ? "" : item.getDescription())});
+                        form.addChild("textarea", new String[]{"id", "name", 
"row", "cols"}, new String[]{"descB", "descB", "3", "70"}, (item == null ? "" : 
item.getDescription()));
                         form.addChild("br");
                         form.addChild("label", "for", "hasAnActivelink", 
(L10n.getString("BookmarkEditorToadlet.hasAnActivelinkLabel") + ' '));
                         if (item != null && item.hasAnActivelink()) {
@@ -329,7 +329,7 @@
                     if ("addItem".equals(action)) {
                         FreenetURI key = new 
FreenetURI(req.getPartAsString("key", MAX_KEY_LENGTH));
                         boolean hasAnActivelink = 
req.isPartSet("hasAnActivelink");
-                        newBookmark = new BookmarkItem(key, name, 
hasAnActivelink, core.alerts);
+                        newBookmark = new BookmarkItem(key, name, 
req.getPartAsString("descB", MAX_KEY_LENGTH),hasAnActivelink, core.alerts);
                     } else {
                         newBookmark = new BookmarkCategory(name);
                     }

Modified: trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java  2007-11-20 
21:23:07 UTC (rev 15889)
+++ trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java  2007-11-20 
21:50:59 UTC (rev 15890)
@@ -73,7 +73,13 @@
             for (int i = 0; i < items.size(); i++) {
                 BookmarkItem item = items.get(i);
                 HTMLNode row = table.addChild("tr");
-                HTMLNode cell = row.addChild("td", "style", "border: none");
+                HTMLNode cell = new HTMLNode("td", "style", "border: none");
+                String description = item.getDescription();
+                if(!"".equals(description))
+                    row.addChild("span", new String[] { "title", "style"}, new 
String[]{ description, "cursor: help;"}).addChild(cell);
+                else
+                    row.addChild(cell);
+                
                 if (item.hasAnActivelink()) {
                     cell.addChild("a", "href", '/' + 
item.getKey()).addChild("img", new String[]{"src", "height", "width", "alt"},
                             new String[]{'/' + item.getKey() + 
"/activelink.png", "36px", "108px", "activelink"});

Modified: trunk/freenet/src/freenet/clients/http/bookmark/BookmarkItem.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/bookmark/BookmarkItem.java   
2007-11-20 21:23:07 UTC (rev 15889)
+++ trunk/freenet/src/freenet/clients/http/bookmark/BookmarkItem.java   
2007-11-20 21:50:59 UTC (rev 15890)
@@ -133,6 +133,7 @@
     }

     public synchronized void update(FreenetURI uri, boolean hasAnActivelink, 
String description) {
+        System.out.println("###################### "+description);
         this.key = uri;
         this.desc = description;
         this.hasAnActivelink = hasAnActivelink;
@@ -186,6 +187,9 @@
             if (b.hasAnActivelink != hasAnActivelink) {
                 return false;
             }
+            if (!b.desc.equals(desc)) {
+                return false;
+            }
             return true;
         } else {
             return false;
@@ -197,6 +201,6 @@
     }

     public String getDescription() {
-        return desc;
+        return (desc == null ? "" : desc);
     }
 }


Reply via email to