Implementation of customisable summary bar via routerconsole.summaryBar property

The initial attempt using mapping of strings to methods is shorter and neater,
but also doesn't work so is commented out.
This commit is contained in:
str4d
2012-06-05 07:36:24 +00:00
parent 5699b4515b
commit 531c6c0f4c
3 changed files with 69 additions and 49 deletions

View File

@ -36,7 +36,7 @@ public class SummaryHelper extends HelperBase {
//static final String THINSP = " / ";
static final String THINSP = " / ";
private static final char S = ',';
static final String PROP_SUMMARYBAR = "routerconsole.summarybar";
static final String PROP_SUMMARYBAR = "routerconsole.summaryBar";
static final String PRESET_FULL =
"HelpAndFAQ" + S +
@ -739,6 +739,18 @@ public class SummaryHelper extends HelperBase {
return buf.toString();
}
public String[] getSummaryBarSections() {
String config = _context.getProperty(PROP_SUMMARYBAR, PRESET_FULL);
return config.split("" + S);
}
public void saveSummaryBarSections(String[] sections) {
StringBuilder buf = new StringBuilder(512);
for(int i = 0; i < sections.length; i++)
buf.append(sections[i]).append(S);
_context.router().saveConfig(PROP_SUMMARYBAR, buf.toString());
}
/** output the summary bar to _out */
public void renderSummaryBar() throws IOException {
SummaryBarRenderer renderer = new SummaryBarRenderer(_context, this);