com.googlecode.wicket.jquery.ui.widget.dialog
Class AbstractDialog<T extends Serializable>

java.lang.Object
  extended by org.apache.wicket.Component
      extended by org.apache.wicket.MarkupContainer
          extended by org.apache.wicket.markup.html.WebMarkupContainer
              extended by org.apache.wicket.markup.html.panel.Panel
                  extended by com.googlecode.wicket.jquery.core.JQueryPanel
                      extended by com.googlecode.wicket.jquery.ui.widget.dialog.AbstractDialog<T>
Type Parameters:
T - the type of the model object
All Implemented Interfaces:
IJQueryWidget, Serializable, Iterable<org.apache.wicket.Component>, org.apache.wicket.event.IEventSink, org.apache.wicket.event.IEventSource, org.apache.wicket.IClusterable, org.apache.wicket.IConverterLocator, org.apache.wicket.markup.html.IHeaderContributor, org.apache.wicket.request.component.IRequestableComponent, org.apache.wicket.util.IHierarchical<org.apache.wicket.Component>
Direct Known Subclasses:
AbstractFormDialog, FragmentDialog, MessageDialog

public abstract class AbstractDialog<T extends Serializable>
extends JQueryPanel

Base class for implementing jQuery dialogs

Author:
Sebastien Briquet - sebfz1
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.googlecode.wicket.jquery.core.IJQueryWidget
IJQueryWidget.JQueryWidget
 
Field Summary
static String LBL_CANCEL
           
static String LBL_CLOSE
           
static String LBL_NO
           
static String LBL_OK
           
static String LBL_SUBMIT
           
static String LBL_YES
           
 
Fields inherited from class com.googlecode.wicket.jquery.core.JQueryPanel
options
 
Fields inherited from class org.apache.wicket.markup.html.panel.Panel
PANEL
 
Fields inherited from class org.apache.wicket.Component
ENABLE, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER
 
Constructor Summary
AbstractDialog(String id, org.apache.wicket.model.IModel<String> title)
          Constructor
AbstractDialog(String id, org.apache.wicket.model.IModel<String> title, boolean modal)
          Constructor
AbstractDialog(String id, org.apache.wicket.model.IModel<String> title, org.apache.wicket.model.IModel<T> model)
          Constructor
AbstractDialog(String id, org.apache.wicket.model.IModel<String> title, org.apache.wicket.model.IModel<T> model, boolean modal)
          Constructor
AbstractDialog(String id, String title)
          Constructor
AbstractDialog(String id, String title, boolean modal)
          Constructor
AbstractDialog(String id, String title, org.apache.wicket.model.IModel<T> model)
          Constructor
AbstractDialog(String id, String title, org.apache.wicket.model.IModel<T> model, boolean modal)
          Constructor
 
Method Summary
 void close(org.apache.wicket.ajax.AjaxRequestTarget target, DialogButton button)
          Closes the dialogs in ajax.
 DialogButton findButton(String text)
          Finds a DialogButton - identified by its text - within the list of buttons returned by 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.
 org.apache.wicket.model.IModel<T> getModel()
          Gets the model
 T getModelObject()
          Gets the model object
 org.apache.wicket.model.IModel<String> getTitle()
          Gets the dialog's title
 int getWidth()
          Gets the dialog's with
 boolean isDefaultCloseEventEnabled()
          Indicates whether the default close event (the click on the X-icon) is enabled If true, the onClose(AjaxRequestTarget, DialogButton) event will be triggered, with a null DialogButton
 boolean isModal()
          Gets the modal flag
 boolean isResizable()
          Gets the resizable flag
protected  DialogBehavior.ButtonAjaxBehavior newButtonAjaxBehavior(IJQueryAjaxAware source, DialogButton button)
          Gets a new DialogBehavior.ButtonAjaxBehavior that will be called by the corresponding DialogButton.
This method mays be overridden internally to provide another behavior
 DialogBehavior newWidgetBehavior(String selector)
           
 void onClick(org.apache.wicket.ajax.AjaxRequestTarget target, DialogButton button)
          Triggered when a button is clicked.
 void onClose(org.apache.wicket.ajax.AjaxRequestTarget target, DialogButton button)
          Triggered when the dialog closes.
protected  void onConfigure(JQueryBehavior behavior)
          Called immediately after the onConfigure method in a behavior.
protected  void onInitialize()
           
protected  void onOpen(org.apache.wicket.ajax.AjaxRequestTarget target)
          Triggered when the dialog opens
 void open(org.apache.wicket.ajax.AjaxRequestTarget target)
          Opens the dialogs in ajax.
 void setModelObject(T object)
          Sets the model object
 void setTitle(org.apache.wicket.model.IModel<String> title)
          Sets the dialog's title
 
Methods inherited from class org.apache.wicket.markup.html.panel.Panel
newMarkupSourcingStrategy
 
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer
getWebPage, getWebRequest
 
