Modal window is a draggable window (with either div or iframe content) that prevent user from interacting the rest of page (using a mask) until the window is closed.
If you want this to work under IE, don't attach this component to a <span> tag, make sure you use a <div>.
The window is draggable and optionally resizable. The content can be either
{@link #getContentId()}
, or {@link PageCreator}
instance to a {@link #setPageCreator(ModalWindow.PageCreator)}
method. {@link #show(org.apache.wicket.ajax.AjaxRequestTarget)})
. The window can be made visible from an ajax handler using {@link #show(org.apache.wicket.ajax.AjaxRequestTarget)}
. To close the window there are multiple options. Static method {@link #close(org.apache.wicket.ajax.AjaxRequestTarget)}
can be used to close the window from a handler of ajax link inside the window. By default the close button in the upper right corner of the window closes it. This behavior can be altered using {@link #setCloseButtonCallback(ModalWindow.CloseButtonCallback)}
. If you want to be notified when the window is closed (either using the close button or calling {@link #close(org.apache.wicket.ajax.AjaxRequestTarget)})
, you can use {@link #setWindowClosedCallback(ModalWindow.WindowClosedCallback)}
.
Title is specified using {@link #setTitle(String)}. If the content is a page (iframe), the title can remain unset, in that case title from the page inside window will be shown.
There are several options to specify the visual properties of the window. In all methods where size is expected, width refers to width of entire window (including frame), height refers to the height of window content (without frame).
{@link #setResizable(boolean)}
specifies, whether the window can be resized. {@link #setInitialWidth(int)}
and {@link #setInitialHeight(int)}
specify the initial width and height of window. If the window is resizable, the unit of these dimensions is always "px". If the window is not resizable, the unit can be specified using {@link #setWidthUnit(String)}
and {@link #setHeightUnit(String)}
. If the window is not resizable and the content is a component (not a page), the initial height value can be ignored and the actual height can be determined from the height of the content. To enable this behavior use {@link #setUseInitialHeight(boolean)}
. {@link #setCookieName(String)}
. If the name is null
, position is not stored (initial width and height are always used). Default cookie name is null (position is not stored). {@link #setMinimalWidth(int)}
and {@link #setMinimalHeight(int)}
set the minimal dimensions of resizable window. {@link #setAutoSize(boolean)}
sets whether window size will be automatically adjusted on opening to fit content's width and height. Default is false. Doesn't work on IE 6. {@link #setCssClassName(String)}
sets the dialog css class, possible values are {@link #CSS_CLASS_BLUE}
for blue frame and {@link #CSS_CLASS_GRAY}
for gray frame. {@link #setMaskType(ModalWindow.MaskType)}
alters this. If you want to use form in modal window component make sure that you put the modal window itself in another form (nesting forms is legal in Wicket) and that the form on modal window is submitted before the window get closed. @author Matej Knopp
|
|
|
|