org.apache.wicket.ajax
Class AbstractAjaxTimerBehavior
java.lang.Object
org.apache.wicket.behavior.AbstractBehavior
org.apache.wicket.behavior.AbstractHeaderContributor
org.apache.wicket.behavior.AbstractAjaxBehavior
org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
org.apache.wicket.ajax.AbstractAjaxTimerBehavior
- All Implemented Interfaces:
- java.io.Serializable, IBehavior, IBehaviorListener, IClusterable, IRequestListener, IHeaderContributor
- Direct Known Subclasses:
- AjaxSelfUpdatingTimerBehavior
public abstract class AbstractAjaxTimerBehavior
- extends AbstractDefaultAjaxBehavior
A behavior that generates an AJAX update callback at a regular interval.
- Since:
- 1.2
- Author:
- Igor Vaynberg (ivaynberg)
- See Also:
- Serialized Form
Methods inherited from class org.apache.wicket.behavior.AbstractAjaxBehavior |
bind, getCallbackUrl, getComponent, getImplementationId, getStatelessHint, onComponentRendered, onComponentTag, onComponentTag, onRendered, onRenderHeadContribution, onRenderHeadInitContribution |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractAjaxTimerBehavior
public AbstractAjaxTimerBehavior(Duration updateInterval)
- Construct.
- Parameters:
updateInterval
- Duration between AJAX callbacks
stop
public final void stop()
- Stops the timer
setUpdateInterval
protected final void setUpdateInterval(Duration updateInterval)
- Sets the update interval duration. This method should only be called within the
onTimer(AjaxRequestTarget)
method.
- Parameters:
updateInterval
-
getUpdateInterval
public final Duration getUpdateInterval()
- Returns the update interval
- Returns:
- The update interval
renderHead
public void renderHead(IHeaderResponse response)
- Description copied from interface:
IHeaderContributor
- Render to the web response whatever the component wants to contribute to the head section.
TODO: Post 1.3, add component parameter, so that the behaviors dont' have to track component
instances
- Specified by:
renderHead
in interface IHeaderContributor
- Overrides:
renderHead
in class AbstractDefaultAjaxBehavior
- Parameters:
response
- Response object- See Also:
AbstractHeaderContributor.renderHead(org.apache.wicket.markup.html.IHeaderResponse)
getJsTimeoutCall
protected final java.lang.String getJsTimeoutCall(Duration updateInterval)
- Parameters:
updateInterval
- Duration between AJAX callbacks
- Returns:
- JS script
getCallbackScript
protected java.lang.CharSequence getCallbackScript()
- Overrides:
getCallbackScript
in class AbstractDefaultAjaxBehavior
- Returns:
- javascript that will generate an ajax GET request to this behavior
getPreconditionScript
protected java.lang.CharSequence getPreconditionScript()
- Overrides:
getPreconditionScript
in class AbstractDefaultAjaxBehavior
- Returns:
- an optional javascript expression that determines whether the request will actually
execute (in form of return XXX;);
- See Also:
AbstractDefaultAjaxBehavior.getPreconditionScript()
onlyTargetActivePage
protected boolean onlyTargetActivePage()
respond
protected final void respond(AjaxRequestTarget target)
- Specified by:
respond
in class AbstractDefaultAjaxBehavior
- Parameters:
target
- The AJAX target- See Also:
AbstractDefaultAjaxBehavior.respond(org.apache.wicket.ajax.AjaxRequestTarget)
onTimer
protected abstract void onTimer(AjaxRequestTarget target)
- Listener method for the AJAX timer event.
- Parameters:
target
- The request target
isStopped
public final boolean isStopped()
- Returns:
true
if has been stopped via stop()
Copyright © 2004-2010 Apache Software Foundation. All Rights Reserved.