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 f0e01fc4926dc5d5a021890e0b2cee69d768e85c..b0014fdf80ac79d564f5641781291e70f6a85790 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/GraphHelper.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/GraphHelper.java @@ -45,7 +45,7 @@ public class GraphHelper extends FormHandler { /** * This must be output in the jsp since <meta> must be in the <head> - * @since 0.8.6 + * @since 0.8.7 */ public String getRefreshMeta() { if (_refreshDelaySeconds <= 8 || @@ -85,11 +85,11 @@ public class GraphHelper extends FormHandler { } catch (NumberFormatException nfe) {} } - /** @since 0.8.6 */ + /** @since 0.8.7 */ public void setPersistent(String foo) { _persistent = true; } public String getImages() { - if (StatSummarizer.instance().isDisabled()) + if (StatSummarizer.isDisabled()) return ""; try { List listeners = StatSummarizer.instance().getListeners(); @@ -157,7 +157,7 @@ public class GraphHelper extends FormHandler { private static final int[] times = { 60, 2*60, 5*60, 10*60, 30*60, 60*60, -1 }; public String getForm() { - if (StatSummarizer.instance().isDisabled()) + if (StatSummarizer.isDisabled()) return ""; String prev = System.getProperty("net.i2p.router.web.GraphHelper.nonce"); if (prev != null) System.setProperty("net.i2p.router.web.GraphHelper.noncePrev", prev); @@ -204,11 +204,11 @@ public class GraphHelper extends FormHandler { /** * We have to do this here because processForm() isn't called unless the nonces are good - * @since 0.8.6 + * @since 0.8.7 */ @Override public String getAllMessages() { - if (StatSummarizer.instance().isDisabled()) { + if (StatSummarizer.isDisabled()) { addFormError("Graphing not supported with this JVM: " + System.getProperty("java.vendor") + ' ' + System.getProperty("java.version") + " (" + diff --git a/apps/routerconsole/java/src/net/i2p/router/web/StatSummarizer.java b/apps/routerconsole/java/src/net/i2p/router/web/StatSummarizer.java index 26e5f246394417d053f3f974701d9698ad82b6e7..0eee091c09933028bf053583c97e8a8378503454 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/StatSummarizer.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/StatSummarizer.java @@ -48,7 +48,7 @@ public class StatSummarizer implements Runnable { private static final int MAX_CONCURRENT_PNG = 3; private final Semaphore _sem; private volatile boolean _isRunning = true; - private volatile boolean _isDisabled; + private boolean _isDisabled; private Thread _thread; public StatSummarizer() { @@ -88,9 +88,9 @@ public class StatSummarizer implements Runnable { } } - /** @since 0.8.6 */ - boolean isDisabled() { - return _isDisabled; + /** @since 0.8.7 */ + static boolean isDisabled() { + return _instance == null || _instance._isDisabled; } /** list of SummaryListener instances */ @@ -305,7 +305,7 @@ public class StatSummarizer implements Runnable { def.setTitle(title); long started = _context.router().getWhenStarted(); if (started > start && started < end) - def.vrule(started / 1000, Color.BLACK, null, 4.0f); // no room for legend + def.vrule(started / 1000, SummaryRenderer.RESTART_BAR_COLOR, null, 4.0f); // no room for legend String sendName = SummaryListener.createName(_context, "bw.sendRate.60000"); String recvName = SummaryListener.createName(_context, "bw.recvRate.60000"); def.datasource(sendName, txLsnr.getData().getPath(), sendName, SummaryListener.CF, txLsnr.getBackendName()); @@ -392,25 +392,27 @@ public class StatSummarizer implements Runnable { /** * Delete the old rrd dir if we are no longer persistent - * @since 0.8.6 + * @since 0.8.7 */ private void deleteOldRRDs() { File rrdDir = new File(_context.getRouterDir(), SummaryListener.RRD_DIR); FileUtil.rmdir(rrdDir, false); } + private static final boolean IS_WIN = System.getProperty("os.name").startsWith("Win"); + /** translate a string */ private String _(String s) { // the RRD font doesn't have zh chars, at least on my system - // Works on 1.5.9 - //if ("zh".equals(Messages.getLanguage(_context))) - // return s; + // Works on 1.5.9 except on windows + if (IS_WIN && "zh".equals(Messages.getLanguage(_context))) + return s; return Messages.getString(s, _context); } /** * Make sure any persistent RRDs are closed - * @since 0.8.6 + * @since 0.8.7 */ private class Shutdown implements Runnable { public void run() { diff --git a/apps/routerconsole/java/src/net/i2p/router/web/SummaryBarRenderer.java b/apps/routerconsole/java/src/net/i2p/router/web/SummaryBarRenderer.java index b07573bd53e20b9c93ab93dc86b4751d88f2f72d..c5627295aa5ca224959ceead8bc98058bc3fc78b 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/SummaryBarRenderer.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/SummaryBarRenderer.java @@ -131,7 +131,7 @@ public class SummaryBarRenderer { // .append(_("Jobs")) // .append("</a>\n" + - if (!StatSummarizer.instance().isDisabled()) { + if (!StatSummarizer.isDisabled()) { buf.append("<a href=\"/graphs\" target=\"_top\" title=\"") .append(_("Graph router performance")) .append("\">") diff --git a/apps/routerconsole/java/src/net/i2p/router/web/SummaryRenderer.java b/apps/routerconsole/java/src/net/i2p/router/web/SummaryRenderer.java index ba7ee6fb18fa92aa79e4f9f6eb16ebe82ae2f459..2ee9a2a94181a13698152a76048e761e1a333079 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/SummaryRenderer.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/SummaryRenderer.java @@ -34,6 +34,7 @@ class SummaryRenderer { private final Log _log; private final SummaryListener _listener; private final I2PAppContext _context; + static final Color RESTART_BAR_COLOR = new Color(255, 144, 0, 224); public SummaryRenderer(I2PAppContext ctx, SummaryListener lsnr) { _log = ctx.logManager().getLog(SummaryRenderer.class); @@ -101,9 +102,9 @@ class SummaryRenderer { String title; String p; // we want the formatting and translation of formatDuration2(), except not zh, and not the - //if ("zh".equals(Messages.getLanguage(_context))) - // p = DataHelper.formatDuration(_listener.getRate().getPeriod()); - //else + if (IS_WIN && "zh".equals(Messages.getLanguage(_context))) + p = DataHelper.formatDuration(_listener.getRate().getPeriod()); + else p = DataHelper.formatDuration2(_listener.getRate().getPeriod()).replace(" ", " "); if (showEvents) title = name + ' ' + _("events in {0}", p); @@ -130,7 +131,7 @@ class SummaryRenderer { } long started = ((RouterContext)_context).router().getWhenStarted(); if (started > start && started < end) - def.vrule(started / 1000, Color.BLACK, _("Restart"), 4.0f); + def.vrule(started / 1000, RESTART_BAR_COLOR, _("Restart"), 4.0f); def.datasource(plotName, path, plotName, SummaryListener.CF, _listener.getBackendName()); if (descr.length() > 0) def.area(plotName, Color.BLUE, descr + "\\r"); @@ -190,12 +191,14 @@ class SummaryRenderer { } } + private static final boolean IS_WIN = System.getProperty("os.name").startsWith("Win"); + /** translate a string */ private String _(String s) { // the RRD font doesn't have zh chars, at least on my system - // Works on 1.5.9 - //if ("zh".equals(Messages.getLanguage(_context))) - // return s; + // Works on 1.5.9 except on windows + if (IS_WIN && "zh".equals(Messages.getLanguage(_context))) + return s; return Messages.getString(s, _context); } @@ -204,9 +207,9 @@ class SummaryRenderer { */ private String _(String s, String o) { // the RRD font doesn't have zh chars, at least on my system - // Works on 1.5.9 - //if ("zh".equals(Messages.getLanguage(_context))) - // return s.replace("{0}", o); + // Works on 1.5.9 except on windows + if (IS_WIN && "zh".equals(Messages.getLanguage(_context))) + return s.replace("{0}", o); return Messages.getString(s, o, _context); } } diff --git a/history.txt b/history.txt index e66935f50fa63046b9844e3df202259f4ba146fb..fd12cab05646d72bbb4466baaa16c30f27799b4f 100644 --- a/history.txt +++ b/history.txt @@ -1,3 +1,10 @@ +2011-05-23 zzz + * Console: + - Disable zh translation in graphs on windows due to font issues + - Force news refetch after URL change + - Fix NPE at startup + - Graph tweaks + 2011-05-23 sponge * mbuild.sh fixups * add new jcpuid/mbuild.sh -- pedantic naming diff --git a/installer/resources/themes/console/dark/console.css b/installer/resources/themes/console/dark/console.css index b1af23e74b79c880e480ad11b893bb60bc8c23c9..e82a0aad1b5c0d5a0adda7c8c6007053b9825809 100644 --- a/installer/resources/themes/console/dark/console.css +++ b/installer/resources/themes/console/dark/console.css @@ -469,7 +469,7 @@ div.graphspanel img { text-align: center !important; background: #000; - opacity: 0.8; + opacity: 0.9; } div.graphspanel img:hover { diff --git a/installer/resources/themes/console/light/console.css b/installer/resources/themes/console/light/console.css index 426086518d222e25116362ad2c0bdcb605fc61e3..dcb8a2ced6132540d088840c039f75b427d06c0c 100644 --- a/installer/resources/themes/console/light/console.css +++ b/installer/resources/themes/console/light/console.css @@ -477,7 +477,7 @@ div.graphspanel img { text-align: center !important; background: #001; -moz-box-shadow: inset 0px 0px 1px 1px #99f; - opacity: 0.8; + opacity: 0.9; } div.graphspanel img:hover { diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index 0725033fa600cfb5180ac82283f5194ee35b34b0..f6e6df3a5c0d10fbf1efc2f7069c342c2fe16f4e 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 = "";