Package org.hippoecm.frontend.dialog
Class AbstractDialog<T>
java.lang.Object
org.apache.wicket.Component
org.apache.wicket.MarkupContainer
org.apache.wicket.markup.html.WebMarkupContainer
org.apache.wicket.markup.html.form.Form<T>
org.hippoecm.frontend.form.PostOnlyForm<T>
org.hippoecm.frontend.dialog.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:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
protected class
protected static class
Nested classes/interfaces inherited from class org.apache.wicket.markup.html.form.Form
org.apache.wicket.markup.html.form.Form.MethodMismatchResponse, org.apache.wicket.markup.html.form.Form.ValidationVisitor
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
protected org.apache.wicket.markup.html.panel.FeedbackPanel
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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
protected void
addButton
(org.apache.wicket.markup.html.form.Button button) Add aButton
to the button bar.protected void
addButton
(org.apache.wicket.markup.html.form.Button button, AbstractDialog.ButtonPosition buttonPosition) Add aButton
to the button bar.protected final void
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.ImplementIAjaxIndicatorAware
, to let ajax components in the dialog trigger the ajax indicator when they trigger an ajax request.org.apache.wicket.Component
protected org.apache.wicket.model.IModel<String>
getExceptionTranslation
(Throwable t, Object... parameters) protected final org.apache.wicket.feedback.FeedbackMessagesModel
protected String
Construct javascript that looks up the latest dialog and executes the toggleFullscreen function.org.apache.wicket.util.value.IValueMap
Properties that determine how the dialog is rendered.protected String
getSelectableNodeTypesMessage
(String[] nodeTypes) Construct a feedback message for either 1, 2 or >2 selectable node typesprotected void
Method that handles the submit to a form.protected boolean
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
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
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 final 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 final 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 dialogprotected 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) setFocus
(AjaxUpdatingWidget<?> widget) protected void
protected void
void
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.hippoecm.frontend.form.PostOnlyForm
getMethod, onMethodMismatch
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, 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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.hippoecm.frontend.dialog.IDialogService.Dialog
getTitle
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
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
feedbackMessages
-
feedback
protected org.apache.wicket.markup.html.panel.FeedbackPanel feedback -
cancelled
protected boolean cancelled
-
-
Constructor Details
-
AbstractDialog
public AbstractDialog() -
AbstractDialog
-
-
Method Details
-
getExceptionTranslation
-
getSelectableNodeTypesMessage
Construct a feedback message for either 1, 2 or >2 selectable node types -
onEvent
public void onEvent(org.apache.wicket.event.IEvent<?> event) - Specified by:
onEvent
in interfaceorg.apache.wicket.event.IEventSink
- Overrides:
onEvent
in classorg.apache.wicket.markup.html.form.Form<T>
-
addAjaxIndicator
protected boolean addAjaxIndicator() -
getFullscreenScript
Construct javascript that looks up the latest dialog and executes the toggleFullscreen function. Additional javascript can be added by overridinggetAdditionalFullscreenScript
- Returns:
- Javascript that toggles the dialog between fullscreen and initial size
-
getAdditionalFullscreenScript
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
- Overrides:
getSession
in classorg.apache.wicket.Component
-
onDetach
protected void onDetach()- Overrides:
onDetach
in classorg.apache.wicket.markup.html.form.Form<T>
-
newFeedbackPanel
Create a feedback panel and display only messages from children components. -
getFeedbackMessagesModel
protected final org.apache.wicket.feedback.FeedbackMessagesModel getFeedbackMessagesModel() -
getAjaxIndicatorMarkupId
ImplementIAjaxIndicatorAware
, to let ajax components in the dialog trigger the ajax indicator when they trigger an ajax request.- Specified by:
getAjaxIndicatorMarkupId
in interfaceorg.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
-
setOkLabel
-
setFocusOnOk
protected void setFocusOnOk() -
setCancelEnabled
protected void setCancelEnabled(boolean isset) -
setCancelVisible
protected void setCancelVisible(boolean isset) -
setCancelLabel
-
setCancelLabel
-
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) -
setDialogService
When the dialog is shown (IDialogService.show(Dialog)
), the dialog service is injected into the dialog.- Specified by:
setDialogService
in interfaceIDialogService.Dialog
-
addButton
protected void addButton(org.apache.wicket.markup.html.form.Button button) Add aButton
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 aButton
to the button bar. The id of the button must equal "button".- Parameters:
button
- the button to addbuttonPosition
- 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
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 classorg.apache.wicket.markup.html.form.Form<T>
-
onSubmit
protected final void onSubmit()- Overrides:
onSubmit
in classorg.apache.wicket.markup.html.form.Form<T>
-
onError
protected final void onError()- Overrides:
onError
in classorg.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 correctScriptAction
inDialog.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 classDialog
.- Specified by:
onCancelFromCloseButton
in interfaceIDialogService.Dialog
-
getComponent
public org.apache.wicket.Component getComponent()- Specified by:
getComponent
in interfaceIDialogService.Dialog
- Returns:
- a component with wicket id "content"
-
onRemove
protected void onRemove()- Overrides:
onRemove
in classorg.apache.wicket.Component
-
render
Part of the pre-rendering registration. When the dialog has components that should be rendered, they can be registered with the target.Implementations must invoke
IRenderService.render(PluginRequestTarget)
on render services that contribute to the wicket component hierarchy.- Specified by:
render
in interfaceIDialogService.Dialog
-
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 interfaceIDialogService.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 interfaceIDialogService.Dialog
-
setFocus
public org.apache.wicket.Component setFocus(org.apache.wicket.Component c) -
setFocus
-
process
public void process(org.apache.wicket.markup.html.form.IFormSubmitter submittingComponent) - Overrides:
process
in classorg.apache.wicket.markup.html.form.Form<T>
-