Author: knopp
Date: Wed Jul 9 06:15:01 2008
New Revision: 675157
URL: http://svn.apache.org/viewvc?rev=675157&view=rev
Log:
WICKET-1637
Modified:
wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalWindow.java
Modified:
wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalWindow.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalWindow.java?rev=675157&r1=675156&r2=675157&view=diff
==============================================================================
---
wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalWindow.java
(original)
+++
wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalWindow.java
Wed Jul 9 06:15:01 2008
@@ -46,68 +46,81 @@
/**
* Modal window component.
* <p>
- * 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.
+ * 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.
* <p>
- * If you want this to work under IE, don't attach this component to a
<span> tag, make sure
- * you use a <div>.
+ * If you want this to work under IE, don't attach this component to a
+ * <span> tag, make sure you use a <div>.
* <p>
* The window is draggable and optionally resizable. The content can be either
* <ul>
- * <li><b>a component</b> - you need to add the component to modal window
(with id obtained using
- * <code>[EMAIL PROTECTED] #getContentId()}</code>, or
- * <li><b>a page</b> - you need to pass a <code>[EMAIL PROTECTED]
PageCreator}</code> instance to a
- * <code>[EMAIL PROTECTED] #setPageCreator(ModalWindow.PageCreator)}</code>
method.
+ * <li><b>a component</b> - you need to add the component to modal window
+ * (with id obtained using <code>[EMAIL PROTECTED] #getContentId()}</code>, or
+ * <li><b>a page</b> - you need to pass a <code>[EMAIL PROTECTED]
PageCreator}</code>
+ * instance to a <code>[EMAIL PROTECTED]
#setPageCreator(ModalWindow.PageCreator)}</code>
+ * method.
* </ul>
- * In case the content is a component, it is not rendered until the window is
shown (method
- * <code>[EMAIL PROTECTED] #show(AjaxRequestTarget)})</code>. In case the
content is another page, you can
- * set the desired pagemap name using <code>[EMAIL PROTECTED]
#setPageMapName(String)}</code>. Setting
- * pagemap is only needed when wicket multiwindow support is on.
+ * In case the content is a component, it is not rendered until the window is
+ * shown (method <code>[EMAIL PROTECTED] #show(AjaxRequestTarget)})</code>. In
case the
+ * content is another page, you can set the desired pagemap name using
+ * <code>[EMAIL PROTECTED] #setPageMapName(String)}</code>. Setting pagemap is
only
+ * needed when wicket multiwindow support is on.
* <p>
* The window can be made visible from an ajax handler using
* <code>[EMAIL PROTECTED] #show(AjaxRequestTarget)}</code>.
* <p>
* To close the window there are multiple options. Static method
- * <code>[EMAIL PROTECTED] #close(AjaxRequestTarget)}</code> 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
- * <code>[EMAIL PROTECTED]
#setCloseButtonCallback(ModalWindow.CloseButtonCallback)}</code>. If you want to
- * be notified when the window is closed (either using the close button or
calling
- * <code>[EMAIL PROTECTED] #close(AjaxRequestTarget)})</code>, you can use
+ * <code>[EMAIL PROTECTED] #close(AjaxRequestTarget)}</code> 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
+ * <code>[EMAIL PROTECTED]
#setCloseButtonCallback(ModalWindow.CloseButtonCallback)}</code>.
+ * If you want to be notified when the window is closed (either using the close
+ * button or calling <code>[EMAIL PROTECTED]
#close(AjaxRequestTarget)})</code>, you
+ * can use
* <code>[EMAIL PROTECTED]
#setWindowClosedCallback(ModalWindow.WindowClosedCallback)}</code>.
* <p>
- * Title is specified using [EMAIL PROTECTED] #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.
+ * Title is specified using [EMAIL PROTECTED] #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.
* <p>
- * 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).
+ * 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).
* <p>
* <ul>
- * <li><code>[EMAIL PROTECTED] #setResizable(boolean)}</code> specifies,
whether the window can be resized.
- * <li><code>[EMAIL PROTECTED] #setInitialWidth(int)}</code> and <code>[EMAIL
PROTECTED] #setInitialHeight(int)}</code>
- * 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
- * <code>[EMAIL PROTECTED] #setWidthUnit(String)}</code> and <code>[EMAIL
PROTECTED] #setHeightUnit(String)}</code>.
- * 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 <code>[EMAIL PROTECTED]
#setUseInitialHeight(boolean)}</code>.
- * <li>The window position (and size if the window is resizable) can be stored
in a cookie, so that
- * it is preserved when window is close. The name of the cookie is specified
via
- * <code>[EMAIL PROTECTED] #setCookieName(String)}</code>. If the name is
<code>null</code>, position is
- * not stored (initial width and height are always used). Default cookie name
is null (position is
- * not stored).
- * <li><code>[EMAIL PROTECTED] #setMinimalWidth(int)}</code> and <code>[EMAIL
PROTECTED] #setMinimalHeight(int)}</code>
- * set the minimal dimensions of resizable window.
+ * <li><code>[EMAIL PROTECTED] #setResizable(boolean)}</code> specifies,
whether the
+ * window can be resized.
+ * <li><code>[EMAIL PROTECTED] #setInitialWidth(int)}</code> and
+ * <code>[EMAIL PROTECTED] #setInitialHeight(int)}</code> 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
+ * <code>[EMAIL PROTECTED] #setWidthUnit(String)}</code> and
+ * <code>[EMAIL PROTECTED] #setHeightUnit(String)}</code>. 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
+ * <code>[EMAIL PROTECTED] #setUseInitialHeight(boolean)}</code>.
+ * <li>The window position (and size if the window is resizable) can be stored
+ * in a cookie, so that it is preserved when window is close. The name of the
+ * cookie is specified via <code>[EMAIL PROTECTED]
#setCookieName(String)}</code>. If
+ * the name is <code>null</code>, position is not stored (initial width and
+ * height are always used). Default cookie name is null (position is not
+ * stored).
+ * <li><code>[EMAIL PROTECTED] #setMinimalWidth(int)}</code> and
+ * <code>[EMAIL PROTECTED] #setMinimalHeight(int)}</code> set the minimal
dimensions of
+ * resizable window.
* <li>Modal window can chose between two colors of frame.
- * <code>[EMAIL PROTECTED] #setCssClassName(String)}</code> sets the dialog
css class, possible values are
- * <code>[EMAIL PROTECTED] #CSS_CLASS_BLUE}</code> for blue frame and
<code>[EMAIL PROTECTED] #CSS_CLASS_GRAY}</code>
- * for gray frame.
- * <li>Mask (element that prevents user from interacting the rest of the page)
can be either
- * transparent or semitransparent. <code>[EMAIL PROTECTED]
#setMaskType(ModalWindow.MaskType)}</code> alters
- * this.
+ * <code>[EMAIL PROTECTED] #setCssClassName(String)}</code> sets the dialog
css class,
+ * possible values are <code>[EMAIL PROTECTED] #CSS_CLASS_BLUE}</code> for
blue frame and
+ * <code>[EMAIL PROTECTED] #CSS_CLASS_GRAY}</code> for gray frame.
+ * <li>Mask (element that prevents user from interacting the rest of the page)
+ * can be either transparent or semitransparent.
+ * <code>[EMAIL PROTECTED] #setMaskType(ModalWindow.MaskType)}</code> alters
this.
* </ul>
- *
+ *
* @see IPageSettings#setAutomaticMultiWindowSupport(boolean)
* @author Matej Knopp
*/
@@ -115,15 +128,13 @@
{
private static final long serialVersionUID = 1L;
- private static ResourceReference JAVASCRIPT = new
JavascriptResourceReference(
- ModalWindow.class, "res/modal.js");
+ private static ResourceReference JAVASCRIPT = new
JavascriptResourceReference(ModalWindow.class, "res/modal.js");
- private static ResourceReference CSS = new
CompressedResourceReference(ModalWindow.class,
- "res/modal.css");
+ private static ResourceReference CSS = new
CompressedResourceReference(ModalWindow.class, "res/modal.css");
/**
* Creates a new modal window component.
- *
+ *
* @param id
* Id of component
*/
@@ -135,7 +146,7 @@
/**
* Creates a new modal window component.
- *
+ *
* @param id
* Id of component
* @param model
@@ -160,66 +171,72 @@
}
/**
- * Interface for lazy page creation. The advantage of creating page
using this interface over
- * just passing a page instance is that page created in <code>[EMAIL
PROTECTED] #createPage()}</code>
- * will have the pagemap automatically set to the pagemap specified for
- * <code>[EMAIL PROTECTED] ModalWindow}</code>.
- *
+ * Interface for lazy page creation. The advantage of creating page
using
+ * this interface over just passing a page instance is that page
created in
+ * <code>[EMAIL PROTECTED] #createPage()}</code> will have the pagemap
automatically
+ * set to the pagemap specified for <code>[EMAIL PROTECTED]
ModalWindow}</code>.
+ *
* @author Matej Knopp
*/
public static interface PageCreator extends IClusterable
{
/**
* Creates a new instance of content page.
- *
+ *
* @return new page instance
*/
public Page createPage();
}
/**
- * Callback for close button that contains a method that is invoked
after the button has been
- * clicked. If no callback instance is specified using
+ * Callback for close button that contains a method that is invoked
after
+ * the button has been clicked. If no callback instance is specified
using
* <code>[EMAIL PROTECTED]
ModalWindow#setCloseButtonCallback(ModalWindow.CloseButtonCallback)}</code>,
- * no ajax request will be fired. Clicking the button will just close
the window.
- *
+ * no ajax request will be fired. Clicking the button will just close
the
+ * window.
+ *
* @author Matej Knopp
*/
public static interface CloseButtonCallback extends IClusterable
{
/**
- * Methods invoked after the button has been clicked. The
invocation is done using an ajax
- * call, so <code>[EMAIL PROTECTED] AjaxRequestTarget}</code>
instance is available.
- *
+ * Methods invoked after the button has been clicked. The
invocation is
+ * done using an ajax call, so <code>[EMAIL PROTECTED]
AjaxRequestTarget}</code>
+ * instance is available.
+ *
* @param target
- * <code>[EMAIL PROTECTED] AjaxRequestTarget}</code>
instance bound with the ajax request.
- *
- * @return True if the window can be closed (will close the
window), false otherwise
+ * <code>[EMAIL PROTECTED] AjaxRequestTarget}</code>
instance bound
+ * with the ajax request.
+ *
+ * @return True if the window can be closed (will close the
window),
+ * false otherwise
*/
public boolean onCloseButtonClicked(AjaxRequestTarget target);
}
/**
- * Callback called after the window has been closed. If no callback
instance is specified using
- * [EMAIL PROTECTED]
ModalWindow#setWindowClosedCallback(ModalWindow.WindowClosedCallback)}, no ajax
- * request will be fired.
- *
+ * Callback called after the window has been closed. If no callback
instance
+ * is specified using
+ * [EMAIL PROTECTED]
ModalWindow#setWindowClosedCallback(ModalWindow.WindowClosedCallback)},
+ * no ajax request will be fired.
+ *
* @author Matej Knopp
*/
public static interface WindowClosedCallback extends IClusterable
{
/**
* Called after the window has been closed.
- *
+ *
* @param target
- * <code>[EMAIL PROTECTED] AjaxRequestTarget}</code>
instance bound with the ajax request.
+ * <code>[EMAIL PROTECTED] AjaxRequestTarget}</code>
instance bound
+ * with the ajax request.
*/
public void onClose(AjaxRequestTarget target);
}
/**
* Is this window currently showing.
- *
+ *
* @return the shown
*/
public boolean isShown()
@@ -228,9 +245,10 @@
}
/**
- * Sets the name of the page ma for the content page. This makes only
sense when the content is
- * a page, not a component and if wicket multiwindow support is turned
on.
- *
+ * Sets the name of the page ma for the content page. This makes only
sense
+ * when the content is a page, not a component and if wicket multiwindow
+ * support is turned on.
+ *
* @param pageMapName
* Name of the page map
*/
@@ -241,7 +259,7 @@
/**
* Returns the page map name.
- *
+ *
* @return The page map name.
*/
public String getPageMapName()
@@ -250,20 +268,21 @@
}
/**
- * Sets the <code>[EMAIL PROTECTED] PageCreator}</code> instance. The
instance is only used when no
- * custom component has been added to the dialog.
- *
+ * Sets the <code>[EMAIL PROTECTED] PageCreator}</code> instance. The
instance is
+ * only used when no custom component has been added to the dialog.
+ *
* @param creator
* <code>[EMAIL PROTECTED] PageCreator}</code> instance
*/
public void setPageCreator(PageCreator creator)
{
pageCreator = creator;
+ setContent(empty);
}
/**
* Sets the <code>[EMAIL PROTECTED] CloseButtonCallback}</code>
instance.
- *
+ *
* @param callback
* Callback instance
*/
@@ -274,7 +293,7 @@
/**
* Sets the <code>@{link [EMAIL PROTECTED] WindowClosedCallback}</code>
instance.
- *
+ *
* @param callback
* Callback instance
*/
@@ -285,7 +304,7 @@
/**
* Shows the modal window.
- *
+ *
* @param target
* Request target associated with current ajax request.
*/
@@ -301,10 +320,10 @@
}
/**
- * Hides the modal window. This can be called from within the modal
window, however, the modal
- * window must have configured WindowClosedCallback. Otherwise use the
- * [EMAIL PROTECTED] #close(AjaxRequestTarget)} method.
- *
+ * Hides the modal window. This can be called from within the modal
window,
+ * however, the modal window must have configured WindowClosedCallback.
+ * Otherwise use the [EMAIL PROTECTED] #close(AjaxRequestTarget)}
method.
+ *
* @param target
* Request target associated with current ajax request.
*/
@@ -315,7 +334,7 @@
/**
* Closes the modal window.
- *
+ *
* @param target
* Request target associated with current ajax request.
*/
@@ -332,29 +351,25 @@
private static String getCloseJavacript()
{
return "var win;\n" //
- + "try {\n" + " win = window.parent.Wicket.Window;\n"
- + "} catch (ignore) {\n"
- + "}\n"
- + "if (typeof(win) == \"undefined\" ||
typeof(win.current) == \"undefined\") {\n"
- + " try {\n"
- + " win = window.Wicket.Window;\n"
- + " } catch (ignore) {\n"
- + " }\n"
- + "}\n"
- + "if (typeof(win) != \"undefined\" &&
typeof(win.current) != \"undefined\") {\n"
- + " window.parent.setTimeout(function() {\n" + "
win.current.close();\n"
- + " }, 0);\n"
- + "}";
+ + "try {\n" + " win =
window.parent.Wicket.Window;\n" + "} catch (ignore) {\n"
+ + "}\n"
+ + "if (typeof(win) == \"undefined\" ||
typeof(win.current) == \"undefined\") {\n"
+ + " try {\n"
+ + " win = window.Wicket.Window;\n" + " }
catch (ignore) {\n"
+ + " }\n"
+ + "}\n"
+ + "if (typeof(win) != \"undefined\" &&
typeof(win.current) != \"undefined\") {\n"
+ + " window.parent.setTimeout(function()
{\n" + " win.current.close();\n" + " }, 0);\n" + "}";
}
/**
* Returns the id of content component.
- *
+ *
* <pre>
* ModalWindow window = new ModalWindow(parent, "window");
* new MyPanel(window, window.getContentId());
* </pre>
- *
+ *
* @return Id of content component.
*/
public String getContentId()
@@ -363,9 +378,10 @@
}
/**
- * Sets the minimal width of window. This value is only used if the
window is resizable. The
- * width is specified in pixels and it is the width of entire window
(including frame).
- *
+ * Sets the minimal width of window. This value is only used if the
window
+ * is resizable. The width is specified in pixels and it is the width of
+ * entire window (including frame).
+ *
* @param minimalWidth
* Minimal window width.
*/
@@ -376,7 +392,7 @@
/**
* Returns the minimal width of window (in pixels).
- *
+ *
* @return Minimal width of window
*/
public int getMinimalWidth()
@@ -385,9 +401,10 @@
}
/**
- * Sets the minimal height of window. This value is only used if window
is resizable. The height
- * is specified in pixels and it is the height of window content
(without frame).
- *
+ * Sets the minimal height of window. This value is only used if window
is
+ * resizable. The height is specified in pixels and it is the height of
+ * window content (without frame).
+ *
* @param minimalHeight
* Minimal height
*/
@@ -398,7 +415,7 @@
/**
* Returns the minimal height of window (in pixels).
- *
+ *
* @return Minimal height of window
*/
public int getMinimalHeight()
@@ -417,10 +434,11 @@
public final static String CSS_CLASS_GRAY = "w_silver";
/**
- * Sets the CSS class name for this window. This class affects the look
of window frame.
- * Possible values (if you don't make your style sheet) are
<code>[EMAIL PROTECTED] #CSS_CLASS_BLUE}</code>
- * and <code>[EMAIL PROTECTED] #CSS_CLASS_GRAY}</code>.
- *
+ * Sets the CSS class name for this window. This class affects the look
of
+ * window frame. Possible values (if you don't make your style sheet)
are
+ * <code>[EMAIL PROTECTED] #CSS_CLASS_BLUE}</code> and
+ * <code>[EMAIL PROTECTED] #CSS_CLASS_GRAY}</code>.
+ *
* @param cssClassName
*/
public void setCssClassName(String cssClassName)
@@ -430,7 +448,7 @@
/**
* Returns the CSS class name for this window.
- *
+ *
* @return CSS class name
*/
public String getCssClassName()
@@ -439,12 +457,13 @@
}
/**
- * Sets the initial width of the window. The width refers to the width
of entire window
- * (including frame). If the window is resizable, the width unit is
always "px". If the window
- * is not resizable, the unit can be specified using [EMAIL PROTECTED]
#setWidthUnit(String)}. If cookie
- * name is set and window is resizable, the initial width may be
ignored in favor of width
+ * Sets the initial width of the window. The width refers to the width
of
+ * entire window (including frame). If the window is resizable, the
width
+ * unit is always "px". If the window is not resizable, the unit can be
+ * specified using [EMAIL PROTECTED] #setWidthUnit(String)}. If cookie
name is set and
+ * window is resizable, the initial width may be ignored in favor of
width
* stored in cookie.
- *
+ *
* @param initialWidth
* Initial width of the window
*/
@@ -455,7 +474,7 @@
/**
* Returns the initial width of the window.
- *
+ *
* @return Initial height of the window
*/
public int getInitialWidth()
@@ -464,12 +483,13 @@
}
/**
- * Sets the initial height of the window. The height refers to the
height of window content
- * (without frame). If the window is resizable, the height unit is
always "px". If the window is
- * not resizable, the unit can be specified using [EMAIL PROTECTED]
#setHeightUnit(String)}. If cookie
- * name is set and window is resizable, the initial height may be
ignored in favor of height
- * stored in cookie.
- *
+ * Sets the initial height of the window. The height refers to the
height of
+ * window content (without frame). If the window is resizable, the
height
+ * unit is always "px". If the window is not resizable, the unit can be
+ * specified using [EMAIL PROTECTED] #setHeightUnit(String)}. If cookie
name is set
+ * and window is resizable, the initial height may be ignored in favor
of
+ * height stored in cookie.
+ *
* @param initialHeight
* Initial height of the window
*/
@@ -480,7 +500,7 @@
/**
* Returns the initial height of the window.
- *
+ *
* @return Initial height of the window
*/
public int getInitialHeight()
@@ -489,12 +509,13 @@
}
/**
- * Sets whether to use initial height or preserve the real content
height. This can only be used
- * if the content is a component (not a page) and the window is not
resizable.
- *
+ * Sets whether to use initial height or preserve the real content
height.
+ * This can only be used if the content is a component (not a page) and
the
+ * window is not resizable.
+ *
* @param useInitialHeight
- * Whether to use initial height instead of preserving
content height instead of
- * using initial height
+ * Whether to use initial height instead of preserving
content
+ * height instead of using initial height
*/
public void setUseInitialHeight(boolean useInitialHeight)
{
@@ -502,12 +523,12 @@
}
/**
- * Returns true if the initial height should be used (in favor of
preserving real content
- * height).
- *
- * @return True if initial height should be used, false is real content
height should be
- * preserved (valid only if the window is not resizable and the
content is a component
- * (not a page)
+ * Returns true if the initial height should be used (in favor of
preserving
+ * real content height).
+ *
+ * @return True if initial height should be used, false is real content
+ * height should be preserved (valid only if the window is not
+ * resizable and the content is a component (not a page)
*/
public boolean isUseInitialHeight()
{
@@ -516,7 +537,7 @@
/**
* Sets whether the user will be able to resize the window.
- *
+ *
* @param resizable
* Whether the window is resizable
*/
@@ -527,7 +548,7 @@
/**
* Returns whether the window is resizable.
- *
+ *
* @return True if the window is resizable, false otherwise
*/
public boolean isResizable()
@@ -536,9 +557,9 @@
}
/**
- * Sets the CSS unit used for initial window width. This is only
applicable when the window is
- * not resizable.
- *
+ * Sets the CSS unit used for initial window width. This is only
applicable
+ * when the window is not resizable.
+ *
* @param widthUnit
* CSS unit for initial window width.
*/
@@ -549,7 +570,7 @@
/**
* Returns the CSS unit for initial window width.
- *
+ *
* @return CSS unit for initial window width.
*/
public String getWidthUnit()
@@ -558,9 +579,9 @@
}
/**
- * Sets the CSS unit used for initial window height. This is only
applicable when the window is
- * not resizable.
- *
+ * Sets the CSS unit used for initial window height. This is only
applicable
+ * when the window is not resizable.
+ *
* @param heightUnit
* CSS unit for initial window height.
*/
@@ -571,7 +592,7 @@
/**
* Retrns the CSS unit for initial window height.
- *
+ *
* @return CSS unit for initial window height.
*/
public String getHeightUnit()
@@ -580,9 +601,9 @@
}
/**
- * Sets the name of the cookie that is used to remember window position
(and size if the window
- * is resizable).
- *
+ * Sets the name of the cookie that is used to remember window position
(and
+ * size if the window is resizable).
+ *
* @param cookieName
* Name of the cookie
*/
@@ -596,9 +617,9 @@
}
/**
- * Returns the name of cookie that is used to remember window position
(and size if the window
- * is resizable).
- *
+ * Returns the name of cookie that is used to remember window position
(and
+ * size if the window is resizable).
+ *
* @return Name of the cookie
*/
public String getCookieName()
@@ -607,9 +628,10 @@
}
/**
- * Sets the title of window. If the window is a page, title can be
<code>null</code>. In that
- * case it will display the title document inside the window.
- *
+ * Sets the title of window. If the window is a page, title can be
+ * <code>null</code>. In that case it will display the title document
+ * inside the window.
+ *
* @param title
* Title of the window
*/
@@ -619,9 +641,10 @@
}
/**
- * Sets the title of window. If the window is a page, title can be
<code>null</code>. In that
- * case it will display the title document inside the window.
- *
+ * Sets the title of window. If the window is a page, title can be
+ * <code>null</code>. In that case it will display the title document
+ * inside the window.
+ *
* @param title
* Title of the window
*/
@@ -633,7 +656,7 @@
/**
* Returns the title of the window.
- *
+ *
* @return Title of the window
*/
public IModel<String> getTitle()
@@ -642,13 +665,14 @@
}
/**
- * Mask is the element behind the window, that prevents user from
interacting the rest of page.
- * Mask can be either
+ * Mask is the element behind the window, that prevents user from
+ * interacting the rest of page. Mask can be either
* <ul>
* <li><code>[EMAIL PROTECTED] #TRANSPARENT}</code> - the mask is
invisible
- * <li><code>[EMAIL PROTECTED] #SEMI_TRANSPARENT}</code> - the mask is
black with small opacity (10%)
+ * <li><code>[EMAIL PROTECTED] #SEMI_TRANSPARENT}</code> - the mask is
black with
+ * small opacity (10%)
* </ul>
- *
+ *
* @author Matej Knopp
*/
public static final class MaskType extends EnumeratedType
@@ -668,7 +692,7 @@
/**
* Constructor.
- *
+ *
* @param name
*/
public MaskType(String name)
@@ -679,7 +703,7 @@
/**
* Sets the mask type of the window.
- *
+ *
* @param mask
* The mask type
*/
@@ -690,7 +714,7 @@
/**
* Returns the mask type of the window
- *
+ *
* @return The mask type
*/
public MaskType getMaskType()
@@ -700,7 +724,7 @@
/**
* Creates the page.
- *
+ *
* @return Page instance or null if page couldn't be created.
*/
private Page createPage()
@@ -745,7 +769,7 @@
protected void onBeforeRender()
{
// if user is refreshing whole page, the window will not be
shown
- if (((WebRequest)getRequest()).isAjax() == false)
+ if (((WebRequest) getRequest()).isAjax() == false)
{
shown = false;
}
@@ -767,9 +791,9 @@
}
/**
- * Returns a content component. In case user haven't specified any
content component, it returns
- * an empty WebMarkupContainer.
- *
+ * Returns a content component. In case user haven't specified any
content
+ * component, it returns an empty WebMarkupContainer.
+ *
* @return Content component
*/
private Component getContent()
@@ -779,8 +803,9 @@
/**
* Returns true if user has added own component to the window.
- *
- * @return True if user has added own component to the window, false
otherwise.
+ *
+ * @return True if user has added own component to the window, false
+ * otherwise.
*/
private boolean isCustomComponent()
{
@@ -802,7 +827,7 @@
/**
* Sets the content of the modal window.
- *
+ *
* @param component
*/
public void setContent(Component component)
@@ -815,6 +840,7 @@
component.setVisible(false);
replace(component);
shown = false;
+ pageCreator = null;
}
/**
@@ -867,8 +893,7 @@
@Override
protected void respond(AjaxRequestTarget target)
{
- if (closeButtonCallback == null ||
-
closeButtonCallback.onCloseButtonClicked(target) == true)
+ if (closeButtonCallback == null ||
closeButtonCallback.onCloseButtonClicked(target) == true)
{
close(target);
}
@@ -895,7 +920,7 @@
/**
* Returns the markup id of the component.
- *
+ *
* @return component id
*/
private String getContentMarkupId()
@@ -905,10 +930,10 @@
/**
* Replaces all occurrences of " in string with \".
- *
+ *
* @param string
* String to be escaped.
- *
+ *
* @return escaped string
*/
private String escapeQuotes(String string)
@@ -922,7 +947,7 @@
/**
* Returns the javascript used to open the window.
- *
+ *
* @return javascript that opens the window
*/
private String getWindowOpenJavascript()
@@ -931,8 +956,7 @@
if (isCustomComponent() == true)
{
- buffer.append("var element =
document.getElementById(\"" + getContentMarkupId() +
- "\");\n");
+ buffer.append("var element =
document.getElementById(\"" + getContentMarkupId() + "\");\n");
}
buffer.append("var settings = new Object();\n");
@@ -1002,10 +1026,8 @@
// attach notification request
if ((isCustomComponent() == false && deletePageMap) ||
windowClosedCallback != null)
{
- WindowClosedBehavior behavior =
(WindowClosedBehavior)getBehaviors(
- WindowClosedBehavior.class).get(0);
- buffer.append("settings.onClose = function() { " +
behavior.getCallbackScript() +
- " };\n");
+ WindowClosedBehavior behavior = (WindowClosedBehavior)
getBehaviors(WindowClosedBehavior.class).get(0);
+ buffer.append("settings.onClose = function() { " +
behavior.getCallbackScript() + " };\n");
haveCloseCallback = true;
}
@@ -1015,10 +1037,8 @@
// to close window property (thus cleaning the shown flag)
if (closeButtonCallback != null || haveCloseCallback == false)
{
- CloseButtonBehavior behavior =
(CloseButtonBehavior)getBehaviors(
- CloseButtonBehavior.class).get(0);
- buffer.append("settings.onCloseButton = function() { "
+ behavior.getCallbackScript() +
- "};\n");
+ CloseButtonBehavior behavior = (CloseButtonBehavior)
getBehaviors(CloseButtonBehavior.class).get(0);
+ buffer.append("settings.onCloseButton = function() { "
+ behavior.getCallbackScript() + "};\n");
}
postProcessSettings(buffer);
@@ -1030,7 +1050,7 @@
/**
* Method that allows tweaking the settings
- *
+ *
* @param settings
* @return settings javascript
*/