diff --git a/apps/routerconsole/java/src/net/i2p/router/web/GraphHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/GraphHelper.java index e4de305c5..ede694f1d 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/GraphHelper.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/GraphHelper.java @@ -15,13 +15,29 @@ public class GraphHelper extends HelperBase { private int _width; private int _height; private int _refreshDelaySeconds; + + private static final String PROP_X = "routerconsole.graphX"; + private static final String PROP_Y = "routerconsole.graphY"; + private static final String PROP_REFRESH = "routerconsole.graphRefresh"; + private static final String PROP_PERIODS = "routerconsole.graphPeriods"; + private static final String PROP_EVENTS = "routerconsole.graphEvents"; + private static final int DEFAULT_X = 250; + private static final int DEFAULT_Y = 100; + private static final int DEFAULT_REFRESH = 60; + private static final int DEFAULT_PERIODS = 60; public GraphHelper() { - _periodCount = 60; // SummaryListener.PERIODS; - _showEvents = false; - _width = 250; - _height = 100; - _refreshDelaySeconds = 60; + } + + /** set the defaults after we have a context */ + @Override + public void setContextId(String contextId) { + super.setContextId(contextId); + _width = _context.getProperty(PROP_X, DEFAULT_X); + _height = _context.getProperty(PROP_Y, DEFAULT_Y); + _periodCount = _context.getProperty(PROP_PERIODS, DEFAULT_PERIODS); + _refreshDelaySeconds = _context.getProperty(PROP_REFRESH, DEFAULT_REFRESH); + _showEvents = Boolean.valueOf(_context.getProperty(PROP_EVENTS)).booleanValue(); } public void setPeriodCount(String str) { @@ -102,7 +118,9 @@ public class GraphHelper extends HelperBase { } return ""; } + public String getForm() { + saveSettings(); try { _out.write("

" + _("Configure Graph Display") + " [" + _("Select Stats") + "]

"); _out.write("
"); @@ -120,6 +138,25 @@ public class GraphHelper extends HelperBase { return ""; } + /** + * Silently save settings if changed, no indication of success or failure + * @since 0.7.10 + */ + private void saveSettings() { + if (_width != _context.getProperty(PROP_X, DEFAULT_X) || + _height != _context.getProperty(PROP_Y, DEFAULT_Y) || + _periodCount != _context.getProperty(PROP_PERIODS, DEFAULT_PERIODS) || + _refreshDelaySeconds != _context.getProperty(PROP_REFRESH, DEFAULT_REFRESH) || + _showEvents != Boolean.valueOf(_context.getProperty(PROP_EVENTS)).booleanValue()) { + _context.router().setConfigSetting(PROP_X, "" + _width); + _context.router().setConfigSetting(PROP_Y, "" + _height); + _context.router().setConfigSetting(PROP_PERIODS, "" + _periodCount); + _context.router().setConfigSetting(PROP_REFRESH, "" + _refreshDelaySeconds); + _context.router().setConfigSetting(PROP_EVENTS, "" + _showEvents); + _context.router().saveConfig(); + } + } + /** inner class, don't bother reindenting */ private static class AlphaComparator implements Comparator { public int compare(Object lhs, Object rhs) { diff --git a/apps/routerconsole/jsp/graphs.jsp b/apps/routerconsole/jsp/graphs.jsp index d472d5457..e3d5c0115 100644 --- a/apps/routerconsole/jsp/graphs.jsp +++ b/apps/routerconsole/jsp/graphs.jsp @@ -13,9 +13,9 @@
- " /> + -
\ No newline at end of file + diff --git a/history.txt b/history.txt index 3090786d9..11ae0d23d 100644 --- a/history.txt +++ b/history.txt @@ -1,3 +1,13 @@ +2010-01-18 zzz + * configclients.jsp: Fix add-new-client feature + * Console: Add a tunnel share ratio estimate + * graphs.jsp: + - Remove jrobin sig + - Set lower limit to 0 + - Save settings when changed + * Reseed: Support SSL and proxies + * Translate: Catch empty string + 2010-01-17 zzz * Clock: Change a CRIT to an ERROR, lower threshold for changing from 10s to 5s * configclients.jsp: Support add, delete, edit diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index 26d2d9a11..be2f8c298 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -18,7 +18,7 @@ public class RouterVersion { /** deprecated */ public final static String ID = "Monotone"; public final static String VERSION = CoreVersion.VERSION; - public final static long BUILD = 3; + public final static long BUILD = 4; /** for example "-test" */ public final static String EXTRA = "-rc";