java.lang.Object
net.i2p.router.web.HelperBase
net.i2p.router.web.helpers.WizardHelper
The new user wizard.
This bean has SESSION scope so the results may be retrieved. All necessary methods are synchronized.
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final floatFraction of the measured bandwidth applied to the limiter settings.static final StringSession property recording that the welcome wizard already ran.Fields inherited from class HelperBase
_context, _log, _out, CHECKED, PROP_ADVANCED, SELECTEDModifier 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
ConstructorsConstructorDescriptionA session-scoped bean with no test run yet: the listener, the runner and the cached status are all filled in as the bandwidth test runs.Method Summary
All MethodsModifier and TypeMethodDescription(package private) booleanCancel the test.voidcomplete()Record that the setup wizard has been finished, so it is not shown again.Return the NDT test completion status.Return detailed NDT test status information.longReturn the measured download bandwidth.To populate form with.Copied from ConfigNetHelper.To populate form with.Copied from ConfigNetHelper.Return the NDT test server location.intAdapted from ConfigNetHelper.Copied from ConfigNetHelper.Return the current NDT bandwidth test status.longReturn the measured upload bandwidth.booleanWhether the NDT bandwidth test listener reports the test as finished.booleanWhether the NDT bandwidth test is in progress.booleanWhether the NDT bandwidth test completed and moved any bandwidth in both directions.voidsetContextId(String contextId) Overriden to only do this once.(package private) booleanstartNDT()Start the test.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
PROP_COMPLETE
Session property recording that the welcome wizard already ran.- See Also:
BW_SCALE
public static final float BW_SCALEFraction of the measured bandwidth applied to the limiter settings.- See Also:
Constructor Details
WizardHelper
public WizardHelper()A session-scoped bean with no test run yet: the listener, the runner and the cached status are all filled in as the bandwidth test runs.
Method Details
setContextId
Overriden to only do this once.- Overrides:
setContextIdin classHelperBase- Parameters:
contextId- beginning few characters of the routerHash, or null to pick the first one we come across.
complete
public void complete()Record that the setup wizard has been finished, so it is not shown again.isNDTComplete
public boolean isNDTComplete()Whether the NDT bandwidth test listener reports the test as finished.- Returns:
- whether n d t complete
isNDTRunning
public boolean isNDTRunning()Whether the NDT bandwidth test is in progress.- Returns:
- whether n d t running
isNDTSuccessful
public boolean isNDTSuccessful()Whether the NDT bandwidth test completed and moved any bandwidth in both directions.- Returns:
- whether n d t successful
getTestStatus
Return the current NDT bandwidth test status.- Returns:
- HTML-escaped status string or ""
getCompletionStatus
Return the NDT test completion status.- Returns:
- HTML-escaped status string or ""
getDetailStatus
Return detailed NDT test status information.- Returns:
- HTML-escaped status string or ""
getUpBandwidth
public long getUpBandwidth()Return the measured upload bandwidth.- Returns:
- bytes per second or 0
getDownBandwidth
public long getDownBandwidth()Return the measured download bandwidth.- Returns:
- bytes per second or 0
getServerLocation
Return the NDT test server location.- Returns:
- HTML-escaped location or ""
getInboundBurstRate
To populate form with. Uses the test result if available, else the current setting Adapted from ConfigNetHelper.- Returns:
- the inbound bandwidth limit in decimal KB/sec, rounded to an integer
getOutboundBurstRate
To populate form with. Uses the test result if available, else the current setting Adapted from ConfigNetHelper.- Returns:
- the outbound bandwidth limit in decimal KB/sec, rounded to an integer
getInboundBurstRateBits
Copied from ConfigNetHelper.- Returns:
- the inbound burst rate in bits per second and the per-month maximum
getOutboundBurstRateBits
Copied from ConfigNetHelper.- Returns:
- the outbound burst rate in bits per second and the per-month maximum
startNDT
boolean startNDT()Start the test. Called from the Handler.- Returns:
- whether the test was started; false if one is already running
cancelNDT
boolean cancelNDT()Cancel the test. Called from the Handler.- Returns:
- whether a running test was cancelled