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 theIDialogService.Dialog
interface. Provides OK and Cancel buttons by default, and has support for fullscreen mode which is enabled by overridingisFullscreenEnabled
.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractDialog.ButtonPosition
protected class
AbstractDialog.ExceptionFeedbackPanel
protected static class
AbstractDialog.PersistentFeedbackMessagesModel
-
Field Summary
Fields Modifier and Type Field Description protected boolean
cancelled
protected org.apache.wicket.markup.html.panel.FeedbackPanel
feedback
protected AbstractDialog.PersistentFeedbackMessagesModel
feedbackMessages
-
Constructor Summary
Constructors Constructor Description AbstractDialog()
AbstractDialog(org.apache.wicket.model.IModel<T> model)
-
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 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 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()
ImplementIAjaxIndicatorAware
, 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 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)
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.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, 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 java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
feedbackMessages
protected AbstractDialog.PersistentFeedbackMessagesModel feedbackMessages
-
feedback
protected org.apache.wicket.markup.html.panel.FeedbackPanel feedback
-
cancelled
protected boolean cancelled
-
-
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 interfaceorg.apache.wicket.event.IEventSink
- Overrides:
onEvent
in classorg.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 overridinggetAdditionalFullscreenScript
- 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 classorg.apache.wicket.Component
-
onDetach
protected void onDetach()
- Overrides:
onDetach
in classorg.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()
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
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)
-
setDialogService
public void setDialogService(IDialogService dialogService)
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
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 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
public void render(PluginRequestTarget target)
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
public AjaxUpdatingWidget<?> setFocus(AjaxUpdatingWidget<?> widget)
-
process
public void process(org.apache.wicket.markup.html.form.IFormSubmitter submittingComponent)
- Overrides:
process
in classorg.apache.wicket.markup.html.form.Form<T>
-
-