Methods inherited from class org.apache.wicket.MarkupContainer
add, addOrReplace, autoAdd, contains, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, hasAssociatedMarkup, internalAdd, internalInitialize, iterator, iterator, onAfterRenderChildren, onComponentTagBody, onMarkupAttached, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, swap, toString, toString, visitChildren, visitChildren, visitChildren, visitChildren
 
Methods inherited from class org.apache.wicket.Component
add, addStateChange, afterRender, beforeRender, canCallListenerInterface, canCallListenerInterface, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, configure, continueToOriginalDestination, 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, getFeedbackMessage, getFeedbackMessages, getFlag, getId, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkup, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdFromMarkup, getMarkupIdImpl, getMarkupSourcingStrategy, 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, internalPrepareForRender, internalRenderComponent, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, locateMarkupStream, markRendering, modelChanged, modelChanging, onAfterRender, onBeforeRender, onComponentTag, onConfigure, onDetach, onEvent, onModelChanged, onModelChanging, onRemove, prepareForRender, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderHead, renderHead, renderHead, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setRequestFlag, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, warn, wrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LBL_OK

public static final String LBL_OK
See Also:
Constant Field Values

LBL_NO

public static final String LBL_NO
See Also:
Constant Field Values

LBL_YES

public static final String LBL_YES
See Also:
Constant Field Values

LBL_CLOSE

public static final String LBL_CLOSE
See Also:
Constant Field Values

LBL_CANCEL

public static final String LBL_CANCEL
See Also:
Constant Field Values

LBL_SUBMIT

public static final String LBL_SUBMIT
See Also:
Constant Field Values
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 dialog
model - 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 dialog
model - 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 dialog
modal - 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 dialog
modal - 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 dialog
modal - indicates whether the dialog is modal
model - 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 dialog
modal - indicates whether the dialog is modal
model - the model to be used in the dialog
Method Detail

onInitialize

protected void onInitialize()
Overrides:
onInitialize in class org.apache.wicket.Component

onConfigure

protected void onConfigure(JQueryBehavior behavior)
Called immediately after the onConfigure method in a behavior. Since this is before the rendering cycle has begun, the behavior can modify the configuration of the component (i.e. Options)

Parameters:
behavior - the JQueryBehavior

onOpen

protected void onOpen(org.apache.wicket.ajax.AjaxRequestTarget target)
Triggered when the dialog opens

Parameters:
target - the AjaxRequestTarget

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 until super.onClick(event) or close(AjaxRequestTarget, DialogButton) is called.

Parameters:
target - the AjaxRequestTarget
button - the button that closed the dialog

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

isModal

public boolean isModal()
Gets the modal flag

Returns:
the modal flag supplied to the constructor by default

isResizable

public boolean isResizable()
Gets the resizable flag

Returns:
false by default

isDefaultCloseEventEnabled

public boolean isDefaultCloseEventEnabled()
Indicates whether the default close event (the click on the X-icon) is enabled If true, the onClose(AjaxRequestTarget, DialogButton) event will be triggered, with a null DialogButton

Returns:
false by default

getModel

public org.apache.wicket.model.IModel<T> getModel()
Gets the model

Returns:
the parameterized model

getModelObject

public T getModelObject()
Gets the model object

Returns:
the typed model object

setModelObject

public void setModelObject(T object)
Sets the model object

Parameters:
object - the typed model object

findButton

public DialogButton findButton(String text)
Finds a DialogButton - identified by its text - within the list of buttons returned by getButtons()

Parameters:
text - the button's text
Returns:
the DialogButton if found, null otherwise

open

public final void open(org.apache.wicket.ajax.AjaxRequestTarget target)
Opens the dialogs in ajax.

Parameters:
target - the AjaxRequestTarget

close

public final void close(org.apache.wicket.ajax.AjaxRequestTarget target,
                        DialogButton button)
Closes the dialogs in ajax.

Parameters:
target - the AjaxRequestTarget
button - the button that closes the dialog

newWidgetBehavior

public DialogBehavior newWidgetBehavior(String selector)
Specified by:
newWidgetBehavior in interface IJQueryWidget
See Also:
IJQueryWidget.newWidgetBehavior(String)

newButtonAjaxBehavior

protected DialogBehavior.ButtonAjaxBehavior newButtonAjaxBehavior(IJQueryAjaxAware source,
                                                                  DialogButton button)
Gets a new DialogBehavior.ButtonAjaxBehavior that will be called by the corresponding DialogButton.
This method mays be overridden internally to provide another behavior

Parameters:
button - the button that is passed to the behavior so it can be retrieved via the DialogBehavior#ClickEvent

onClose

public void onClose(org.apache.wicket.ajax.AjaxRequestTarget target,
                    DialogButton button)
Triggered when the dialog closes.

Parameters:
target - the AjaxRequestTarget
button - the button that closed the dialog


Copyright © 2013 7thWeb. All Rights Reserved.