/** * @see org.apache.wicket.ajax.AbstractDefaultAjaxBehavior#getPreconditionScript() */ protected CharSequence getPreconditionScript() { String precondition = null; if (!(getComponent() instanceof Page)) { String componentId = getComponent().getMarkupId(); precondition = "var c = Wicket.$('" + componentId + "'); return typeof(c) != 'undefined' && c != null"; } return precondition; }
/** * @see org.apache.wicket.ajax.AbstractDefaultAjaxBehavior#getPreconditionScript() */ @Override protected CharSequence getPreconditionScript() { String precondition = null; if (!(getComponent() instanceof Page)) { String componentId = getComponent().getMarkupId(); precondition = "var c = Wicket.$('" + componentId + "'); return typeof(c) != 'undefined' && c != null"; } return precondition; }
/** * Decides whether the timer behavior should render its JavaScript to re-trigger it after the * update interval. * * @return {@code true} if the behavior is not stopped, it is enabled and still attached to any * component in the page or to the page itself */ protected boolean shouldTrigger() { return isStopped() == false && isEnabled(getComponent()) && (getComponent() instanceof Page || getComponent().findParent(Page.class) != null); }
/** * Decides whether the timer behavior should render its JavaScript to re-trigger it after the * update interval. * * @return {@code true} if the behavior is not stopped, it is enabled and still attached to any * component in the page or to the page itself */ protected boolean shouldTrigger() { return isStopped() == false && isEnabled(getComponent()) && (getComponent() instanceof Page || getComponent().findParent(Page.class) != null); }
/** * Create an identifier for the JavaScript timer. * <p> * Note: The identifier must not change as long as this behavior is attached to a component! * * @return creates an id based on {@link Component#getMarkupId()} and * {@link Component#getBehaviorById(int)} by default */ protected String getTimerId() { Component component = getComponent(); return component.getMarkupId() + "." + component.getBehaviorId(this); }
/** * Create an identifier for the JavaScript timer. * <p> * Note: The identifier must not change as long as this behavior is attached to a component! * * @return creates an id based on {@link Component#getMarkupId()} and * {@link Component#getBehaviorById(int)} by default */ protected String getTimerId() { Component component = getComponent(); return component.getMarkupId() + "." + component.getBehaviorId(this); }
@Override protected void onUnbind() { Component component = getComponent(); component.getRequestCycle().find(IPartialPageRequestHandler.class).ifPresent(target -> clearTimeout(target.getHeaderResponse())); }
@Override protected void onUnbind() { Component component = getComponent(); component.getRequestCycle().find(IPartialPageRequestHandler.class).ifPresent(target -> clearTimeout(target.getHeaderResponse())); }
/** * * @see org.apache.wicket.ajax.AbstractDefaultAjaxBehavior#respond(org.apache.wicket.ajax.AjaxRequestTarget) */ @Override protected final void respond(final AjaxRequestTarget target) { onTimer(target); if (!stopped && isEnabled(getComponent())) { target.getHeaderResponse().renderOnLoadJavascript(getJsTimeoutCall(updateInterval)); } }