support plugin themes

This commit is contained in:
zzz
2010-02-26 16:58:01 +00:00
parent 7b70210c9a
commit b4911a2b2f
3 changed files with 75 additions and 11 deletions

View File

@ -1,6 +1,7 @@
package net.i2p.router.web;
import java.io.File;
import java.util.Iterator;
import java.util.TreeSet;
import java.util.Set;
@ -19,6 +20,8 @@ public class ConfigUIHelper extends HelperBase {
return buf.toString();
}
static final String PROP_THEME_PFX = "routerconsole.theme.";
/** @return standard and user-installed themes, sorted (untranslated) */
private Set<String> themeSet() {
Set<String> rv = new TreeSet();
@ -33,6 +36,13 @@ public class ConfigUIHelper extends HelperBase {
if (files[i].isDirectory() && ! name.equals("images"))
rv.add(name);
}
// user themes
Set props = _context.getPropertyNames();
for (Iterator iter = props.iterator(); iter.hasNext(); ) {
String prop = (String) iter.next();
if (prop.startsWith(PROP_THEME_PFX) && prop.length() > PROP_THEME_PFX.length())
rv.add(prop.substring(PROP_THEME_PFX.length()));
}
return rv;
}