formatSize cleanups

This commit is contained in:
zzz
2010-06-29 02:32:08 +00:00
parent df7b3dd861
commit 66421858e7
3 changed files with 8 additions and 7 deletions

View File

@ -142,7 +142,7 @@ public class PluginUpdateHandler extends UpdateHandler {
buf.append(_pct.format(pct)); buf.append(_pct.format(pct));
} }
buf.append(": "); buf.append(": ");
buf.append(_("{0}B transferred", DataHelper.formatSize(currentWrite + alreadyTransferred))); buf.append(_("{0}B transferred", DataHelper.formatSize2(currentWrite + alreadyTransferred)));
updateStatus(buf.toString()); updateStatus(buf.toString());
} }

View File

@ -105,7 +105,7 @@ public class TunnelRenderer {
out.write("<td class=\"cells\" align=\"center\">" + DataHelper.formatDuration(timeLeft) + "</td>"); out.write("<td class=\"cells\" align=\"center\">" + DataHelper.formatDuration(timeLeft) + "</td>");
else else
out.write("<td class=\"cells\" align=\"center\">(" + _("grace period") + ")</td>"); out.write("<td class=\"cells\" align=\"center\">(" + _("grace period") + ")</td>");
out.write("<td class=\"cells\" align=\"center\">" + cfg.getProcessedMessagesCount() + "KB</td>"); out.write("<td class=\"cells\" align=\"center\">" + cfg.getProcessedMessagesCount() + " KB</td>");
int lifetime = (int) ((_context.clock().now() - cfg.getCreation()) / 1000); int lifetime = (int) ((_context.clock().now() - cfg.getCreation()) / 1000);
if (lifetime <= 0) if (lifetime <= 0)
lifetime = 1; lifetime = 1;
@ -124,7 +124,7 @@ public class TunnelRenderer {
} }
out.write("</table>\n"); out.write("</table>\n");
out.write("<div class=\"statusnotes\"><b>" + _("Inactive participating tunnels") + ": " + inactive + "</b></div>\n"); out.write("<div class=\"statusnotes\"><b>" + _("Inactive participating tunnels") + ": " + inactive + "</b></div>\n");
out.write("<div class=\"statusnotes\"><b>" + _("Lifetime bandwidth usage") + ": " + DataHelper.formatSize(processed*1024) + "B</b></div>\n"); out.write("<div class=\"statusnotes\"><b>" + _("Lifetime bandwidth usage") + ": " + DataHelper.formatSize2(processed*1024) + "B</b></div>\n");
renderPeers(out); renderPeers(out);
} }
@ -176,7 +176,7 @@ public class TunnelRenderer {
else else
out.write("<tr> <td class=\"cells\" align=\"center\"><img src=\"/themes/console/images/outbound.png\" alt=\"Outbound\" title=\"Outbound\"></td>"); out.write("<tr> <td class=\"cells\" align=\"center\"><img src=\"/themes/console/images/outbound.png\" alt=\"Outbound\" title=\"Outbound\"></td>");
out.write(" <td class=\"cells\" align=\"center\">" + DataHelper.formatDuration(timeLeft) + "</td>\n"); out.write(" <td class=\"cells\" align=\"center\">" + DataHelper.formatDuration(timeLeft) + "</td>\n");
out.write(" <td class=\"cells\" align=\"center\">" + info.getProcessedMessagesCount() + "KB</td>\n"); out.write(" <td class=\"cells\" align=\"center\">" + info.getProcessedMessagesCount() + " KB</td>\n");
for (int j = 0; j < info.getLength(); j++) { for (int j = 0; j < info.getLength(); j++) {
Hash peer = info.getPeer(j); Hash peer = info.getPeer(j);
TunnelId id = (info.isInbound() ? info.getReceiveTunnelId(j) : info.getSendTunnelId(j)); TunnelId id = (info.isInbound() ? info.getReceiveTunnelId(j) : info.getSendTunnelId(j));
@ -215,8 +215,9 @@ public class TunnelRenderer {
} }
if (live <= 0) if (live <= 0)
out.write("<div class=\"statusnotes\"><center><b>" + _("No tunnels; waiting for the grace period to end.") + "</center></b></div>\n"); out.write("<div class=\"statusnotes\"><center><b>" + _("No tunnels; waiting for the grace period to end.") + "</center></b></div>\n");
out.write("<div class=\"statusnotes\"><center><b>" + _("Lifetime bandwidth usage") + ": " + DataHelper.formatSize(processedIn*1024) + "B " + _("in") + ", " + out.write("<div class=\"statusnotes\"><center><b>" + _("Lifetime bandwidth usage") + ": " +
DataHelper.formatSize(processedOut*1024) + "B " + _("out") + "</b></center></div>"); DataHelper.formatSize2(processedIn*1024) + "B " + _("in") + ", " +
DataHelper.formatSize2(processedOut*1024) + "B " + _("out") + "</b></center></div>");
} }
private void renderPeers(Writer out) throws IOException { private void renderPeers(Writer out) throws IOException {

View File

@ -176,7 +176,7 @@ public class UpdateHandler {
buf.append(_pct.format(pct)); buf.append(_pct.format(pct));
} }
buf.append(":<br>\n"); buf.append(":<br>\n");
buf.append(_("{0}B transferred", DataHelper.formatSize(currentWrite + alreadyTransferred))); buf.append(_("{0}B transferred", DataHelper.formatSize2(currentWrite + alreadyTransferred)));
updateStatus(buf.toString()); updateStatus(buf.toString());
} }
public void transferComplete(long alreadyTransferred, long bytesTransferred, long bytesRemaining, String url, String outputFile, boolean notModified) { public void transferComplete(long alreadyTransferred, long bytesTransferred, long bytesRemaining, String url, String outputFile, boolean notModified) {