Class AjaxFallbackButton

All Implemented Interfaces:
Serializable, Iterable<Component>, IEventSink, IEventSource, IFeedbackContributor, IConverterLocator, IGenericComponent<String,FormComponent<String>>, IMetadataContext<Serializable,Component>, IFormModelUpdateListener, IFormSubmitter, IFormSubmittingComponent, IFormVisitorParticipant, ILabelProvider<String>, IHeaderContributor, IRequestableComponent, IHierarchical<Component>, IClusterable

public abstract class AjaxFallbackButton extends Button
An ajax submit button that will degrade to a normal request if ajax is not available or javascript is disabled.
Since:
1.3
Author:
Jeremy Thomerson (jthomerson), Alastair Maw
See Also:
  • Constructor Details

  • Method Details

    • newAjaxEventBehavior

    • shouldTriggerJavaScriptSubmitEvent

      Controls whether or not a JS submit should be triggered on the submitting form. False by default.
      Returns:
      true if submit should be triggered, false otherwise
    • updateAjaxAttributes

      protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
    • onError

      protected void onError(Optional<AjaxRequestTarget> target)
      Listener method invoked on form submit with errors. If ajax failed and this event was generated via a normal submission, the target argument will be null.
      Parameters:
      target -
    • onError

      public final void onError()
      Description copied from interface: IFormSubmitter
      Method that is invoked when form processing fails; for example, when there are validation errors.
      Specified by:
      onError in interface IFormSubmitter
      Overrides:
      onError in class Button
    • onSubmit

      public final void onSubmit()
      Description copied from class: Button
      Override this method to provide special submit handling in a multi-button form. It is called whenever the user clicks this particular button, except if validation fails. This method will be called before Form.onSubmit().
      Specified by:
      onSubmit in interface IFormSubmitter
      Overrides:
      onSubmit in class Button
    • onAfterSubmit

      public final void onAfterSubmit()
      Description copied from class: Button
      Override this method to provide special submit handling in a multi-button form. It is called whenever the user clicks this particular button, except if validation fails. This method will be called after Form.onSubmit().
      Specified by:
      onAfterSubmit in interface IFormSubmitter
      Overrides:
      onAfterSubmit in class Button
    • getForm

      public Form<?> getForm()
      Description copied from class: Button
      Override to not throw exception if there is no parent form.
      Specified by:
      getForm in interface IFormSubmitter
      Overrides:
      getForm in class Button
      Returns:
      the parent form or null
    • onSubmit

      protected void onSubmit(Optional<AjaxRequestTarget> target)
      Callback for the onClick event. If ajax failed and this event was generated via a normal submission, the target argument will be Optional.empty(). This method will be called before Form.onSubmit().
      Parameters:
      target - ajax target if this linked was invoked using ajax, Optional.empty() otherwise
    • onAfterSubmit

      protected void onAfterSubmit(Optional<AjaxRequestTarget> target)
      Callback for the onClick event. If ajax failed and this event was generated via a normal submission, the target argument will be null. This method will be called after Form.onSubmit().
      Parameters:
      target - ajax target if this linked was invoked using ajax, null otherwise
    • isButtonEnabled

      protected final boolean isButtonEnabled()
      Helper methods that both checks whether the link is enabled and whether the action ENABLE is allowed.
      Returns:
      whether the link should be rendered as enabled
    • onComponentTag

      protected void onComponentTag(ComponentTag tag)
      Description copied from class: Button
      Processes the component tag. A value attribute is added with the value of the model object, if available.

      NOTE. For a <button> the value attribute is not rendered, markup needs to be added within the button to display the button's label.

      Overrides:
      onComponentTag in class Button
      Parameters:
      tag - Tag to modify
      See Also: