Changeset 592361b


Ignore:
Timestamp:
May 23, 2011 7:22:33 PM (10 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
68dccdf
Parents:
6e4df88
Message:
  • Console:
    • Disable zh translation in graphs on windows due to font issues
    • Fix NPE at startup
    • Graph tweaks
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • apps/routerconsole/java/src/net/i2p/router/web/GraphHelper.java

    r6e4df88 r592361b  
    4646    /**
    4747     *  This must be output in the jsp since <meta> must be in the <head>
    48      *  @since 0.8.6
     48     *  @since 0.8.7
    4949     */
    5050    public String getRefreshMeta() {
     
    8686    }
    8787
    88     /** @since 0.8.6 */
     88    /** @since 0.8.7 */
    8989    public void setPersistent(String foo) { _persistent = true; }
    9090   
    9191    public String getImages() {
    92         if (StatSummarizer.instance().isDisabled())
     92        if (StatSummarizer.isDisabled())
    9393            return "";
    9494        try {
     
    158158
    159159    public String getForm() {
    160         if (StatSummarizer.instance().isDisabled())
     160        if (StatSummarizer.isDisabled())
    161161            return "";
    162162        String prev = System.getProperty("net.i2p.router.web.GraphHelper.nonce");
     
    205205    /**
    206206     *  We have to do this here because processForm() isn't called unless the nonces are good
    207      *  @since 0.8.6
     207     *  @since 0.8.7
    208208     */
    209209    @Override
    210210    public String getAllMessages() {
    211         if (StatSummarizer.instance().isDisabled()) {
     211        if (StatSummarizer.isDisabled()) {
    212212            addFormError("Graphing not supported with this JVM: " +
    213213                         System.getProperty("java.vendor") + ' ' +
  • apps/routerconsole/java/src/net/i2p/router/web/StatSummarizer.java

    r6e4df88 r592361b  
    4949    private final Semaphore _sem;
    5050    private volatile boolean _isRunning = true;
    51     private volatile boolean _isDisabled;
     51    private boolean _isDisabled;
    5252    private Thread _thread;
    5353   
     
    8989    }
    9090   
    91     /** @since 0.8.6 */
    92     boolean isDisabled() {
    93         return _isDisabled;
     91    /** @since 0.8.7 */
     92    static boolean isDisabled() {
     93        return _instance == null || _instance._isDisabled;
    9494    }
    9595
     
    306306            long started = _context.router().getWhenStarted();
    307307            if (started > start && started < end)
    308                 def.vrule(started / 1000, Color.BLACK, null, 4.0f);  // no room for legend
     308                def.vrule(started / 1000, SummaryRenderer.RESTART_BAR_COLOR, null, 4.0f);  // no room for legend
    309309            String sendName = SummaryListener.createName(_context, "bw.sendRate.60000");
    310310            String recvName = SummaryListener.createName(_context, "bw.recvRate.60000");
     
    393393    /**
    394394     *  Delete the old rrd dir if we are no longer persistent
    395      *  @since 0.8.6
     395     *  @since 0.8.7
    396396     */
    397397    private void deleteOldRRDs() {
     
    400400    }
    401401
     402    private static final boolean IS_WIN = System.getProperty("os.name").startsWith("Win");
     403
    402404    /** translate a string */
    403405    private String _(String s) {
    404406        // the RRD font doesn't have zh chars, at least on my system
    405         // Works on 1.5.9
    406         //if ("zh".equals(Messages.getLanguage(_context)))
    407         //    return s;
     407        // Works on 1.5.9 except on windows
     408        if (IS_WIN && "zh".equals(Messages.getLanguage(_context)))
     409            return s;
    408410        return Messages.getString(s, _context);
    409411    }
     
    411413    /**
    412414     *  Make sure any persistent RRDs are closed
    413      *  @since 0.8.6
     415     *  @since 0.8.7
    414416     */
    415417    private class Shutdown implements Runnable {
  • apps/routerconsole/java/src/net/i2p/router/web/SummaryBarRenderer.java

    r6e4df88 r592361b  
    132132           //  .append("</a>\n" +
    133133
    134             if (!StatSummarizer.instance().isDisabled()) {
     134            if (!StatSummarizer.isDisabled()) {
    135135                buf.append("<a href=\"/graphs\" target=\"_top\" title=\"")
    136136               .append(_("Graph router performance"))
  • apps/routerconsole/java/src/net/i2p/router/web/SummaryRenderer.java

    r6e4df88 r592361b  
    3535    private final SummaryListener _listener;
    3636    private final I2PAppContext _context;
     37    static final Color RESTART_BAR_COLOR = new Color(255, 144, 0, 224);
    3738
    3839    public SummaryRenderer(I2PAppContext ctx, SummaryListener lsnr) {
     
    102103                String p;
    103104                // we want the formatting and translation of formatDuration2(), except not zh, and not the &nbsp;
    104                 //if ("zh".equals(Messages.getLanguage(_context)))
    105                 //    p = DataHelper.formatDuration(_listener.getRate().getPeriod());
    106                 //else
     105                if (IS_WIN && "zh".equals(Messages.getLanguage(_context)))
     106                    p = DataHelper.formatDuration(_listener.getRate().getPeriod());
     107                else
    107108                    p = DataHelper.formatDuration2(_listener.getRate().getPeriod()).replace("&nbsp;", " ");
    108109                if (showEvents)
     
    131132            long started = ((RouterContext)_context).router().getWhenStarted();
    132133            if (started > start && started < end)
    133                 def.vrule(started / 1000, Color.BLACK, _("Restart"), 4.0f);
     134                def.vrule(started / 1000, RESTART_BAR_COLOR, _("Restart"), 4.0f);
    134135            def.datasource(plotName, path, plotName, SummaryListener.CF, _listener.getBackendName());
    135136            if (descr.length() > 0)
     
    191192    }
    192193
     194    private static final boolean IS_WIN = System.getProperty("os.name").startsWith("Win");
     195
    193196    /** translate a string */
    194197    private String _(String s) {
    195198        // the RRD font doesn't have zh chars, at least on my system
    196         // Works on 1.5.9
    197         //if ("zh".equals(Messages.getLanguage(_context)))
    198         //  return s;
     199        // Works on 1.5.9 except on windows
     200        if (IS_WIN && "zh".equals(Messages.getLanguage(_context)))
     201            return s;
    199202        return Messages.getString(s, _context);
    200203    }
     
    205208    private String _(String s, String o) {
    206209        // the RRD font doesn't have zh chars, at least on my system
    207         // Works on 1.5.9
    208         //if ("zh".equals(Messages.getLanguage(_context)))
    209         //  return s.replace("{0}", o);
     210        // Works on 1.5.9 except on windows
     211        if (IS_WIN && "zh".equals(Messages.getLanguage(_context)))
     212            return s.replace("{0}", o);
    210213        return Messages.getString(s, o, _context);
    211214    }
  • history.txt

    r6e4df88 r592361b  
     12011-05-23 zzz
     2    * Console:
     3      - Disable zh translation in graphs on windows due to font issues
     4      - Force news refetch after URL change
     5      - Fix NPE at startup
     6      - Graph tweaks
     7
    182011-05-23 sponge
    29    * mbuild.sh fixups
  • installer/resources/themes/console/dark/console.css

    r6e4df88 r592361b  
    470470     background: #000;
    471471
    472      opacity: 0.8;
     472     opacity: 0.9;
    473473}
    474474
  • installer/resources/themes/console/light/console.css

    r6e4df88 r592361b  
    478478     background: #001;
    479479     -moz-box-shadow: inset 0px 0px 1px 1px #99f;
    480      opacity: 0.8;
     480     opacity: 0.9;
    481481}
    482482
  • router/java/src/net/i2p/router/RouterVersion.java

    r6e4df88 r592361b  
    1919    public final static String ID = "Monotone";
    2020    public final static String VERSION = CoreVersion.VERSION;
    21     public final static long BUILD = 3;
     21    public final static long BUILD = 4;
    2222
    2323    /** for example "-test" */
Note: See TracChangeset for help on using the changeset viewer.