@Override public void renderHead(final Component component, final IHeaderResponse response) { super.renderHead(component, response); renderAutocompleteHead(response); }
@Override public final CharSequence getCallbackUrl() { return super.getCallbackUrl() + "&" + HISTORY_ITEM_PARAM + "=' + HistoryManager.getHistoryItem()"; }
@Override protected void updateAjaxAttributes(final AjaxRequestAttributes attributes) { super.updateAjaxAttributes(attributes); final List<CharSequence> dep = attributes.getDynamicExtraParameters(); dep.add("return { " + PATH_PARAMETER + ": path };"); dep.add("return { " + UUID_PARAMETER + ": uuid };"); }
/** * @return javascript that will generate an ajax GET request to this behavior with its assigned * component */ public CharSequence getCallbackScript() { return getCallbackScript(getComponent()); }
/** * @return javascript that will generate an ajax GET request to this behavior * * @param onlyTargetActivePage * if true the callback to this behavior will be ignore if the page is not the last * one the user accessed * */ protected CharSequence getCallbackScript(boolean onlyTargetActivePage) { return generateCallbackScript("wicketAjaxGet('" + getCallbackUrl(onlyTargetActivePage) + "'"); }
public class HomePage extends WebPage { private AbstractDefaultAjaxBehavior onPageLoadBehavior; public HomePage(final PageParameters parameters) { super(parameters); (...) onPageLoadBehavior = new AbstractDefaultAjaxBehavior() { @Override protected void respond(AjaxRequestTarget target) { //will be called after Dom is ready dialog.open(target); } }; add(onPageLoadBehavior); } @Override public void renderHead(IHeaderResponse response) { super.renderHead(response); //OnDomReady execute our onPageLoadBehavior callback response.render(OnDomReadyHeaderItem.forScript(onPageLoadBehavior.getCallbackScript())); } }
attributesJson.put(AjaxAttributeName.URL.jsonName(), getCallbackUrl()); Method method = attributes.getMethod(); if (Method.POST == method) String indicatorId = findIndicatorId(); if (Strings.isEmpty(indicatorId) == false) appendListenerHandler(initHandler, attributesJson, AjaxAttributeName.INIT_HANDLER.jsonName(), INIT_HANDLER_FUNCTION_TEMPLATE); appendListenerHandler(beforeHandler, attributesJson, AjaxAttributeName.BEFORE_HANDLER.jsonName(), BEFORE_HANDLER_FUNCTION_TEMPLATE); appendListenerHandler(beforeSendHandler, attributesJson, AjaxAttributeName.BEFORE_SEND_HANDLER.jsonName(), BEFORE_SEND_HANDLER_FUNCTION_TEMPLATE); appendListenerHandler(afterHandler, attributesJson, AjaxAttributeName.AFTER_HANDLER.jsonName(), AFTER_HANDLER_FUNCTION_TEMPLATE); appendListenerHandler(successHandler, attributesJson, AjaxAttributeName.SUCCESS_HANDLER.jsonName(), SUCCESS_HANDLER_FUNCTION_TEMPLATE); appendListenerHandler(failureHandler, attributesJson, AjaxAttributeName.FAILURE_HANDLER.jsonName(), FAILURE_HANDLER_FUNCTION_TEMPLATE);
/** * @return the Ajax settings for this behavior * @since 6.0 */ protected final AjaxRequestAttributes getAttributes() { AjaxRequestAttributes attributes = new AjaxRequestAttributes(); WebApplication application = (WebApplication)getComponent().getApplication(); AjaxRequestTargetListenerCollection ajaxRequestTargetListeners = application .getAjaxRequestTargetListeners(); for (AjaxRequestTarget.IListener listener : ajaxRequestTargetListeners) { listener.updateAjaxAttributes(this, attributes); } updateAjaxAttributes(attributes); return attributes; }
/** * @return javascript that will generate an ajax GET request to this behavior */ protected CharSequence getCallbackScript() { return getCallbackScript(false); }
@Override protected void onBind() { super.onBind(); final Component component = getComponent(); component.setOutputMarkupId(true); }
attributesJson.put(AjaxAttributeName.URL.jsonName(), getCallbackUrl()); Method method = attributes.getMethod(); if (Method.POST == method) String indicatorId = findIndicatorId(); if (Strings.isEmpty(indicatorId) == false) appendListenerHandler(initHandler, attributesJson, AjaxAttributeName.INIT_HANDLER.jsonName(), INIT_HANDLER_FUNCTION_TEMPLATE); appendListenerHandler(beforeHandler, attributesJson, AjaxAttributeName.BEFORE_HANDLER.jsonName(), BEFORE_HANDLER_FUNCTION_TEMPLATE); appendListenerHandler(beforeSendHandler, attributesJson, AjaxAttributeName.BEFORE_SEND_HANDLER.jsonName(), BEFORE_SEND_HANDLER_FUNCTION_TEMPLATE); appendListenerHandler(afterHandler, attributesJson, AjaxAttributeName.AFTER_HANDLER.jsonName(), AFTER_HANDLER_FUNCTION_TEMPLATE); appendListenerHandler(successHandler, attributesJson, AjaxAttributeName.SUCCESS_HANDLER.jsonName(), SUCCESS_HANDLER_FUNCTION_TEMPLATE); appendListenerHandler(failureHandler, attributesJson, AjaxAttributeName.FAILURE_HANDLER.jsonName(), FAILURE_HANDLER_FUNCTION_TEMPLATE);
/** * @return javascript that will generate an ajax GET request to this behavior * * @param onlyTargetActivePage * if true the callback to this behavior will be ignore if the page is not the last * one the user accessed * */ protected CharSequence getCallbackScript(boolean onlyTargetActivePage) { return generateCallbackScript("wicketAjaxGet('" + getCallbackUrl(onlyTargetActivePage) + "'"); }
/** * @return the Ajax settings for this behavior * @since 6.0 */ protected final AjaxRequestAttributes getAttributes() { AjaxRequestAttributes attributes = new AjaxRequestAttributes(); WebApplication application = (WebApplication)getComponent().getApplication(); AjaxRequestTargetListenerCollection ajaxRequestTargetListeners = application .getAjaxRequestTargetListeners(); for (AjaxRequestTarget.IListener listener : ajaxRequestTargetListeners) { listener.updateAjaxAttributes(this, attributes); } updateAjaxAttributes(attributes); return attributes; }
/** * @return javascript that will generate an ajax GET request to this behavior */ protected CharSequence getCallbackScript() { return getCallbackScript(false); }
@Override protected void onBind() { super.onBind(); if (resourceBehavior != null) { getComponent().add(resourceBehavior); } }
/** * @return javascript that will generate an ajax GET request to this behavior with its assigned * component */ public CharSequence getCallbackScript() { return getCallbackScript(getComponent()); }
@Override public final void renderHead(Component component, IHeaderResponse response) { super.renderHead(component, response); renderDropHead(response); }
@Override public final CharSequence getCallbackUrl() { return super.getCallbackUrl() + PLACEHOLDER; }
@Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { super.updateAjaxAttributes(attributes); StringBuilder buffer = new StringBuilder(); buffer.append("var data = serializeWidgetLocations();"); buffer.append("return {'" + JSON_DATA + "': data};"); attributes.getDynamicExtraParameters().add(buffer); }
@Override public CharSequence getCallbackScript() { return super.getCallbackScript(); } }