java.lang.Object
net.i2p.router.web.HelperBase
- Direct Known Subclasses:
CertHelper, ConfigAdvancedHelper, ConfigBanHelper, ConfigClientsHelper, ConfigFamilyHelper, ConfigKeyringHelper, ConfigLoggingHelper, ConfigNavHelper, ConfigNetHelper, ConfigPeerHelper, ConfigReseedHelper, ConfigStatsHelper, ConfigTunnelsHelper, ConfigUIHelper, ConfigUpdateHelper, ContentHelper, CSSHelper, DebugOverviewHelper, FileDumpHelper, HealthHelper, HelpSectionHelper, HomeHelper, InfoHelper, JobQueueHelper, LogsHelper, NewsFeedHelper, PeerHelper, ProfilesHelper, ReseedGenerator, ReseedHandler, SAMDebugHelper, SearchHelper, SidebarHelper, StatHelper, StreamHelper, TransitSummaryHelper, TuningHelper, TunnelBandwidthHelper, TunnelHelper, TunnelParticipatingFastestHelper, TunnelParticipatingHelper, TunnelPeerCountHelper, WizardHelper
Base helper class for JSP helper beans. Provides common functionality for router context access, translation services, and UI helper methods.
Field Summary
FieldsModifier and TypeFieldDescriptionprotected RouterContextThe router context.protected LogThe log instance.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
ConstructorsConstructorDescriptionConstructor for JSP helper beans; a subclass calls the constructor taking its context and translator.Method Summary
Modifier 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).voidsetContextId(String contextId) Configure this bean to query a particular router context.voidstoreWriter(Writer out) Store the writer for output.
Field Details
_context
The router context._out
The writer for output._log
The log instance.PROP_ADVANCED
Property key for advanced mode.- See Also:
CHECKED
Checked attribute for HTML checkboxes.- See Also:
SELECTED
Selected attribute for HTML select options.- See Also:
Constructor Details
HelperBase
public HelperBase()Constructor for JSP helper beans; a subclass calls the constructor taking its context and translator.
Method Details
setContextId
Configure this bean to query a particular router context.- Parameters:
contextId- beginning few characters of the routerHash, or null to pick the first one we come across.
isAdvanced
public boolean isAdvanced()Check if advanced mode is enabled.- Returns:
- true if advanced mode is enabled
storeWriter
Store the writer for output. Renamed from setWriter, we really don't want setFoo(non-String) to preventjsp.error.beans.property.conversion500 error for ?writer=foo.- Parameters:
out- the writer to store
getChecked
_t
_t
Translate a string with a parameter. This is a lot more expensive than _t(s), so use sparingly.- Parameters:
s- string to be translated containing {0} The {0} will be replaced by the parameter. Single quotes must be doubled, i.e. ' -> '' in the string.o- parameter, not translated. To translate parameter also, use _t("foo {0} bar", _t("baz")) Do not double the single quotes in the parameter. Use autoboxing to call with ints, longs, floats, etc.- Returns:
- the translated string
_t
ngettext
_x