/** * Construct. * * @param id * @param model * @param form */ public AjaxFallbackButton(String id, IModel<String> model, Form<?> form) { super(id, model); mForm = form; add(newAjaxEventBehavior(form, "click")); }
/** * @see org.apache.wicket.markup.html.form.IFormSubmittingComponent#onSubmit() */ @Override public final void onSubmit() { if (!(getRequestCycle().getRequestTarget() instanceof AjaxRequestTarget)) { onSubmit(null, getForm()); } }
@Override public final void onError() { if (getRequestCycle().find(AjaxRequestTarget.class).isPresent() == false) { onError(Optional.empty()); } }
@Override public final void onSubmit() { if (getRequestCycle().find(AjaxRequestTarget.class).isPresent() == false) { onSubmit(Optional.empty()); } }
@Override public final void onAfterSubmit() { if (getRequestCycle().find(AjaxRequestTarget.class).isPresent() == false) { onAfterSubmit(Optional.empty()); } }
@Override protected void onSubmit(AjaxRequestTarget target) { AjaxFallbackButton.this.onSubmit(Optional.of(target)); }
@Override protected void onError(AjaxRequestTarget target) { AjaxFallbackButton.this.onError(Optional.of(target)); }
mForm = form; add(new AjaxFormSubmitBehavior(form, "onclick")
/** * Helper methods that both checks whether the link is enabled and whether the action ENABLE is * allowed. * * @return whether the link should be rendered as enabled */ protected final boolean isButtonEnabled() { return isEnabledInHierarchy(); }
@Override protected IAjaxCallDecorator getAjaxCallDecorator() { return AjaxFallbackButton.this.getAjaxCallDecorator(); } });
@Override protected void onConfigure() { super.onConfigure(); splitter.setVisible(icon.hasIconType()); }
@Override protected void onBeforeRender() { if (actionDeterminesVisibility) { if (this.submitAction == null) setVisible(false); else setVisible(true); } this.callCounter = 0; super.onBeforeRender(); }
@Override protected void onDetach() { super.onDetach(); if (callCounter > 0) log.debug("button called " + callCounter + " times"); }
@Override public final void onError() { if (getRequestCycle().find(AjaxRequestTarget.class).isPresent() == false) { onError(Optional.empty()); } }
@Override public final void onSubmit() { if (getRequestCycle().find(AjaxRequestTarget.class).isPresent() == false) { onSubmit(Optional.empty()); } }
@Override public final void onAfterSubmit() { if (getRequestCycle().find(AjaxRequestTarget.class).isPresent() == false) { onAfterSubmit(Optional.empty()); } }
@Override protected void onSubmit(AjaxRequestTarget target) { AjaxFallbackButton.this.onSubmit(Optional.of(target)); }