forked from I2P_Developers/i2p.i2p
Split HTML rendering of summary bar into separate methods
This solidifies the summary bar design pattern of modular sections separated by <hr>s which in future could be reordered or hidden without affecting the theme.
This commit is contained in:
@ -39,13 +39,10 @@ public class SummaryBarRenderer {
|
||||
.append(_("I2P Router Console"))
|
||||
.append("\" title=\"")
|
||||
.append(_("I2P Router Console"))
|
||||
.append("\"></a></div><hr>")
|
||||
|
||||
.append("<h3><a href=\"/help\" target=\"_top\" title=\"")
|
||||
.append(_("I2P Router Help & FAQ"))
|
||||
.append("\">")
|
||||
.append(_("Help & FAQ"))
|
||||
.append("</a></h3><hr>");
|
||||
.append("\"></a></div>\n")
|
||||
.append("<hr>\n")
|
||||
.append(renderHelpAndFAQHTML())
|
||||
.append("<hr>\n");
|
||||
|
||||
File lpath = new File(_context.getBaseDir(), "docs/toolbar.html");
|
||||
// you better have target="_top" for the links in there...
|
||||
@ -55,6 +52,58 @@ public class SummaryBarRenderer {
|
||||
linkhelper.setMaxLines("100");
|
||||
buf.append(linkhelper.getContent());
|
||||
} else {
|
||||
buf.append(renderI2PServicesHTML())
|
||||
.append("<hr>\n")
|
||||
.append(renderI2PInternalsHTML());
|
||||
|
||||
out.write(buf.toString());
|
||||
buf.setLength(0);
|
||||
}
|
||||
|
||||
buf.append("<hr>\n")
|
||||
.append(renderGeneralHTML())
|
||||
.append("<hr>\n")
|
||||
.append(renderNetworkReachabilityHTML())
|
||||
.append("<hr>\n")
|
||||
.append(_helper.getUpdateStatus())
|
||||
.append(_helper.getRestartStatus())
|
||||
.append("<hr>\n")
|
||||
.append(renderPeersHTML())
|
||||
.append("<hr>\n");
|
||||
|
||||
out.write(buf.toString());
|
||||
buf.setLength(0);
|
||||
|
||||
buf.append(_helper.getFirewallAndReseedStatus());
|
||||
|
||||
buf.append(renderBandwidthHTML())
|
||||
.append("<hr>\n")
|
||||
.append(renderTunnelsHTML())
|
||||
.append("<hr>\n")
|
||||
.append(renderCongestionHTML())
|
||||
.append("<hr>\n")
|
||||
.append(renderTunnelStatusHTML())
|
||||
.append("<hr>\n")
|
||||
.append(_helper.getDestinations())
|
||||
.append("<hr>\n");
|
||||
|
||||
|
||||
|
||||
out.write(buf.toString());
|
||||
}
|
||||
|
||||
public String renderHelpAndFAQHTML() {
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<h3><a href=\"/help\" target=\"_top\" title=\"")
|
||||
.append(_("I2P Router Help & FAQ"))
|
||||
.append("\">")
|
||||
.append(_("Help & FAQ"))
|
||||
.append("</a></h3>");
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
public String renderI2PServicesHTML() {
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<h3><a href=\"/configclients\" target=\"_top\" title=\"")
|
||||
.append(_("Configure startup of clients and webapps (services); manually start dormant services"))
|
||||
.append("\">")
|
||||
@ -83,9 +132,13 @@ public class SummaryBarRenderer {
|
||||
|
||||
.append(NavHelper.getClientAppLinks(_context))
|
||||
|
||||
.append("</td></tr></table>\n" +
|
||||
.append("</td></tr></table>\n");
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
"<hr><h3><a href=\"/config\" target=\"_top\" title=\"")
|
||||
public String renderI2PInternalsHTML() {
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<h3><a href=\"/config\" target=\"_top\" title=\"")
|
||||
.append(_("Configure I2P Router"))
|
||||
.append("\">")
|
||||
.append(_("I2P Internals"))
|
||||
@ -159,14 +212,12 @@ public class SummaryBarRenderer {
|
||||
if (javadoc.exists())
|
||||
buf.append("<a href=\"/javadoc/index.html\" target=\"_blank\">Javadoc</a>\n");
|
||||
buf.append("</td></tr></table>\n");
|
||||
|
||||
out.write(buf.toString());
|
||||
buf.setLength(0);
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
buf.append("<hr><h3><a href=\"/help\" target=\"_top\" title=\"")
|
||||
public String renderGeneralHTML() {
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<h3><a href=\"/help\" target=\"_top\" title=\"")
|
||||
.append(_("I2P Router Help"))
|
||||
.append("\">")
|
||||
.append(_("General"))
|
||||
@ -202,24 +253,25 @@ public class SummaryBarRenderer {
|
||||
.append(":</b></td>" +
|
||||
"<td align=\"right\">")
|
||||
.append(_helper.getUptime())
|
||||
.append("</td></tr></table>\n" +
|
||||
.append("</td></tr></table>\n");
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
"<hr><h4><a href=\"/confignet#help\" target=\"_top\" title=\"")
|
||||
public String renderNetworkReachabilityHTML() {
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<h4><a href=\"/confignet#help\" target=\"_top\" title=\"")
|
||||
.append(_("Help with configuring your firewall and router for optimal I2P performance"))
|
||||
.append("\">")
|
||||
.append(_("Network"))
|
||||
.append(": ")
|
||||
.append(_helper.getReachability())
|
||||
.append("</a></h4><hr>\n")
|
||||
.append("</a></h4>\n");
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
|
||||
.append(_helper.getUpdateStatus())
|
||||
|
||||
|
||||
.append(_helper.getRestartStatus())
|
||||
|
||||
|
||||
.append("<hr><h3><a href=\"/peers\" target=\"_top\" title=\"")
|
||||
public String renderPeersHTML() {
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<h3><a href=\"/peers\" target=\"_top\" title=\"")
|
||||
.append(_("Show all current peer connections"))
|
||||
.append("\">")
|
||||
.append(_("Peers"))
|
||||
@ -260,14 +312,12 @@ public class SummaryBarRenderer {
|
||||
.append(_helper.getAllPeers())
|
||||
.append("</td></tr>\n" +
|
||||
|
||||
"</table><hr>\n");
|
||||
|
||||
|
||||
out.write(buf.toString());
|
||||
buf.setLength(0);
|
||||
|
||||
buf.append(_helper.getFirewallAndReseedStatus());
|
||||
"</table>\n");
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
public String renderBandwidthHTML() {
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<h3><a href=\"/config\" title=\"")
|
||||
.append(_("Configure router bandwidth allocation"))
|
||||
.append("\" target=\"_top\">")
|
||||
@ -303,9 +353,15 @@ public class SummaryBarRenderer {
|
||||
.append(_helper.getInboundTransferred())
|
||||
.append(SummaryHelper.THINSP)
|
||||
.append(_helper.getOutboundTransferred())
|
||||
.append("</td></tr></table>\n" +
|
||||
.append("</td></tr>\n" +
|
||||
|
||||
"<hr><h3><a href=\"/tunnels\" target=\"_top\" title=\"")
|
||||
"</table>\n");
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
public String renderTunnelsHTML() {
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<h3><a href=\"/tunnels\" target=\"_top\" title=\"")
|
||||
.append(_("View existing tunnels and tunnel build status"))
|
||||
.append("\">")
|
||||
.append(_("Tunnels"))
|
||||
@ -336,7 +392,13 @@ public class SummaryBarRenderer {
|
||||
.append(_helper.getShareRatio())
|
||||
.append("</td></tr>\n" +
|
||||
|
||||
"</table><hr><h3><a href=\"/jobs\" target=\"_top\" title=\"")
|
||||
"</table>\n");
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
public String renderCongestionHTML() {
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<h3><a href=\"/jobs\" target=\"_top\" title=\"")
|
||||
.append(_("What's in the router's job queue?"))
|
||||
.append("\">")
|
||||
.append(_("Congestion"))
|
||||
@ -369,16 +431,16 @@ public class SummaryBarRenderer {
|
||||
.append(_helper.getInboundBacklog())
|
||||
.append("</td></tr>\n" +
|
||||
|
||||
"</table><hr><h4>")
|
||||
"</table>\n");
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
public String renderTunnelStatusHTML() {
|
||||
StringBuilder buf = new StringBuilder(50);
|
||||
buf.append("<h4>")
|
||||
.append(_(_helper.getTunnelStatus()))
|
||||
.append("</h4><hr>\n")
|
||||
|
||||
.append(_helper.getDestinations())
|
||||
.append("<hr>\n");
|
||||
|
||||
|
||||
|
||||
out.write(buf.toString());
|
||||
.append("</h4>\n");
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
/** translate a string */
|
||||
|
Reference in New Issue
Block a user