Class AbstractDialog<T extends Serializable>
- 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>
-
- com.googlecode.wicket.jquery.ui.widget.dialog.AbstractDialog<T>
-
- Type Parameters:
T
- the type of the model object
- All Implemented Interfaces:
com.googlecode.wicket.jquery.core.IJQueryWidget
,IDialogListener
,Serializable
,Iterable<org.apache.wicket.Component>
,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.panel.GenericPanel<T>>
,org.apache.wicket.IMetadataContext<Serializable,org.apache.wicket.Component>
,org.apache.wicket.IQueueRegion
,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
- Direct Known Subclasses:
AbstractFormDialog
,FragmentDialog
,MessageDialog
public abstract class AbstractDialog<T extends Serializable> extends org.apache.wicket.markup.html.panel.GenericPanel<T> implements com.googlecode.wicket.jquery.core.IJQueryWidget, IDialogListener
Base class for implementing jQuery dialogs- Author:
- Sebastien Briquet - sebfz1
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
CANCEL
static String
CLOSE
static org.apache.wicket.model.IModel<String>
LBL_CANCEL
static org.apache.wicket.model.IModel<String>
LBL_CLOSE
static org.apache.wicket.model.IModel<String>
LBL_NO
static org.apache.wicket.model.IModel<String>
LBL_OK
static org.apache.wicket.model.IModel<String>
LBL_SUBMIT
static org.apache.wicket.model.IModel<String>
LBL_YES
static String
NO
static String
OK
static String
SUBMIT
static String
YES
-
Constructor Summary
Constructors Constructor Description AbstractDialog(String id, String title)
ConstructorAbstractDialog(String id, String title, boolean modal)
ConstructorAbstractDialog(String id, String title, org.apache.wicket.model.IModel<T> model)
ConstructorAbstractDialog(String id, String title, org.apache.wicket.model.IModel<T> model, boolean modal)
ConstructorAbstractDialog(String id, org.apache.wicket.model.IModel<String> title)
ConstructorAbstractDialog(String id, org.apache.wicket.model.IModel<String> title, boolean modal)
ConstructorAbstractDialog(String id, org.apache.wicket.model.IModel<String> title, org.apache.wicket.model.IModel<T> model)
ConstructorAbstractDialog(String id, org.apache.wicket.model.IModel<String> title, org.apache.wicket.model.IModel<T> model, boolean modal)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close(org.apache.wicket.core.request.handler.IPartialPageRequestHandler handler, DialogButton button)
Closes the dialogs in ajax/websocket.DialogButton
findButton(String name)
Finds aDialogButton
- identified by its name - within the list of buttons returned bygetButtons()
protected List<DialogButton>
getButtons()
Gets the dialog's buttons.
It is allowed to return a predefined list (ie: DialogButtons#OK_CANCEL#toList()) as long as the buttons state (enable and/or visible) are not modified
Warning: It is not legal to create the buttons to be returned in this method.org.apache.wicket.model.IModel<String>
getTitle()
Gets the dialog's titleint
getWidth()
Gets the dialog's withboolean
isDefaultCloseEventEnabled()
Indicates whether the default close event (the click on the X-icon) is enabled If true, theIDialogListener.onClose(IPartialPageRequestHandler, DialogButton)
event will be triggered, with a nullDialogButton
boolean
isEscapeCloseEventEnabled()
Indicates whether the escape close event (pressing escape key) is enabled If true, theIDialogListener.onClose(IPartialPageRequestHandler, DialogButton)
event will be triggered, with a nullDialogButton
boolean
isModal()
Gets the modal flagboolean
isResizable()
Indicates whether the dialog is resizableprotected ButtonAjaxBehavior
newButtonAjaxBehavior(com.googlecode.wicket.jquery.core.ajax.IJQueryAjaxAware source, DialogButton button)
Gets a newButtonAjaxBehavior
that will be called by the correspondingDialogButton
.
This method may be overridden to provide additional behaviorsprotected IDialogListener
newDialogListenerWrapper()
Gets a newIDialogListener
that allow to redirectIDialogListener.onClick(AjaxRequestTarget, DialogButton)
tointernalOnClick(AjaxRequestTarget, DialogButton)
DialogBehavior
newWidgetBehavior(String selector)
void
onBeforeRender(com.googlecode.wicket.jquery.core.JQueryBehavior behavior)
void
onClick(org.apache.wicket.ajax.AjaxRequestTarget target, DialogButton button)
Triggered when a button is clicked
This method may be overridden to handle button behaviors, but the dialog will not been closed untilsuper.onClick(event)
orclose(IPartialPageRequestHandler, DialogButton)
is called.void
onConfigure(com.googlecode.wicket.jquery.core.JQueryBehavior behavior)
protected void
onDetach()
protected void
onInitialize()
protected void
onOpen(org.apache.wicket.core.request.handler.IPartialPageRequestHandler handler)
Triggered when the dialog opensvoid
open(org.apache.wicket.core.request.handler.IPartialPageRequestHandler handler)
Opens the dialogs in ajax.void
setTitle(org.apache.wicket.core.request.handler.IPartialPageRequestHandler handler, String title)
Sets the dialog's title dynamicallyvoid
setTitle(org.apache.wicket.core.request.handler.IPartialPageRequestHandler handler, org.apache.wicket.model.IModel<String> title)
Sets the dialog's title dynamicallyvoid
setTitle(org.apache.wicket.model.IModel<String> title)
Sets the dialog's title-
Methods inherited from class org.apache.wicket.markup.html.panel.Panel
getRegionMarkup, newMarkupSourcingStrategy
-
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, internalAdd, internalInitialize, iterator, iterator, newDequeueContext, onComponentTagBody, 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, 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, onComponentTag, onConfigure, onEvent, onModelChanged, onModelChanging, onReAdd, onRemove, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderHead, 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, wrap
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.googlecode.wicket.jquery.ui.widget.dialog.IDialogListener
onClose
-
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
-
OK
public static final String OK
- See Also:
- Constant Field Values
-
NO
public static final String NO
- See Also:
- Constant Field Values
-
YES
public static final String YES
- See Also:
- Constant Field Values
-
CLOSE
public static final String CLOSE
- See Also:
- Constant Field Values
-
CANCEL
public static final String CANCEL
- See Also:
- Constant Field Values
-
SUBMIT
public static final String SUBMIT
- See Also:
- Constant Field Values
-
LBL_OK
public static final org.apache.wicket.model.IModel<String> LBL_OK
-
LBL_NO
public static final org.apache.wicket.model.IModel<String> LBL_NO
-
LBL_YES
public static final org.apache.wicket.model.IModel<String> LBL_YES
-
LBL_CLOSE
public static final org.apache.wicket.model.IModel<String> LBL_CLOSE
-
LBL_CANCEL
public static final org.apache.wicket.model.IModel<String> LBL_CANCEL
-
LBL_SUBMIT
public static final org.apache.wicket.model.IModel<String> LBL_SUBMIT
-
-
Constructor Detail
-
AbstractDialog
public AbstractDialog(String id, String title)
Constructor- Parameters:
id
- the markupId, an html div suffice to host a dialog.title
- the title of the dialog
-
AbstractDialog
public AbstractDialog(String id, org.apache.wicket.model.IModel<String> title)
Constructor- Parameters:
id
- the markupId, an html div suffice to host a dialog.title
- the title of the dialog
-
AbstractDialog
public AbstractDialog(String id, String title, org.apache.wicket.model.IModel<T> model)
Constructor- Parameters:
id
- the markupId, an html div suffice to host a dialog.title
- the title of the dialogmodel
- the model to be used in the dialog.
-
AbstractDialog
public AbstractDialog(String id, org.apache.wicket.model.IModel<String> title, org.apache.wicket.model.IModel<T> model)
Constructor- Parameters:
id
- the markupId, an html div suffice to host a dialog.title
- the title of the dialogmodel
- the model to be used in the dialog.
-
AbstractDialog
public AbstractDialog(String id, String title, boolean modal)
Constructor- Parameters:
id
- the markupId, an html div suffice to host a dialog.title
- the title of the dialogmodal
- indicates whether the dialog is modal
-
AbstractDialog
public AbstractDialog(String id, org.apache.wicket.model.IModel<String> title, boolean modal)
Constructor- Parameters:
id
- the markupId, an html div suffice to host a dialog.title
- the title of the dialogmodal
- indicates whether the dialog is modal
-
AbstractDialog
public AbstractDialog(String id, String title, org.apache.wicket.model.IModel<T> model, boolean modal)
Constructor- Parameters:
id
- markupId, an html div suffice to host a dialog.title
- the title of the dialogmodal
- indicates whether the dialog is modalmodel
- the model to be used in the dialog
-
AbstractDialog
public AbstractDialog(String id, org.apache.wicket.model.IModel<String> title, org.apache.wicket.model.IModel<T> model, boolean modal)
Constructor- Parameters:
id
- markupId, an html div suffice to host a dialog.title
- the title of the dialogmodal
- indicates whether the dialog is modalmodel
- the model to be used in the dialog
-
-
Method Detail
-
onInitialize
protected void onInitialize()
- Overrides:
onInitialize
in classorg.apache.wicket.MarkupContainer
-
onConfigure
public void onConfigure(com.googlecode.wicket.jquery.core.JQueryBehavior behavior)
- Specified by:
onConfigure
in interfacecom.googlecode.wicket.jquery.core.IJQueryWidget
-
onBeforeRender
public void onBeforeRender(com.googlecode.wicket.jquery.core.JQueryBehavior behavior)
- Specified by:
onBeforeRender
in interfacecom.googlecode.wicket.jquery.core.IJQueryWidget
-
onOpen
protected void onOpen(org.apache.wicket.core.request.handler.IPartialPageRequestHandler handler)
Triggered when the dialog opens- Parameters:
handler
- theIPartialPageRequestHandler
-
onClick
public void onClick(org.apache.wicket.ajax.AjaxRequestTarget target, DialogButton button)
Triggered when a button is clicked
This method may be overridden to handle button behaviors, but the dialog will not been closed untilsuper.onClick(event)
orclose(IPartialPageRequestHandler, DialogButton)
is called.- Specified by:
onClick
in interfaceIDialogListener
- Parameters:
target
- theAjaxRequestTarget
button
- the button that closed the dialog
-
onDetach
protected void onDetach()
- Overrides:
onDetach
in classorg.apache.wicket.MarkupContainer
-
getButtons
protected List<DialogButton> getButtons()
Gets the dialog's buttons.
It is allowed to return a predefined list (ie: DialogButtons#OK_CANCEL#toList()) as long as the buttons state (enable and/or visible) are not modified
Warning: It is not legal to create the buttons to be returned in this method.- Returns:
btnOk
by default
-
getWidth
public int getWidth()
Gets the dialog's with- Returns:
WIDTH
by default
-
getTitle
public org.apache.wicket.model.IModel<String> getTitle()
Gets the dialog's title- Returns:
- the dialog's title
-
setTitle
public void setTitle(org.apache.wicket.model.IModel<String> title)
Sets the dialog's title- Parameters:
title
- the dialog's title
-
setTitle
public void setTitle(org.apache.wicket.core.request.handler.IPartialPageRequestHandler handler, String title)
Sets the dialog's title dynamically- Parameters:
handler
- theIPartialPageRequestHandler
title
- the dialog's title
-
setTitle
public void setTitle(org.apache.wicket.core.request.handler.IPartialPageRequestHandler handler, org.apache.wicket.model.IModel<String> title)
Sets the dialog's title dynamically- Parameters:
handler
- theIPartialPageRequestHandler
title
- the dialog's title
-
isModal
public boolean isModal()
Gets the modal flag- Returns:
- the modal flag supplied to the constructor by default
-
isResizable
public boolean isResizable()
Indicates whether the dialog is resizable- Returns:
- false by default
-
isDefaultCloseEventEnabled
public boolean isDefaultCloseEventEnabled()
Description copied from interface:IDialogListener
Indicates whether the default close event (the click on the X-icon) is enabled If true, theIDialogListener.onClose(IPartialPageRequestHandler, DialogButton)
event will be triggered, with a nullDialogButton
- Specified by:
isDefaultCloseEventEnabled
in interfaceIDialogListener
- Returns:
- false by default
-
isEscapeCloseEventEnabled
public boolean isEscapeCloseEventEnabled()
Description copied from interface:IDialogListener
Indicates whether the escape close event (pressing escape key) is enabled If true, theIDialogListener.onClose(IPartialPageRequestHandler, DialogButton)
event will be triggered, with a nullDialogButton
- Specified by:
isEscapeCloseEventEnabled
in interfaceIDialogListener
- Returns:
- false by default
-
findButton
public DialogButton findButton(String name)
Finds aDialogButton
- identified by its name - within the list of buttons returned bygetButtons()
- Parameters:
name
- the button's name- Returns:
- the
DialogButton
if found, null otherwise
-
open
public final void open(org.apache.wicket.core.request.handler.IPartialPageRequestHandler handler)
Opens the dialogs in ajax.- Parameters:
handler
- theIPartialPageRequestHandler
-
close
public final void close(org.apache.wicket.core.request.handler.IPartialPageRequestHandler handler, DialogButton button)
Closes the dialogs in ajax/websocket.- Parameters:
handler
- theIPartialPageRequestHandler
button
- the button that closes the dialog
-
newWidgetBehavior
public DialogBehavior newWidgetBehavior(String selector)
- Specified by:
newWidgetBehavior
in interfacecom.googlecode.wicket.jquery.core.IJQueryWidget
- See Also:
IJQueryWidget.newWidgetBehavior(String)
-
newDialogListenerWrapper
protected final IDialogListener newDialogListenerWrapper()
Gets a newIDialogListener
that allow to redirectIDialogListener.onClick(AjaxRequestTarget, DialogButton)
tointernalOnClick(AjaxRequestTarget, DialogButton)
- Returns:
- a new
DialogListenerWrapper
-
newButtonAjaxBehavior
protected ButtonAjaxBehavior newButtonAjaxBehavior(com.googlecode.wicket.jquery.core.ajax.IJQueryAjaxAware source, DialogButton button)
Gets a newButtonAjaxBehavior
that will be called by the correspondingDialogButton
.
This method may be overridden to provide additional behaviors- Parameters:
source
- theIJQueryAjaxAware
sourcebutton
- the button that is passed to the behavior so it can be retrieved via theButtonAjaxBehavior.ClickEvent
- Returns:
- the
ButtonAjaxBehavior
-
-