Changeset 2deed134


Ignore:
Timestamp:
Mar 11, 2018 3:14:08 PM (2 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
96d7c73
Parents:
eb321445
Message:

/tunnels: Right-justify zero-hop IB
minor cleanups

File:
1 edited

Legend:

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

    reb321445 r2deed134  
    219219        for (int i = 0; i < tunnels.size(); i++) {
    220220            TunnelInfo info = tunnels.get(i);
    221             if (info.getLength() > maxLength)
    222                 maxLength = info.getLength();
     221            int length = info.getLength();
     222            if (length > maxLength)
     223                maxLength = length;
    223224        }
    224225        out.write("<table class=\"tunneldisplay tunnels_client\"><tr><th title=\"" + _t("Inbound or outbound?") + ("\">") + _t("In/Out")
     
    241242                continue; // don't display tunnels in their grace period
    242243            live++;
    243             if (info.isInbound())
     244            boolean isInbound = info.isInbound();
     245            if (isInbound)
    244246                out.write("<tr><td class=\"cells\" align=\"center\"><img src=\"/themes/console/images/inbound.png\" alt=\"Inbound\" title=\"" +
    245247                          _t("Inbound") + "\"></td>");
     
    250252            int count = info.getProcessedMessagesCount() * 1024 / 1000;
    251253            out.write("<td class=\"cells\" align=\"center\">" + count + " KB</td>\n");
    252             for (int j = 0; j < info.getLength(); j++) {
     254            int length = info.getLength();
     255            for (int j = 0; j < length; j++) {
    253256                Hash peer = info.getPeer(j);
    254                 TunnelId id = (info.isInbound() ? info.getReceiveTunnelId(j) : info.getSendTunnelId(j));
     257                TunnelId id = (isInbound ? info.getReceiveTunnelId(j) : info.getSendTunnelId(j));
    255258                if (_context.routerHash().equals(peer)) {
     259                    if (length < maxLength && length == 1 && isInbound) {
     260                        // pad before inbound zero hop
     261                        for (int k = 1; k < maxLength; k++) {
     262                            out.write("<td class=\"cells\" align=\"center\">&nbsp;</td>");
     263                        }
     264                    }
    256265                    // Add empty content placeholders to force alignment.
    257266                    out.write(" <td class=\"cells\" align=\"center\"><span class=\"tunnel_peer tunnel_local\" title=\"" +
     
    266275                              cap + "</b></span></td>");
    267276                }
    268                 if (info.getLength() < maxLength && (info.getLength() == 1 || j == info.getLength() - 2)) {
    269                     for (int k = info.getLength(); k < maxLength; k++)
     277                if (length < maxLength && ((length == 1 && !isInbound) || j == length - 2)) {
     278                    // pad out outbound zero hop; non-zero-hop pads in middle
     279                    for (int k = length; k < maxLength; k++) {
    270280                        out.write("<td class=\"cells\" align=\"center\">&nbsp;</td>");
     281                    }
    271282                }
    272283            }
Note: See TracChangeset for help on using the changeset viewer.