public class CountingUpThenAutoRefreshingLabel
extends org.apache.wicket.markup.html.panel.Panel
Usage:
<!-- In HTML file --> <span wicket:id="numberOfUsers"></span> // In Java file CountingUpThenAutoRefreshingLabel label = new CountingUpThenAutoRefreshingLabel("numberOfUsers"); label.setDefaultModel(new PropertyModel(dataSource, "userCount")); // model returns Integer add(label);
The first phase of the component lasts two minutes, and the value counts up from zero to the target value. It "tends" towards the target value, i.e. moves fast at the beginning, then slows down as it approaches its target value.
The second phase, triggered after the first two minutes, simply refreshes the value periodically from the server. Initially this is refreshed every two seconds, but this refresh interval is gradually slowed down, so that if N users leave their browsers open for a long time, we will not get N requests every two seconds forever.
Various numerical values above may be altered with:
label.setCountingUpDurationSeconds(120); label.setCountingUpRefreshIntervalSeconds(0.1); label.setTendencyThreshold(0.001); label.setAutoRefreshingInitialIntervalSeconds(2.0); label.setAutoRefreshingIntervalMultiplier(1.2);
Constructor and Description |
---|
CountingUpThenAutoRefreshingLabel(String wicketId) |
Modifier and Type | Method and Description |
---|---|
String |
getJs()
INTERNAL METHOD -- DO NOT USE
|
String |
getLabelValue()
INTERNAL METHOD -- DO NOT USE
|
void |
setAutoRefreshingInitialIntervalSeconds(double x)
During the auto-refresh phase, what should the duration be between server-refreshes, initially?
|
void |
setAutoRefreshingIntervalMultiplier(double x)
During the auto-refresh phase, by what multiplier should the auto-refresh interval durations increase? For example 2.0
means they double; so for example the first duration might be 10s, the next 20s, the next 40s, etc.
|
void |
setCountingUpDurationSeconds(double x)
How long should the initial phase of counting up be? Measured in seconds
|
void |
setCountingUpRefreshIntervalSeconds(double x)
What should the duration between the updates during the counting up phase be? Measured in seconds.
|
void |
setTendencyThreshold(double x)
How close should the counting up phase get to the target value? A value of 0.01 means it gets within 1% of the target value
before switching to the second auto-refresh phase.
|
getWebPage, getWebRequest, getWebResponse, getWebSession
add, addOrReplace, autoAdd, contains, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, internalAdd, internalInitialize, iterator, iterator, onComponentTagBody, remove, remove, removeAll, renderAssociatedMarkup, replace, setDefaultModel, size, swap, toString, toString, visitChildren, visitChildren, visitChildren, visitChildren
add, afterRender, beforeRender, canCallListenerInterface, configure, continueToOriginalDestination, debug, detach, detachModels, determineVisibility, error, fatal, findParent, findParentWithAssociatedMarkup, getAjaxRegionMarkupId, getApplication, getBehaviorById, getBehaviorId, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getDefaultModel, getDefaultModelObject, getDefaultModelObjectAsString, getDefaultModelObjectAsString, getEscapeModelStrings, getFeedbackMessages, getId, getInnermostModel, getLocale, getLocalizer, getMarkup, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdFromMarkup, getMarkupIdImpl, getMetaData, getModelComparator, getOutputMarkupId, getOutputMarkupPlaceholderTag, getPage, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getResponse, getSession, getSizeInBytes, getString, getString, getString, getStyle, getVariation, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, internalPrepareForRender, internalRenderComponent, isActionAuthorized, isAuto, isEnableAllowed, isEnabled, isEnabledInHierarchy, isRenderAllowed, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, markRendering, modelChanged, modelChanging, onEvent, prepareForRender, redirectToInterceptPage, remove, remove, render, rendered, renderHead, renderHead, renderHead, replaceWith, sameInnermostModel, sameInnermostModel, send, setDefaultModelObject, setEnabled, setEscapeModelStrings, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, visitParents, warn
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public CountingUpThenAutoRefreshingLabel(String wicketId)
public void setCountingUpDurationSeconds(double x)
public void setCountingUpRefreshIntervalSeconds(double x)
public void setTendencyThreshold(double x)
public void setAutoRefreshingInitialIntervalSeconds(double x)
public void setAutoRefreshingIntervalMultiplier(double x)
public String getLabelValue()
public String getJs()