|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wicket.Component org.apache.wicket.MarkupContainer org.apache.wicket.markup.html.WebMarkupContainer org.apache.wicket.markup.html.WebMarkupContainerWithAssociatedMarkup org.apache.wicket.markup.html.panel.Panel org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow
public class ModalWindow
Modal window component.
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
getContentId()
, or
ModalWindow.PageCreator
instance to a
setPageCreator(ModalWindow.PageCreator)
method.
show(AjaxRequestTarget)
)
. In case the content is another page, you can set
the desired pagemap name using setPageMapName(String)
. Setting pagemap is
only needed when wicket multiwindow support is on.
The window can be made visible from an ajax handler using
.
show(AjaxRequestTarget)
To close the window there are multiple options. Static method
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
close(AjaxRequestTarget)
. If you want to be
notified when the window is closed (either using the close button or calling
setCloseButtonCallback(ModalWindow.CloseButtonCallback)
, you can use
close(AjaxRequestTarget)
)
.
setWindowClosedCallback(ModalWindow.WindowClosedCallback)
Title is specified using 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).
setResizable(boolean)
specifies, whether the window can be resized.
setInitialWidth(int)
and 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
setWidthUnit(String)
and 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 setUseInitialHeight(boolean)
.
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).
setMinimalWidth(int)
and setMinimalHeight(int)
set the minimal dimensions of resizable window.
setCssClassName(String)
sets the dialog css class, possible values are
CSS_CLASS_BLUE
for blue frame and CSS_CLASS_GRAY
for
gray frame.
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).
IPageSettings.setAutomaticMultiWindowSupport(boolean)
,
Serialized FormNested Class Summary | |
---|---|
static interface |
ModalWindow.CloseButtonCallback
Callback for close button that contains a method that is invoked after the button has been clicked. |
static class |
ModalWindow.MaskType
Mask is the element behind the window, that prevents user from interacting the rest of page. |
static interface |
ModalWindow.PageCreator
Interface for lazy page creation. |
static interface |
ModalWindow.WindowClosedCallback
Callback called after the window has been closed. |
Nested classes/interfaces inherited from class org.apache.wicket.Component |
---|
Component.ComponentModelChange, Component.EnabledChange, Component.IVisitor, Component.VisibilityChange |
Field Summary | |
---|---|
static java.lang.String |
CSS_CLASS_BLUE
CSS class for window with blue border. |
static java.lang.String |
CSS_CLASS_GRAY
CSS class for window with gray border. |
Fields inherited from class org.apache.wicket.Component |
---|
ENABLE, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED6, FLAG_RESERVED7, FLAG_RESERVED8, PATH_SEPARATOR, RENDER |
Constructor Summary | |
---|---|
ModalWindow(java.lang.String id)
Creates a new modal window component. |
Method Summary | |
---|---|
void |
close(AjaxRequestTarget target)
Closes the modal window. |
static void |
closeCurrent(AjaxRequestTarget target)
Hides the modal window. |
java.lang.String |
getContentId()
Returns the id of content component. |
java.lang.String |
getCookieName()
Returns the name of cookie that is used to remember window position (and size if the window is resizable). |
java.lang.String |
getCssClassName()
Returns the CSS class name for this window. |
java.lang.String |
getHeightUnit()
Retrns the CSS unit for initial window height. |
int |
getInitialHeight()
Returns the initial height of the window. |
int |
getInitialWidth()
Returns the initial width of the window. |
ModalWindow.MaskType |
getMaskType()
Returns the mask type of the window |
int |
getMinimalHeight()
Returns the minimal height of window (in pixels). |
int |
getMinimalWidth()
Returns the minimal width of window (in pixels). |
java.lang.String |
getPageMapName()
Returns the page map name. |
IModel |
getTitle()
Returns the title of the window. |
java.lang.String |
getWidthUnit()
Returns the CSS unit for initial window width. |
boolean |
isResizable()
Returns whether the window is resizable. |
boolean |
isShown()
Is this window currently showing. |
boolean |
isUseInitialHeight()
Returns true if the initial height should be used (in favor of preserving real content height). |
protected void |
onBeforeRender()
Called just before a component is rendered. |
protected void |
onComponentTag(ComponentTag tag)
Processes the component tag. |
protected void |
onDetach()
Called to allow a component to detach resources after use. |
protected AppendingStringBuffer |
postProcessSettings(AppendingStringBuffer settings)
Method that allows tweaking the settings |
void |
remove(Component component)
|
void |
setCloseButtonCallback(ModalWindow.CloseButtonCallback callback)
Sets the instance. |
void |
setContent(Component component)
Sets the content of the modal window. |
void |
setCookieName(java.lang.String cookieName)
Sets the name of the cookie that is used to remember window position (and size if the window is resizable). |
void |
setCssClassName(java.lang.String cssClassName)
Sets the CSS class name for this window. |
void |
setHeightUnit(java.lang.String heightUnit)
Sets the CSS unit used for initial window height. |
void |
setInitialHeight(int initialHeight)
Sets the initial height of the window. |
void |
setInitialWidth(int initialWidth)
Sets the initial width of the window. |
void |
setMaskType(ModalWindow.MaskType mask)
Sets the mask type of the window. |
void |
setMinimalHeight(int minimalHeight)
Sets the minimal height of window. |
void |
setMinimalWidth(int minimalWidth)
Sets the minimal width of window. |
void |
setPageCreator(ModalWindow.PageCreator creator)
Sets the instance. |
void |
setPageMapName(java.lang.String pageMapName)
Sets the name of the page ma for the content page. |
void |
setResizable(boolean resizable)
Sets whether the user will be able to resize the window. |
void |
setTitle(IModel title)
Sets the title of window. |
void |
setTitle(java.lang.String title)
Sets the title of window. |
void |
setUseInitialHeight(boolean useInitialHeight)
Sets whether to use initial height or preserve the real content height. |
void |
setWidthUnit(java.lang.String widthUnit)
Sets the CSS unit used for initial window width. |
void |
setWindowClosedCallback(ModalWindow.WindowClosedCallback callback)
Sets the @{link instance. |
void |
show(AjaxRequestTarget target)
Shows the modal window. |
Methods inherited from class org.apache.wicket.markup.html.panel.Panel |
---|
onComponentTagBody, renderHead |
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainerWithAssociatedMarkup |
---|
newHeaderPartContainer, renderHeadFromAssociatedMarkupFile |
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer |
---|
getMarkupType, getWebPage |
Methods inherited from class org.apache.wicket.MarkupContainer |
---|
add, addOrReplace, autoAdd, autoAdd, contains, findMarkupStream, get, getAssociatedMarkupStream, getMarkupStream, hasAssociatedMarkup, internalAdd, isTransparentResolver, iterator, iterator, newMarkupResourceStream, onRender, remove, removeAll, renderAll, renderAssociatedMarkup, renderComponentTagBody, replace, setMarkupStream, setModel, size, toString, toString, visitChildren, visitChildren |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String CSS_CLASS_BLUE
public static final java.lang.String CSS_CLASS_GRAY
Constructor Detail |
---|
public ModalWindow(java.lang.String id)
id
- Id of componentMethod Detail |
---|
public boolean isShown()
public void setPageMapName(java.lang.String pageMapName)
pageMapName
- Name of the page mappublic java.lang.String getPageMapName()
public void setPageCreator(ModalWindow.PageCreator creator)
ModalWindow.PageCreator
instance. The instance is only used when no custom
component has been added to the dialog.
creator
- ModalWindow.PageCreator
instancepublic void setCloseButtonCallback(ModalWindow.CloseButtonCallback callback)
ModalWindow.CloseButtonCallback
instance.
callback
- Callback instancepublic void setWindowClosedCallback(ModalWindow.WindowClosedCallback callback)
@{link ModalWindow.WindowClosedCallback
instance.
callback
- Callback instancepublic void show(AjaxRequestTarget target)
target
- Request target associated with current ajax request.public static final void closeCurrent(AjaxRequestTarget target)
close(AjaxRequestTarget)
method.
target
- Request target associated with current ajax request.public void close(AjaxRequestTarget target)
target
- Request target associated with current ajax request.public java.lang.String getContentId()
ModalWindow window = new ModalWindow(parent, "window"); new MyPanel(window, window.getContentId());
public void setMinimalWidth(int minimalWidth)
minimalWidth
- Minimal window width.public int getMinimalWidth()
public void setMinimalHeight(int minimalHeight)
minimalHeight
- Minimal heightpublic int getMinimalHeight()
public void setCssClassName(java.lang.String cssClassName)
CSS_CLASS_BLUE
and CSS_CLASS_GRAY
.
cssClassName
- public java.lang.String getCssClassName()
public void setInitialWidth(int initialWidth)
setWidthUnit(String)
. If cookie
name is set and window is resizable, the initial width may be ignored in favor of width
stored in cookie.
initialWidth
- Initial width of the windowpublic int getInitialWidth()
public void setInitialHeight(int initialHeight)
setHeightUnit(String)
. If cookie name
is set and window is resizable, the initial height may be ignored in favor of height stored
in cookie.
initialHeight
- Initial height of the windowpublic int getInitialHeight()
public void setUseInitialHeight(boolean useInitialHeight)
useInitialHeight
- Whether to use initial height instead of preserving content height instead of
using initial heightpublic boolean isUseInitialHeight()
public void setResizable(boolean resizable)
resizable
- Whether the window is resizablepublic boolean isResizable()
public void setWidthUnit(java.lang.String widthUnit)
widthUnit
- CSS unit for initial window width.public java.lang.String getWidthUnit()
public void setHeightUnit(java.lang.String heightUnit)
heightUnit
- CSS unit for initial window height.public java.lang.String getHeightUnit()
public void setCookieName(java.lang.String cookieName)
cookieName
- Name of the cookiepublic java.lang.String getCookieName()
public void setTitle(java.lang.String title)
null
. In that
case it will display the title document inside the window.
title
- Title of the windowpublic void setTitle(IModel title)
null
. In that
case it will display the title document inside the window.
title
- Title of the windowpublic IModel getTitle()
public void setMaskType(ModalWindow.MaskType mask)
mask
- The mask typepublic ModalWindow.MaskType getMaskType()
protected void onBeforeRender()
Component
NOTE* If you override this, you *must* call super.onBeforeRender() within your
implementation.
Because this method is responsible for cascading Component.onBeforeRender()
call to its
children it is strongly recommended that super call is made at the end of the override.
onBeforeRender
in class Component
Component.onBeforeRender()
protected void onComponentTag(ComponentTag tag)
Component
onComponentTag
in class Panel
tag
- Tag to modifyPanel.onComponentTag(org.apache.wicket.markup.ComponentTag)
public void remove(Component component)
remove
in class MarkupContainer
component
- Component to remove from this containerMarkupContainer.remove(org.apache.wicket.Component)
public void setContent(Component component)
component
- protected AppendingStringBuffer postProcessSettings(AppendingStringBuffer settings)
settings
-
protected void onDetach()
Component
onDetach
in class Component
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |