org.odlabs.wiquery.ui.dialog
Class Dialog

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.odlabs.wiquery.ui.dialog.Dialog
All Implemented Interfaces:
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>, IWiQueryPlugin

public class Dialog
extends org.apache.wicket.markup.html.WebMarkupContainer
implements IWiQueryPlugin

$Id$

Displays a window wrapping this WebMarkupContainer markup.

This UI component is built from this WebMarkupContainer's HTML markup. The correct markup should be a div HTML element wrapping the contents to display in this window.

Example:

   <div wicket:id="id" title="The window title">
     The wrapped content
   </div>
 

Since:
0.5
Author:
Lionel Armanet, Ernesto Reinaldo Barreiro (reiern70@gmail.com)
See Also:
Serialized Form

Nested Class Summary
static class Dialog.DialogAjaxBehavior
          This class is only need to make public the method generateCallbackScript.
static class Dialog.WindowPosition
          Eumeration of possible window position
 
Field Summary
static String BUTTON_ID
           
 
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
Dialog(String id)
          Builds a new instance of Dialog for the given wicket id.
 
Method Summary
 JsStatement close()
          Method to close the dialog
 void close(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
          Method to close the dialog within the ajax request
 JsStatement destroy()
          Method to destroy the dialog This will return the element back to its pre-init state.
 void destroy(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
          Method to destroy the dialog within the ajax request
protected  void detachModel()
           
 JsStatement disable()
          Method to disable the dialog
 void disable(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
          Method to disable the dialog within the ajax request
 JsStatement enable()
          Method to enable the dialog
 void enable(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
          Method to enable the dialog within the ajax request
 Dialog.DialogAjaxBehavior getAjaxBehavior()
           
 ListItemOptions<DialogButton> getButtons()
           
 String getCloseText()
           
 String getCssClass()
          Returns the css class applied to customize this window.
 String getDialogClass()
           
 int getHeight()
          Returns the window's height.
 String getHideEffect()
           
 int getMaxHeight()
          Returns the window's max height.
 int getMaxWidth()
          Returns the window's max width.
 int getMinHeight()
          Returns the window's min height.
 int getMinWidth()
          Returns the window's max width.
protected  Options getOptions()
          Method retrieving the options of the component
 Dialog.WindowPosition getPosition()
          Returns the Dialog.WindowPosition.
 String getShowEffect()
           
 String getTitle()
          Returns the window's title.
 int getWidth()
          Returns the dialog's width.
 int getZIndex()
           
 boolean isAutoOpen()
           
 boolean isBgiframe()
          Deprecated. will be removed in 1.3
 boolean isCloseOnEscape()
           
 boolean isDisabled()
           
 boolean isDraggable()
           
 boolean isDraggrable()
          Deprecated. will be removed is 1.2
static boolean isEmpty(String str)
           
 boolean isModal()
           
 JsStatement isOpen()
          Method returning true if the dialog is currently open
 boolean isResizable()
          Returns true if this window is resizable.
 boolean isStack()
           
 JsStatement moveToTop()
          Method to move to top the dialog
 void moveToTop(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
          Method to move to top the dialog within the ajax request
 JsStatement open()
          Method to open the dialog
 void open(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
          Method to open the dialog within the ajax request
 void renderHead(org.apache.wicket.markup.html.IHeaderResponse response)
           
 Dialog setAutoOpen(boolean autoOpen)
          Sets if this window opens autmatically after the page is loaded.
 Dialog setBeforeCloseEvent(JsScopeUiEvent beforeclose)
          Deprecated. will be removed when we will used jquery ui 1.9 (see ticket http://dev.jqueryui.com/ticket/4669)
 Dialog setBgiframe(boolean bgiframe)
          Deprecated. will be removed in 1.3
 Dialog setButtons(DialogButton... buttons)
          Set's a list of dialog button
 Dialog setButtons(ListItemOptions<DialogButton> buttons)
          Set's a list of dialog button
 Dialog setCloseEvent(JsScopeUiEvent close)
          Set's the callback before the dialog is closed.
 Dialog setCloseOnEscape(boolean closeOnEscape)
          Set's the close on escape keyboard shortcut
 Dialog setCloseText(String closeText)
          Sets a the text for the close button
 Dialog setCssClass(String cssClass)
          Sets a css class to customize the window's display.
 Dialog setDialogClass(String dialogClass)
          The specified class name(s) will be added to the dialog, for additional theming.
 Dialog setDisabled(boolean disabled)
          Disables (true) or enables (false) the dialog.
 Dialog setDragEvent(JsScopeUiEvent drag)
          Set's the callback when the dialog is dragged.
 Dialog setDraggable(boolean draggable)
          Enable or disable the draggable event
 Dialog setDragStartEvent(JsScopeUiEvent dragStart)
          Set's the callback when the dialog is being dragged.
 Dialog setDragStopEvent(JsScopeUiEvent dragStop)
          Set's the callback when the dialog has been dragged.
 Dialog setFocusEvent(JsScopeUiEvent focus)
          Set's the callback when the dialog gains focus.
 Dialog setHeight(int height)
          Sets the window's height.
 Dialog setHideEffect(String hideEffect)
          Sets the effect used when the window closes.
 Dialog setMaxHeight(int maxHeight)
          Sets the window's max height.
 Dialog setMaxWidth(int maxWidth)
          Sets the window's max width.
 Dialog setMinHeight(int minHeight)
          Sets the window's min height.
 Dialog setMinWidth(int minWidth)
          Sets the window's min width.
 Dialog setModal(boolean modal)
          Sets if this window is modal or not.
 Dialog setOpenEvent(JsScopeUiEvent open)
          Set's the callback before the dialog is opening.
 Dialog setOverlayRatio(float ratio)
          Deprecated. will be removed in 1.3
 Dialog setPosition(Dialog.WindowPosition windowPosition)
          Sets the window's position.
 Dialog setResizable(boolean resizable)
          Sets if this window is resizable or not.
 Dialog setResizeEvent(JsScopeUiEvent resize)
          Set's the callback when the dialog is resized.
 Dialog setResizeStartEvent(JsScopeUiEvent resizeStart)
          Set's the callback when the dialog is being resized.
 Dialog setResizeStopEvent(JsScopeUiEvent resizeStop)
          Set's the callback when the dialog has been resized.
 Dialog setShowEffect(String hideEffect)
          Sets the effect used when the window shows itself.
 Dialog setStack(boolean stack)
          Specifies whether the dialog will stack on top of other dialogs.
 Dialog setTitle(org.apache.wicket.model.IModel<String> title)
          Sets the window's title.
 Dialog setTitle(String title)
          Sets the window's title.
 Dialog setWidth(int width)
          Sets the window's width.
 Dialog setZIndex(int zIndex)
          Set's the starting z-index
 JsStatement statement()
          Returns the main JsStatement used to create the plugin.
 JsStatement widget()
          Method to returns the .ui-dialog element
 void widget(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
          Method to returns the .ui-dialog element within the ajax request
 
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, 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, newMarkupSourcingStrategy, onAfterRender, onBeforeRender, onComponentTag, onConfigure, onDetach, onEvent, onInitialize, onModelChanged, onModelChanging, onRemove, prepareForRender, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, 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

BUTTON_ID

public static final String BUTTON_ID
See Also:
Constant Field Values
Constructor Detail

Dialog

public Dialog(String id)
Builds a new instance of Dialog for the given wicket id.

Parameters:
id - the given wicket id.
Method Detail

isEmpty

public static boolean isEmpty(String str)

detachModel

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

renderHead

public void renderHead(org.apache.wicket.markup.html.IHeaderResponse response)
Specified by:
renderHead in interface org.apache.wicket.markup.html.IHeaderContributor
Overrides:
renderHead in class org.apache.wicket.Component

statement

public JsStatement statement()
Description copied from interface: IWiQueryPlugin
Returns the main JsStatement used to create the plugin.

Specified by:
statement in interface IWiQueryPlugin
Returns:
The JsStatement corresponding to this component.

getOptions

protected Options getOptions()
Method retrieving the options of the component

Returns:
the options

open

public JsStatement open()
Method to open the dialog

Returns:
the associated JsStatement

close

public JsStatement close()
Method to close the dialog

Returns:
the associated JsStatement

open

public void open(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to open the dialog within the ajax request

Parameters:
ajaxRequestTarget -

close

public void close(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to close the dialog within the ajax request

Parameters:
ajaxRequestTarget -

setAutoOpen

public Dialog setAutoOpen(boolean autoOpen)
Sets if this window opens autmatically after the page is loaded.

Parameters:
autoOpen - true if the window auto opens, false otherwise
Returns:
instance of the current component

setModal

public Dialog setModal(boolean modal)
Sets if this window is modal or not.

Parameters:
modal - true if the window is modal, false otherwise
Returns:
instance of the current component

setOverlayRatio

@Deprecated
public Dialog setOverlayRatio(float ratio)
Deprecated. will be removed in 1.3

Sets the overlay under the window. This parameter will take effect only if the setModal(boolean) method is call with true.

Parameters:
ratio - a float value between 0 and 1 (1 is 100% black overlay)
Returns:
instance of the current component

isAutoOpen

public boolean isAutoOpen()
Returns:
if this window auto opens on page loading.

isModal

public boolean isModal()
Returns:
if this window is modal.

setWidth

public Dialog setWidth(int width)
Sets the window's width.

Returns:
instance of the current component

getWidth

public int getWidth()
Returns the dialog's width.


setHeight

public Dialog setHeight(int height)
Sets the window's height.

Returns:
instance of the current component

getHeight

public int getHeight()
Returns the window's height.


setPosition

public Dialog setPosition(Dialog.WindowPosition windowPosition)
Sets the window's position.

Returns:
instance of the current component

getPosition

public Dialog.WindowPosition getPosition()
Returns the Dialog.WindowPosition.


setCloseText

public Dialog setCloseText(String closeText)
Sets a the text for the close button

Returns:
instance of the current component

getCloseText

public String getCloseText()
Returns:
the closeText option

setCssClass

public Dialog setCssClass(String cssClass)
Sets a css class to customize the window's display.

Returns:
instance of the current component

getCssClass

public String getCssClass()
Returns the css class applied to customize this window.


setHideEffect

public Dialog setHideEffect(String hideEffect)
Sets the effect used when the window closes.

Parameters:
hideEffect - String with the given effect's name.
Returns:
instance of the current component

getHideEffect

public String getHideEffect()
Returns:
the hide option value

setShowEffect

public Dialog setShowEffect(String hideEffect)
Sets the effect used when the window shows itself.

Parameters:
hideEffect - String with the given effect's name.
Returns:
instance of the current component

getShowEffect

public String getShowEffect()
Returns:
the show option value

setMaxHeight

public Dialog setMaxHeight(int maxHeight)
Sets the window's max height.

Returns:
instance of the current component

getMaxHeight

public int getMaxHeight()
Returns the window's max height.


setMaxWidth

public Dialog setMaxWidth(int maxWidth)
Sets the window's max width.

Returns:
instance of the current component

getMaxWidth

public int getMaxWidth()
Returns the window's max width.


setMinHeight

public Dialog setMinHeight(int minHeight)
Sets the window's min height.

Returns:
instance of the current component

getMinHeight

public int getMinHeight()
Returns the window's min height.


setMinWidth

public Dialog setMinWidth(int minWidth)
Sets the window's min width.

Returns:
instance of the current component

getMinWidth

public int getMinWidth()
Returns the window's max width.


setResizable

public Dialog setResizable(boolean resizable)
Sets if this window is resizable or not.

Returns:
instance of the current component

isResizable

public boolean isResizable()
Returns true if this window is resizable.


setTitle

public Dialog setTitle(String title)
Sets the window's title.

Note: the title can be automatically sets when the HTML title attribute is set.

Returns:
instance of the current component

setTitle

public Dialog setTitle(org.apache.wicket.model.IModel<String> title)
Sets the window's title.

Note: the title can be automatically sets when the HTML title attribute is set.

Returns:
instance of the current component

getTitle

public String getTitle()
Returns the window's title.

Returns:
a non null String containing the window's title.

setCloseOnEscape

public Dialog setCloseOnEscape(boolean closeOnEscape)
Set's the close on escape keyboard shortcut

Parameters:
closeOnEscape -
Returns:
instance of the current component

isCloseOnEscape

public boolean isCloseOnEscape()

setBgiframe

@Deprecated
public Dialog setBgiframe(boolean bgiframe)
Deprecated. will be removed in 1.3

Set's the bgiframe plugin. When true, the bgiframe plugin will be used, to fix the issue in IE6 where select boxes show on top of other elements, regardless of zIndex. Requires including the bgiframe plugin. Future versions may not require a separate plugin.

Parameters:
bgiframe -
Returns:
instance of the current component

isBgiframe

@Deprecated
public boolean isBgiframe()
Deprecated. will be removed in 1.3


setDialogClass

public Dialog setDialogClass(String dialogClass)
The specified class name(s) will be added to the dialog, for additional theming.

Returns:
instance of the current component

getDialogClass

public String getDialogClass()
Returns:
the dialogClass option

setDisabled

public Dialog setDisabled(boolean disabled)
Disables (true) or enables (false) the dialog. Can be set when initialising (first creating) the dialog.

Parameters:
disabled -
Returns:
instance of the current behavior

isDisabled

public boolean isDisabled()
Returns:
the disabled option

setDraggable

public Dialog setDraggable(boolean draggable)
Enable or disable the draggable event

Parameters:
draggable -
Returns:
instance of the current component

isDraggable

public boolean isDraggable()

isDraggrable

@Deprecated
public boolean isDraggrable()
Deprecated. will be removed is 1.2


setStack

public Dialog setStack(boolean stack)
Specifies whether the dialog will stack on top of other dialogs. This will cause the dialog to move to the front of other dialogs when it gains focus.

Parameters:
stack -
Returns:
instance of the current component

isStack

public boolean isStack()

setZIndex

public Dialog setZIndex(int zIndex)
Set's the starting z-index

Parameters:
zIndex -
Returns:
instance of the current component

getZIndex

public int getZIndex()
Returns:
the starting z-index (default : 1000)

setButtons

public Dialog setButtons(ListItemOptions<DialogButton> buttons)
Set's a list of dialog button

Parameters:
buttons -
Returns:
instance of the current component

setButtons

public Dialog setButtons(DialogButton... buttons)
Set's a list of dialog button

Parameters:
buttons -
Returns:
instance of the current component

getButtons

public ListItemOptions<DialogButton> getButtons()
Returns:
the list of buttons

setBeforeCloseEvent

@Deprecated
public Dialog setBeforeCloseEvent(JsScopeUiEvent beforeclose)
Deprecated. will be removed when we will used jquery ui 1.9 (see ticket http://dev.jqueryui.com/ticket/4669)

Set's the callback before the dialog is closing. If the beforeclose event handler (callback function) returns false, the close will be prevented

Parameters:
beforeclose -
Returns:
instance of the current component

setCloseEvent

public Dialog setCloseEvent(JsScopeUiEvent close)
Set's the callback before the dialog is closed.

Parameters:
close -
Returns:
instance of the current component

setDragEvent

public Dialog setDragEvent(JsScopeUiEvent drag)
Set's the callback when the dialog is dragged.

Parameters:
drag -
Returns:
instance of the current component

setDragStartEvent

public Dialog setDragStartEvent(JsScopeUiEvent dragStart)
Set's the callback when the dialog is being dragged.

Parameters:
dragStart -
Returns:
instance of the current component

setDragStopEvent

public Dialog setDragStopEvent(JsScopeUiEvent dragStop)
Set's the callback when the dialog has been dragged.

Parameters:
dragStop -
Returns:
instance of the current component

setFocusEvent

public Dialog setFocusEvent(JsScopeUiEvent focus)
Set's the callback when the dialog gains focus.

Parameters:
focus -
Returns:
instance of the current component

setOpenEvent

public Dialog setOpenEvent(JsScopeUiEvent open)
Set's the callback before the dialog is opening.

Parameters:
open -
Returns:
instance of the current component

setResizeEvent

public Dialog setResizeEvent(JsScopeUiEvent resize)
Set's the callback when the dialog is resized.

Parameters:
resize -
Returns:
instance of the current component

setResizeStartEvent

public Dialog setResizeStartEvent(JsScopeUiEvent resizeStart)
Set's the callback when the dialog is being resized.

Parameters:
resizeStart -
Returns:
instance of the current component

setResizeStopEvent

public Dialog setResizeStopEvent(JsScopeUiEvent resizeStop)
Set's the callback when the dialog has been resized.

Parameters:
resizeStop -
Returns:
instance of the current component

destroy

public JsStatement destroy()
Method to destroy the dialog This will return the element back to its pre-init state.

Returns:
the associated JsStatement

destroy

public void destroy(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to destroy the dialog within the ajax request

Parameters:
ajaxRequestTarget -

disable

public JsStatement disable()
Method to disable the dialog

Returns:
the associated JsStatement

disable

public void disable(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to disable the dialog within the ajax request

Parameters:
ajaxRequestTarget -

enable

public JsStatement enable()
Method to enable the dialog

Returns:
the associated JsStatement

enable

public void enable(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to enable the dialog within the ajax request

Parameters:
ajaxRequestTarget -

isOpen

public JsStatement isOpen()
Method returning true if the dialog is currently open

Returns:
the associated JsStatement

moveToTop

public JsStatement moveToTop()
Method to move to top the dialog

Returns:
the associated JsStatement

moveToTop

public void moveToTop(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to move to top the dialog within the ajax request

Parameters:
ajaxRequestTarget -

widget

public JsStatement widget()
Method to returns the .ui-dialog element

Returns:
the associated JsStatement

widget

public void widget(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to returns the .ui-dialog element within the ajax request

Parameters:
ajaxRequestTarget -

getAjaxBehavior

public Dialog.DialogAjaxBehavior getAjaxBehavior()


Copyright © 2012. All Rights Reserved.