public abstract class AbstractAjaxTimerBehavior extends AbstractDefaultAjaxBehavior
onTimer(AjaxRequestTarget)
,
restart(IPartialPageRequestHandler)
,
stop(IPartialPageRequestHandler)
,
Serialized FormINDICATOR
Constructor and Description |
---|
AbstractAjaxTimerBehavior(Duration updateInterval)
Construct.
|
Modifier and Type | Method and Description |
---|---|
protected String |
getTimerId()
Create an identifier for the JavaScript timer.
|
Duration |
getUpdateInterval()
Returns the update interval
|
boolean |
isStopped() |
void |
onRemove(Component component)
Called to notify that the component is being removed from its parent
|
protected abstract void |
onTimer(AjaxRequestTarget target)
Listener method for the AJAX timer event.
|
static AbstractAjaxTimerBehavior |
onTimer(Duration interval,
org.danekja.java.util.function.serializable.SerializableConsumer<AjaxRequestTarget> onTimer)
Creates an
AbstractAjaxTimerBehavior based on lambda expressions |
protected void |
onUnbind()
Called when the behavior is removed from its component.
|
void |
renderHead(Component component,
IHeaderResponse response)
Render to the web response whatever the component wants to contribute to the head section.
|
protected void |
respond(AjaxRequestTarget target) |
void |
restart(IPartialPageRequestHandler target)
Restart the timer.
|
protected void |
setUpdateInterval(Duration updateInterval)
Sets the update interval duration.
|
protected boolean |
shouldTrigger()
Decides whether the timer behavior should render its JavaScript to re-trigger it after the
update interval.
|
void |
stop(IPartialPageRequestHandler target)
Stops the timer.
|
findIndicatorId, getAttributes, getCallbackFunction, getCallbackFunctionBody, getCallbackScript, getCallbackScript, onBind, onMethodMismatch, onRequest, postprocessConfiguration, renderAjaxAttributes, renderAjaxAttributes, updateAjaxAttributes
afterRender, bind, getCallbackUrl, getComponent, onComponentRendered, onComponentTag, onComponentTag, unbind
beforeRender, canCallListener, detach, getStatelessHint, isEnabled, isTemporary, onAttribute, onConfigure, onEvent, onException, onTag
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
rendersPage
public AbstractAjaxTimerBehavior(Duration updateInterval)
updateInterval
- Duration between AJAX callbacksprotected final void setUpdateInterval(Duration updateInterval)
onTimer(AjaxRequestTarget)
method.updateInterval
- public final Duration getUpdateInterval()
public void renderHead(Component component, IHeaderResponse response)
Behavior
renderHead
in interface IComponentAwareHeaderContributor
renderHead
in class AbstractDefaultAjaxBehavior
component
- component which is contributing to the response. This parameter is here to give
the component as the context for component-awares implementing this interfaceresponse
- Response objectBehavior.renderHead(Component,
org.apache.wicket.markup.head.IHeaderResponse)
protected final void respond(AjaxRequestTarget target)
respond
in class AbstractDefaultAjaxBehavior
target
- The AJAX targetAbstractDefaultAjaxBehavior.respond(AjaxRequestTarget)
protected boolean shouldTrigger()
true
if the behavior is not stopped, it is enabled and still attached to any
component in the page or to the page itselfprotected abstract void onTimer(AjaxRequestTarget target)
target
- The request targetpublic final boolean isStopped()
true
if has been stopped via stop(IPartialPageRequestHandler)
public final void restart(IPartialPageRequestHandler target)
target
- may be nullprotected String getTimerId()
Note: The identifier must not change as long as this behavior is attached to a component!
Component.getMarkupId()
and
Component.getBehaviorById(int)
by defaultpublic final void stop(IPartialPageRequestHandler target)
target
- may be nullpublic void onRemove(Component component)
Behavior
protected void onUnbind()
AbstractAjaxBehavior
onUnbind
in class AbstractAjaxBehavior
public static AbstractAjaxTimerBehavior onTimer(Duration interval, org.danekja.java.util.function.serializable.SerializableConsumer<AjaxRequestTarget> onTimer)
AbstractAjaxTimerBehavior
based on lambda expressionsinterval
- the interval the timeronTimer
- the consumer which accepts the AjaxRequestTarget
AbstractAjaxTimerBehavior
Copyright © 2006–2022 Apache Software Foundation. All rights reserved.