Module wicket.bootstrap.core
Class Modal<T>
java.lang.Object
org.apache.wicket.Component
org.apache.wicket.MarkupContainer
org.apache.wicket.markup.html.WebMarkupContainer
org.apache.wicket.markup.html.panel.Panel
org.apache.wicket.markup.html.panel.GenericPanel<T>
de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal<T>
- All Implemented Interfaces:
Serializable,Iterable<Component>,IEventSink,IEventSource,IFeedbackContributor,IConverterLocator,IGenericComponent<T,,GenericPanel<T>> IMetadataContext<Serializable,,Component> IQueueRegion,IHeaderContributor,IRequestableComponent,IHierarchical<Component>,IClusterable
- Direct Known Subclasses:
TextContentModal
The
Modal dialog is a simple component with header,
footer and body.- Author:
- miha
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enumstatic enum -
Field Summary
FieldsFields 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadds a button to footer section.adds a close button with default label ("Close")addCloseButton(IModel<String> label) adds a close button with specific labeladdOpenerAttributesTo(Component component) Append dialog close/hide JavaScript to current AJAX request target.Append dialog show JavaScript to current request AJAX target.close(IPartialPageRequestHandler target) protected StringcreateActionScript(String markupId, String action) creates an action script to open/close the dialog on client side.protected StringcreateBasicInitializerScript(String markupId) creates the basic initialization script of the modal dialog.protected WebMarkupContainercreateDialog(String id) Creates a container for the 'modal-dialog' div.protected MarkupContainercreateFooter(String id) Factory method for the Modal's footerprotected MarkupContainercreateHeader(String id) Factory method for the Modal's headerprotected ComponentFactory method for the Modal's header 'closebutton' By default it generates the markup for original Bootstrap Modal closebuttonprotected ComponentcreateHeaderLabel(String id, String label) Factory method for the Modal's header labelfullscreen(Modal.Fullscreen fullscreen) Sets fullscreen modal.Sets the header label text.Sets the header label text and whether model strings should be escaped.protected voidonClose(IPartialPageRequestHandler target) hook to react on modal close event.protected voidprotected voidprotected voidvoidrenderHead(IHeaderResponse response) setBackdrop(Modal.Backdrop backdrop) Sets a flag that decides whether using the ESC keyboard key will close this modalsetCloseOnEscapeKey(boolean close) Sets a flag that decides whether using the ESC keyboard key will close this modalsetDisableEnforceFocus(boolean disable) Whether the modal should not enforce the focus.setFadeIn(boolean fadein) Whether to fadein/fadeout the modal dialog or notsetFooterVisible(boolean visible) Sets whether the footer and any children are visible.setHeaderVisible(boolean visible) Sets whether the header and any children are visible.setUseCloseHandler(boolean useCloseHandler) Sets whether the close handler is used or not.setUseKeyboard(boolean keyboard) Whether to enable keyboard interaction like ESC to close the dialog.show(boolean show) Sets the initial visibility of the modal dialog.show(IPartialPageRequestHandler target) protected final booleansize(Modal.Size size) Sets the size of the modal.protected final booleanprotected final booleanMethods inherited from class org.apache.wicket.markup.html.panel.Panel
getRegionMarkup, newMarkupSourcingStrategyMethods inherited from class org.apache.wicket.markup.html.WebMarkupContainer
getWebApplication, getWebPage, getWebRequest, getWebResponse, getWebSessionMethods inherited from class org.apache.wicket.MarkupContainer
add, addDequeuedComponent, addOrReplace, autoAdd, canDequeueTag, contains, dequeue, dequeue, dequeuePreamble, findChildComponent, findComponentToDequeue, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, internalAdd, internalInitialize, iterator, iterator, newDequeueContext, onComponentTagBody, onDetach, onRender, queue, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, stream, streamChildren, toString, toString, visitChildren, visitChildrenMethods 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, getSession, getSizeInBytes, getStatelessHint, getString, getString, getString, getStyle, getVariation, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, initModel, internalOnModelChanged, internalRenderComponent, internalRenderHead, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isInitialized, isRenderAllowed, isRendering, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, markRendering, modelChanged, modelChanging, onAfterRender, onBeforeRender, onEvent, onModelChanged, onModelChanging, onReAdd, onRemove, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderPart, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlForListener, urlForListener, visitParents, visitParents, warn, wrapMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.wicket.IGenericComponent
getDefaultModel, getDefaultModelObject, getModel, getModelObject, setDefaultModel, setDefaultModelObject, setModel, setModelObjectMethods inherited from interface org.apache.wicket.IQueueRegion
dequeue, newDequeueContextMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
BUTTON_MARKUP_ID
- See Also:
-
-
Constructor Details
-
Modal
Constructor.- Parameters:
markupId- The non-null id of this component
-
Modal
Constructor.- Parameters:
id- The non-null id of this componentmodel- The component's body model
-
-
Method Details
-
onInitialize
protected void onInitialize()- Overrides:
onInitializein classMarkupContainer
-
createHeaderCloseButton
Factory method for the Modal's header 'closebutton' By default it generates the markup for original Bootstrap Modal closebutton- Parameters:
id- The component id- Returns:
- the close button
-
createHeaderLabel
Factory method for the Modal's header label- Parameters:
id- The component id- Returns:
- The header label
-
createHeader
Factory method for the Modal's header- Parameters:
id- The component id- Returns:
- The header container
-
createDialog
Creates a container for the 'modal-dialog' div. It is used to set the size of the modal.- Parameters:
id- The component id- Returns:
- The dialog container
-
size
Sets the size of the modal.- Parameters:
size- The size of the modal dialog.- Returns:
this, for method chaining
-
fullscreen
Sets fullscreen modal.- Parameters:
fullscreen- Fullscreen mode of the modal dialog.- Returns:
this, for method chaining
-
onComponentTag
- Overrides:
onComponentTagin classComponent
-
onClose
hook to react on modal close event.- Parameters:
target- The currentIPartialPageRequestHandler
-
header
Sets the header label text.- Parameters:
label- The header label- Returns:
- This
-
header
Sets the header label text and whether model strings should be escaped.- Parameters:
label- The header labelescapeMarkup- True is model strings should be escaped- Returns:
- This
-
setHeaderVisible
Sets whether the header and any children are visible.- Parameters:
visible- True if header and any children should be visible- Returns:
- This
-
setUseCloseHandler
Sets whether the close handler is used or not. Default is false.- Parameters:
useCloseHandler- True if close handler should be used- Returns:
- This
-
show
Sets the initial visibility of the modal dialog.- Parameters:
show- Whether to show the dialog or not- Returns:
- This
-
setCloseOnEscapeKey
Sets a flag that decides whether using the ESC keyboard key will close this modal- Parameters:
close- The flag that is used to decide whether to close on ESC or not- Returns:
- This
-
setBackdrop
Sets a flag that decides whether using the ESC keyboard key will close this modal- Parameters:
backdrop- Includes a modal-backdrop element. Alternatively, specify static for a backdrop which doesn't close the modal on click.- Returns:
- This
-
appendCloseDialogJavaScript
Append dialog close/hide JavaScript to current AJAX request target.- Parameters:
target- The Ajax request handler- Returns:
- This instance, for chaining
-
close
A short alias forappendCloseDialogJavaScript(org.apache.wicket.core.request.handler.IPartialPageRequestHandler)- Parameters:
target- The Ajax request handler- Returns:
- This instance, for chaining
-
appendShowDialogJavaScript
Append dialog show JavaScript to current request AJAX target.- Parameters:
target- current ajax request target- Returns:
- this instance for chaining
-
show
A short alias forappendShowDialogJavaScript(org.apache.wicket.core.request.handler.IPartialPageRequestHandler)- Parameters:
target- The Ajax request handler- Returns:
- This instance, for chaining
-
createActionScript
creates an action script to open/close the dialog on client side.- Parameters:
markupId- The component's markup idaction- Possible values: show/hide- Returns:
- new script.
-
addOpenerAttributesTo
-
addCloseButton
adds a close button with specific label- Parameters:
label- The label of close button- Returns:
- this instance
-
addCloseButton
adds a close button with default label ("Close")- Returns:
- this instance
-
addButton
adds a button to footer section.- Parameters:
button- Button to add to footer- Returns:
- this instance.
-
onConfigure
protected void onConfigure()- Overrides:
onConfigurein classComponent
-
renderHead
- Specified by:
renderHeadin interfaceIHeaderContributor- Overrides:
renderHeadin classComponent
-
createBasicInitializerScript
creates the basic initialization script of the modal dialog. Override this to pass in your custom initialization, add event handlers, etc.- Parameters:
markupId- markup id- Returns:
- initializer script
-
useFadein
protected final boolean useFadein()- Returns:
- true, if fade in animation is activated
-
useKeyboard
protected final boolean useKeyboard()- Returns:
- true, if keyboard usage is activated
-
showImmediately
protected final boolean showImmediately()- Returns:
- true, if modal dialog should be shown after initialization
-
setFadeIn
Whether to fadein/fadeout the modal dialog or not- Parameters:
fadein- true, if dialog should be animated- Returns:
- This
-
setUseKeyboard
Whether to enable keyboard interaction like ESC to close the dialog.- Parameters:
keyboard- true, if keyboard interaction is enabled- Returns:
- This
-
setDisableEnforceFocus
Whether the modal should not enforce the focus.- Parameters:
disable- true, if the modal should not enforce the focus- Returns:
- This instance, for chaining
-