@Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { super.updateAjaxAttributes(attributes); attributes.setMethod(Method.POST); }
/** * adds close handler to initializer script, if use of close handler has been defined. * * @param markupId markup id * @param script base script to prepend * @return close handler script */ private String addCloseHandlerScript(final String markupId, final String script) { if (closeBehavior != null) { return script + ";$('#" + markupId + "').on('hidden', function () { " + " Wicket.Ajax.ajax({'u':'" + closeBehavior.getCallbackUrl() + "','c':'" + markupId + "'});" + "})"; } return script; }
private List<String> collectEvents(AjaxEventBehavior behavior) { List<String> events = new ArrayList<>(); String behaviorEvent = behavior.getEvent(); String[] behaviorEventNames = Strings.split(behaviorEvent, ' '); for (String behaviorEventName : behaviorEventNames) { if (behaviorEventName.startsWith("on")) { behaviorEventName = behaviorEventName.substring(2); } events.add(behaviorEventName); } return events; }
@Override protected void onComponentTag(ComponentTag tag) { // add the onclick handler only if link is enabled if (isLinkEnabled()) { super.onComponentTag(tag); } } });
/** * * @return event handler */ protected CharSequence getEventHandler() { CharSequence handler = getCallbackScript(); if (event.equalsIgnoreCase("href")) { handler = "javascript:" + handler; } return handler; }
@Override protected final void respond(final AjaxRequestTarget target) { onEvent(target); }
/** * * @see org.apache.wicket.behavior.AbstractAjaxBehavior#onBind() */ protected void onBind() { super.onBind(); if (!(getComponent() instanceof FormComponent)) { throw new WicketRuntimeException("Behavior " + getClass().getName() + " can only be added to an instance of a FormComponent"); } }
@Override public void renderHead(Component c, IHeaderResponse response) { super.renderHead(c, response); headerContrib.renderHead(c, response); }
@Override protected void onComponentTag(ComponentTag tag) { // add the onclick handler only if link is enabled if (isLinkEnabled()) { super.onComponentTag(tag); } } });
/** * * @return event handler */ protected CharSequence getEventHandler() { CharSequence handler = getCallbackScript(); if (event.equalsIgnoreCase("href")) { handler = "javascript:" + handler; } return handler; }
@Override protected final void respond(final AjaxRequestTarget target) { onEvent(target); }
@Override protected void onBind() { super.onBind(); //generate behavior id getComponent().getBehaviorId(this); }
@Override public void renderHead(Component c, IHeaderResponse response) { super.renderHead(c, response); headerContrib.renderHead(c, response); }
@Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { super.updateAjaxAttributes(attributes); attributes.setMethod(Method.POST); }
protected void onComponentTag(ComponentTag tag) { // only render handler if link is enabled if (isLinkEnabled()) { super.onComponentTag(tag); } } });
private Component internalAdd(Behavior behavior) { if (AjaxEventBehavior.class.isAssignableFrom(behavior.getClass())) { AjaxEventBehavior ajaxEventBehavior = (AjaxEventBehavior) behavior; button.add(new DelegateEventBehavior(ajaxEventBehavior.getEvent(), radio)); radio.add(ajaxEventBehavior); return this; } return super.add(behavior); }
/** * adds close handler to initializer script, if use of close handler has been defined. * * @param markupId markup id * @param script base script to prepend * @return close handler script */ private String addCloseHandlerScript(final String markupId, final String script) { if (closeBehavior != null) { return script + ";$('#" + markupId + "').on('hidden', function () { " + " Wicket.Ajax.ajax({'u':'" + closeBehavior.getCallbackUrl() + "','c':'" + markupId + "'});" + "})"; } return script; } //--------------------------------------------------------
@Override public void renderHead(final Component component, final IHeaderResponse response) { super.renderHead(component, response); if (component.isEnabledInHierarchy()) { CharSequence js = getCallbackScript(component); response.render(OnDomReadyHeaderItem.forScript(js.toString())); } }