- Add tooltip support for plugin links

- Make target=_blank for plugin links
This commit is contained in:
zzz
2010-04-05 13:22:16 +00:00
parent 32861b7ce9
commit caab860351
2 changed files with 22 additions and 4 deletions

View File

@@ -10,6 +10,7 @@ import net.i2p.I2PAppContext;
public class NavHelper {
private static Map<String, String> _apps = new ConcurrentHashMap(4);
private static Map<String, String> _tooltips = new ConcurrentHashMap(4);
/**
* To register a new client application so that it shows up on the router
@@ -22,8 +23,15 @@ public class NavHelper {
public static void registerApp(String name, String path) {
_apps.put(name, path);
}
public static void registerApp(String name, String path, String tooltip) {
_apps.put(name, path);
_tooltips.put(name, tooltip);
}
public static void unregisterApp(String name) {
_apps.remove(name);
_tooltips.remove(name);
}
/**
@@ -39,8 +47,11 @@ public class NavHelper {
String path = _apps.get(name);
if (path == null)
continue;
buf.append(" <a target=\"_top\" href=\"").append(path).append("\">");
buf.append(name).append("</a>");
buf.append(" <a target=\"_blank\" href=\"").append(path).append("\" ");
String tip = _tooltips.get(name);
if (tip != null)
buf.append("title=\"").append(tip).append("\" ");
buf.append('>').append(name).append("</a>");
}
return buf.toString();
}