/** @see AbstractAjaxTimerBehavior#onTimer(AjaxRequestTarget) */ @Override protected void onTimer(final AjaxRequestTarget target) { touch(getComponent().getApplication(), id); final List<DelayedMethodCallList> triggers = getTriggers(getComponent().getApplication(), id); List<DelayedMethodCallList> triggersCopy; synchronized (triggers) { if (triggers.isEmpty()) { return; } triggersCopy = new ArrayList<DelayedMethodCallList>(triggers); triggers.clear(); } for (final DelayedMethodCallList dmcl : triggersCopy) { try { dmcl.invoke(target); } catch (final Exception e) { throw new WicketRuntimeException( "a problem occured while adding events to AjaxRequestTarget", e); } } }
public void renderHead(Component component, IHeaderResponse response) { touch(getComponent().getApplication(), id); final String timerChannelPageId = getComponent().getPage().getId() + ":updateInterval:" + getUpdateInterval(); if (!getPageId(getComponent().getApplication(), id).equals(id)) { // behavior has already been redirected, we can skip this rendering return; } if (!response.wasRendered(timerChannelPageId)) { super.renderHead(component, response); setRedirectId(getComponent().getApplication(), timerChannelPageId, id); response.markRendered(timerChannelPageId); } else { /* * A similar behavior has already been rendered, we have no need to * render ourself All we need is redirect our own behavior id to the * id of the behavior which has been rendered. */ final String redirectedId = getPageId(getComponent().getApplication(), timerChannelPageId); setRedirectId(getComponent().getApplication(), id, redirectedId); } }
@Override protected void onBind() { super.onBind(); touch(getComponent().getApplication(), id); }