Class AbstractDialog<T>

  • All Implemented Interfaces:
    Serializable, Iterable<org.apache.wicket.Component>, org.apache.wicket.ajax.IAjaxIndicatorAware, org.apache.wicket.event.IEventSink, org.apache.wicket.event.IEventSource, org.apache.wicket.feedback.IFeedbackContributor, org.apache.wicket.IConverterLocator, org.apache.wicket.IGenericComponent<T,​org.apache.wicket.markup.html.form.Form<T>>, org.apache.wicket.IMetadataContext<Serializable,​org.apache.wicket.Component>, org.apache.wicket.IRequestListener, org.apache.wicket.markup.html.IHeaderContributor, org.apache.wicket.request.component.IRequestableComponent, org.apache.wicket.util.IHierarchical<org.apache.wicket.Component>, org.apache.wicket.util.io.IClusterable, IDialogService.Dialog
    Direct Known Subclasses:
    CompatibilityWorkflowPlugin.WorkflowAction.WorkflowDialog, Dialog

    public abstract class AbstractDialog<T>
    extends PostOnlyForm<T>
    implements IDialogService.Dialog, org.apache.wicket.ajax.IAjaxIndicatorAware
    Utility class for implementing the IDialogService.Dialog interface. Provides OK and Cancel buttons by default, and has support for fullscreen mode which is enabled by overriding isFullscreenEnabled.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean cancelled  
      protected org.apache.wicket.markup.html.panel.FeedbackPanel feedback  
      protected AbstractDialog.PersistentFeedbackMessagesModel feedbackMessages  
      • Fields inherited from class org.apache.wicket.markup.html.form.Form

        ENCTYPE_MULTIPART_FORM_DATA, HIDDEN_FIELDS_CSS_CLASS_KEY, METHOD_GET, METHOD_POST, UPLOAD_FAILED_RESOURCE_KEY, UPLOAD_SINGLE_FILE_TOO_LARGE_RESOURCE_KEY, UPLOAD_TOO_LARGE_RESOURCE_KEY, UPLOAD_TOO_MANY_FILES_RESOURCE_KEY
      • Fields inherited from class org.apache.wicket.Component

        ENABLE, FLAG_INITIALIZED, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER, RFLAG_CONTAINER_DEQUEING, RFLAG_CONTAINER_HAS_REMOVALS
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected boolean addAjaxIndicator()  
      protected void addButton​(org.apache.wicket.markup.html.form.Button button)
      Add a Button to the button bar.
      protected void addButton​(org.apache.wicket.markup.html.form.Button button, AbstractDialog.ButtonPosition buttonPosition)
      Add a Button to the button bar.
      protected void closeDialog()  
      protected void delegateSubmit​(org.apache.wicket.markup.html.form.IFormSubmitter submittingComponent)  
      protected String getAdditionalFullscreenScript​(boolean isFullscreen)
      Add custom javascript to be executed after the dialog has gone fullscreen or returned to it's initial size.
      String getAjaxIndicatorMarkupId()
      Implement IAjaxIndicatorAware, to let ajax components in the dialog trigger the ajax indicator when they trigger an ajax request.
      org.apache.wicket.Component getComponent()
      protected org.apache.wicket.model.IModel<String> getExceptionTranslation​(Throwable t, Object... parameters)  
      protected org.apache.wicket.feedback.FeedbackMessagesModel getFeedbackMessagesModel()  
      protected String getFullscreenScript()
      Construct javascript that looks up the latest dialog and executes the toggleFullscreen function.
      org.apache.wicket.util.value.IValueMap getProperties()
      Properties that determine how the dialog is rendered.
      UserSession getSession()  
      protected void handleSubmit()
      Method that handles the submit to a form.
      protected boolean isFullscreenEnabled()
      If this method returns true a fullscreen button will be added to the dialog which toggle's the between fullscreen and initial size.
      protected org.apache.wicket.markup.html.panel.FeedbackPanel newFeedbackPanel​(String id)
      Create a feedback panel and display only messages from children components.
      protected void onCancel()
      Callback method invoked when the user clicks the 'Cancel' button.
      void onCancelFromCloseButton()
      Invoked when the built-in close button (X) is clicked.
      void onClose()
      Implement onClose callback, invoked when the dialog is closed.
      protected void onDetach()  
      protected void onError()  
      void onEvent​(org.apache.wicket.event.IEvent<?> event)  
      protected void onOk()
      Callback method invoked when the user clicks the 'OK' button.
      protected void onRemove()  
      protected void onSubmit()  
      void process​(org.apache.wicket.markup.html.form.IFormSubmitter submittingComponent)  
      protected void removeButton​(org.apache.wicket.markup.html.form.Button button)
      Remove a button from the button bar.
      void render​(PluginRequestTarget target)
      Part of the pre-rendering registration.
      void setAjaxChannel​(org.apache.wicket.ajax.AjaxChannel ajaxChannel)  
      protected void setButtonCssClass​(String buttonCssClass)
      Set a specific class that is added to all the buttons in the dialog
      protected void setCancelEnabled​(boolean isset)  
      protected void setCancelKeyType​(wicket.contrib.input.events.key.KeyType keyType)  
      protected void setCancelLabel​(String label)  
      protected void setCancelLabel​(org.apache.wicket.model.IModel<String> label)  
      protected void setCancelVisible​(boolean isset)  
      void setDialogService​(IDialogService dialogService)
      When the dialog is shown (IDialogService.show(Dialog)), the dialog service is injected into the dialog.
      org.apache.wicket.Component setFocus​(org.apache.wicket.Component c)  
      AjaxUpdatingWidget<?> setFocus​(AjaxUpdatingWidget<?> widget)  
      protected void setFocusOnCancel()  
      protected void setFocusOnOk()  
      void setNonAjaxSubmit()  
      protected void setOkEnabled​(boolean isset)  
      protected void setOkKeyType​(wicket.contrib.input.events.key.KeyType keyType)  
      protected void setOkLabel​(String label)  
      protected void setOkLabel​(org.apache.wicket.model.IModel<String> label)  
      protected void setOkVisible​(boolean isset)  
      • Methods inherited from class org.apache.wicket.markup.html.form.Form

        add, addDefaultSubmitButtonHandler, appendDefaultButtonField, beforeUpdateFormComponentModels, callOnError, clearInput, encodeUrlInHiddenFields, error, findForm, findSubmitter, getActionUrl, getDefaultButton, getFileCountMax, getFileMaxSize, getFormValidators, getInputNamePrefix, getJsForListenerUrl, getJsForSubmitter, getMaxSize, getRootForm, getRootFormRelativeId, getStatelessHint, getValidatorKeyPrefix, handleMultiPart, hasError, internalOnModelChanged, isMultiPart, isRootForm, isSubmitted, markFormComponentsInvalid, markFormComponentsValid, onBeforeRender, onComponentTag, onComponentTagBody, onFileUploadException, onFormSubmitted, onRequest, onValidate, onValidateModelObjects, remove, renderHead, renderPlaceholderTag, setDefaultButton, setFileCountMax, setFileMaxSize, setMaxSize, setMultiPart, setVersioned, updateFormComponentModels, validate, validateComponents, validateFormValidator, validateFormValidators, visitFormComponents, visitFormComponentsPostOrder, wantSubmitOnNestedFormSubmit, wantSubmitOnParentFormSubmit, writeHiddenFields, writeParamsAsHiddenFields
      • Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer

        getWebApplication, getWebPage, getWebRequest, getWebResponse, getWebSession
      • Methods inherited from class org.apache.wicket.MarkupContainer

        add, addDequeuedComponent, addOrReplace, autoAdd, canDequeueTag, contains, dequeue, dequeue, dequeuePreamble, findChildComponent, findComponentToDequeue, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, getRegionMarkup, internalAdd, internalInitialize, iterator, iterator, newDequeueContext, onInitialize, onRender, queue, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, stream, streamChildren, toString, toString, visitChildren, visitChildren
      • Methods inherited from class org.apache.wicket.Component

        add, addStateChange, beforeRender, canCallListener, canCallListenerAfterExpiry, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, clearOriginalDestination, configure, continueToOriginalDestination, createConverter, debug, detach, detachModel, detachModels, determineVisibility, error, exceptionMessage, fatal, findMarkupStream, findPage, findParent, findParentWithAssociatedMarkup, getAjaxRegionMarkupId, getApplication, getBehaviorById, getBehaviorId, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getDefaultModel, getDefaultModelObject, getDefaultModelObjectAsString, getDefaultModelObjectAsString, getEscapeModelStrings, getFeedbackMessages, getFlag, getId, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkup, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdFromMarkup, getMarkupIdImpl, getMarkupSourcingStrategy, getMarkupTag, getMetaData, getModelComparator, getOutputMarkupId, getOutputMarkupPlaceholderTag, getPage, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getRequestFlag, getResponse, getSizeInBytes, getString, getString, getString, getStyle, getVariation, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, initModel, internalRenderComponent, internalRenderHead, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isInitialized, isRenderAllowed, isRendering, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, markRendering, modelChanged, modelChanging, newMarkupSourcingStrategy, onAfterRender, onConfigure, onModelChanged, onModelChanging, onReAdd, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderPart, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlForListener, urlForListener, visitParents, visitParents, warn, wrap
      • Methods inherited from interface org.apache.wicket.IGenericComponent

        getDefaultModel, getDefaultModelObject, getModel, getModelObject, setDefaultModel, setDefaultModelObject, setModel, setModelObject
      • Methods inherited from interface org.apache.wicket.IRequestListener

        rendersPage
    • Constructor Detail

      • AbstractDialog

        public AbstractDialog()
      • AbstractDialog

        public AbstractDialog​(org.apache.wicket.model.IModel<T> model)
    • Method Detail

      • getExceptionTranslation

        protected org.apache.wicket.model.IModel<String> getExceptionTranslation​(Throwable t,
                                                                                 Object... parameters)
      • onEvent

        public void onEvent​(org.apache.wicket.event.IEvent<?> event)
        Specified by:
        onEvent in interface org.apache.wicket.event.IEventSink
        Overrides:
        onEvent in class org.apache.wicket.markup.html.form.Form<T>
      • addAjaxIndicator

        protected boolean addAjaxIndicator()
      • getFullscreenScript

        protected String getFullscreenScript()
        Construct javascript that looks up the latest dialog and executes the toggleFullscreen function. Additional javascript can be added by overriding getAdditionalFullscreenScript
        Returns:
        Javascript that toggles the dialog between fullscreen and initial size
      • getAdditionalFullscreenScript

        protected String getAdditionalFullscreenScript​(boolean isFullscreen)
        Add custom javascript to be executed after the dialog has gone fullscreen or returned to it's initial size.
        Parameters:
        isFullscreen - flag indicating the current fullscreen state
        Returns:
        Custom javascript that is executed after the dialog changed fullscreen state
      • isFullscreenEnabled

        protected boolean isFullscreenEnabled()
        If this method returns true a fullscreen button will be added to the dialog which toggle's the between fullscreen and initial size.
        Returns:
        true to enable fullscreen support
      • getSession

        public UserSession getSession()
        Overrides:
        getSession in class org.apache.wicket.Component
      • onDetach

        protected void onDetach()
        Overrides:
        onDetach in class org.apache.wicket.markup.html.form.Form<T>
      • newFeedbackPanel

        protected org.apache.wicket.markup.html.panel.FeedbackPanel newFeedbackPanel​(String id)
        Create a feedback panel and display only messages from children components.
      • getFeedbackMessagesModel

        protected final org.apache.wicket.feedback.FeedbackMessagesModel getFeedbackMessagesModel()
      • getAjaxIndicatorMarkupId

        public String getAjaxIndicatorMarkupId()
        Implement IAjaxIndicatorAware, to let ajax components in the dialog trigger the ajax indicator when they trigger an ajax request.
        Specified by:
        getAjaxIndicatorMarkupId in interface org.apache.wicket.ajax.IAjaxIndicatorAware
        Returns:
        the markup id of the ajax indicator
      • closeDialog

        protected final void closeDialog()
      • setNonAjaxSubmit

        public void setNonAjaxSubmit()
      • setAjaxChannel

        public void setAjaxChannel​(org.apache.wicket.ajax.AjaxChannel ajaxChannel)
      • setOkEnabled

        protected void setOkEnabled​(boolean isset)
      • setOkVisible

        protected void setOkVisible​(boolean isset)
      • setOkLabel

        protected void setOkLabel​(String label)
      • setOkLabel

        protected void setOkLabel​(org.apache.wicket.model.IModel<String> label)
      • setFocusOnOk

        protected void setFocusOnOk()
      • setCancelEnabled

        protected void setCancelEnabled​(boolean isset)
      • setCancelVisible

        protected void setCancelVisible​(boolean isset)
      • setCancelLabel

        protected void setCancelLabel​(String label)
      • setCancelLabel

        protected void setCancelLabel​(org.apache.wicket.model.IModel<String> label)
      • setFocusOnCancel

        protected void setFocusOnCancel()
      • setOkKeyType

        protected void setOkKeyType​(wicket.contrib.input.events.key.KeyType keyType)
      • setCancelKeyType

        protected void setCancelKeyType​(wicket.contrib.input.events.key.KeyType keyType)
      • addButton

        protected void addButton​(org.apache.wicket.markup.html.form.Button button)
        Add a Button to the button bar. The id of the button must equal "button". The button will be added to the left of the default buttons.
      • addButton

        protected void addButton​(org.apache.wicket.markup.html.form.Button button,
                                 AbstractDialog.ButtonPosition buttonPosition)
        Add a Button to the button bar. The id of the button must equal "button".
        Parameters:
        button - the button to add
        buttonPosition - to position the button left or right of the default buttons
      • removeButton

        protected void removeButton​(org.apache.wicket.markup.html.form.Button button)
        Remove a button from the button bar.
      • setButtonCssClass

        protected void setButtonCssClass​(String buttonCssClass)
        Set a specific class that is added to all the buttons in the dialog
      • handleSubmit

        protected void handleSubmit()
        Method that handles the submit to a form.
      • delegateSubmit

        protected void delegateSubmit​(org.apache.wicket.markup.html.form.IFormSubmitter submittingComponent)
        Overrides:
        delegateSubmit in class org.apache.wicket.markup.html.form.Form<T>
      • onSubmit

        protected final void onSubmit()
        Overrides:
        onSubmit in class org.apache.wicket.markup.html.form.Form<T>
      • onError

        protected final void onError()
        Overrides:
        onError in class org.apache.wicket.markup.html.form.Form<T>
      • onOk

        protected void onOk()
        Callback method invoked when the user clicks the 'OK' button. When no errors are reported, this will cause the dialog to be closed.
      • onCancel

        protected void onCancel()
        Callback method invoked when the user clicks the 'Cancel' button.
      • onCancelFromCloseButton

        public void onCancelFromCloseButton()
        Description copied from interface: IDialogService.Dialog
        Invoked when the built-in close button (X) is clicked. In general, clicking the close button (X) is considered similar to cancelling a dialog. As such, to be able to invoke the correct ScriptAction in Dialog.onClose() we have to inform the dialog that it is actually cancelled, before closing it.

        A default implementation is provided to maintain backwards compatibility with custom dialogs that directly implement interface IDialogService.Dialog instead of extending class Dialog.

        Specified by:
        onCancelFromCloseButton in interface IDialogService.Dialog
      • getComponent

        public org.apache.wicket.Component getComponent()
        Specified by:
        getComponent in interface IDialogService.Dialog
        Returns:
        a component with wicket id "content"
      • onRemove

        protected void onRemove()
        Overrides:
        onRemove in class org.apache.wicket.Component
      • onClose

        public void onClose()
        Implement onClose callback, invoked when the dialog is closed. Make sure the keyboard shortcuts are cleaned up correctly. Subclasses overriding this method should also invoke super#onClose();
        Specified by:
        onClose in interface IDialogService.Dialog
      • getProperties

        public org.apache.wicket.util.value.IValueMap getProperties()
        Properties that determine how the dialog is rendered. In particular, the width and height properties are used for the size (in pixels).
        Specified by:
        getProperties in interface IDialogService.Dialog
      • setFocus

        public org.apache.wicket.Component setFocus​(org.apache.wicket.Component c)
      • process

        public void process​(org.apache.wicket.markup.html.form.IFormSubmitter submittingComponent)
        Overrides:
        process in class org.apache.wicket.markup.html.form.Form<T>