Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classTranslated sort Inner class, can't be Serializable.Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanTrue if the stat being shown could be graphed.private StringGraph file name for the stat being shown.private StringGroup the stat being shown belongs to.private booleanTrue if the current stat is the first in the group.private booleanTrue if the stat being shown is currently graphed.private StringDescription shown for the stat being shown.private StringName of the stat being shown.Names of the stats that have graphs.private LogLogger for this class.List of names of stats which are remaining, ordered by nested groups.Fields inherited from class HelperBase
_context, _out, CHECKED, PROP_ADVANCED, SELECTEDModifier and TypeFieldDescriptionprotected RouterContextThe router context.protected WriterThe writer for output.static final StringChecked attribute for HTML checkboxes.static final StringProperty key for advanced mode.static final StringSelected attribute for HTML select options.Constructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionprivate static Stringabbreviate(String label) Shorten a stat name to what fits beside its checkbox.booleanCheck whether the current stat can be graphed.Get the current graph name.What group is the current stat in.booleanCheck whether the current stat is graphed.Get the description of the current stat.Get the display label for the current stat.Get the current stat name.booleanCheck whether the full stats are enabled.booleanIs the current stat the first in the group?booleanMove the cursor to the next known stat, returning true if a valid stat is available.voidsetContextId(String contextId) Configure this bean to query a particular router context.(package private) static StringThe short name shown beside a stat's checkbox on the configstats page.Methods inherited from class HelperBase
_t, _t, _t, _x, getChecked, isAdvanced, ngettext, storeWriterModifier and TypeMethodDescriptionTranslate a string.Translate a string with a parameter.Translate a string with two parameters.static StringMark a string for extraction by xgettext and translation.protected StringgetChecked(String prop) Get the checked attribute for a boolean property.booleanCheck if advanced mode is enabled.Translate a string with plural forms (ngettext).voidstoreWriter(Writer out) Store the writer for output.
Field Details
_log
Logger for this class._graphs
_stats
_currentStatName
Name of the stat being shown._currentGraphName
Graph file name for the stat being shown._currentStatDescription
Description shown for the stat being shown._currentGroup
Group the stat being shown belongs to._currentIsFirstInGroup
private boolean _currentIsFirstInGroupTrue if the current stat is the first in the group._currentIsGraphed
private boolean _currentIsGraphedTrue if the stat being shown is currently graphed._currentCanBeGraphed
private boolean _currentCanBeGraphedTrue if the stat being shown could be graphed.
Constructor Details
ConfigStatsHelper
public ConfigStatsHelper()Construct a new ConfigStatsHelper.
Method Details
setContextId
Configure this bean to query a particular router context.- Overrides:
setContextIdin classHelperBase- Parameters:
contextId- beginning few characters of the routerHash, or null to pick the first one we come across.
hasMoreStats
public boolean hasMoreStats()Move the cursor to the next known stat, returning true if a valid stat is available.- Returns:
- true if a valid stat is available, otherwise false
groupRequired
public boolean groupRequired()Is the current stat the first in the group?- Returns:
- true if the current stat is the first in the group
getCurrentGroupName
getCurrentStatName
Get the current stat name.- Returns:
- the stat name as entered, or null
getCurrentStatLabel
Get the display label for the current stat.- Returns:
- the label shown beside the checkbox
statLabel
The short name shown beside a stat's checkbox on the configstats page.An ordinary stat name is a dotted subsystem path such as
tunnel.buildTimeout, and the subsystem is dropped because the section header already states it. A pool's rates are named for the tunnel instead:[harry.i2p] InBps. The first dot there sits inside the name, and cutting at it turned four different services into four identical "i2p] InBps" labels. A prefix carrying a bracket or a space is therefore a name rather than a subsystem, and is shown whole.- Parameters:
statName- the stat name, or null- Returns:
- the display label, never null; null yields the empty string
abbreviate
Shorten a stat name to what fits beside its checkbox.The rules are ordered rather than alphabetical:
receiverewrites toRX, which the laterRXBpsrule expands again toReceiveBps, so the chain may not be reordered. Every rule names a stat actually seen on the page. The dotted rules only ever see a name whose subsystem prefix was dropped, a pool name with a dot in it having been returned whole bystatLabel(String).- Parameters:
label- a stat name, with any subsystem prefix already removed- Returns:
- the abbreviated label, never null
getCurrentGraphName
Get the current graph name.- Returns:
- the graph name as entered, or null
getCurrentStatDescription
Get the description of the current stat.- Returns:
- the current stat description
getCurrentIsGraphed
public boolean getCurrentIsGraphed()Check whether the current stat is graphed.- Returns:
- true if the current stat is graphed
getCurrentCanBeGraphed
public boolean getCurrentCanBeGraphed()Check whether the current stat can be graphed.- Returns:
- true if the current stat can be graphed
getIsFull
public boolean getIsFull()Check whether the full stats are enabled.- Returns:
- true if full stats are enabled