Author: knopp
Date: Thu Sep 18 16:27:33 2008
New Revision: 696851

URL: http://svn.apache.org/viewvc?rev=696851&view=rev
Log:
WICKET-1120

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=696851&r1=696850&r2=696851&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
 Thu Sep 18 16:27:33 2008
@@ -46,79 +46,66 @@
 /**
  * 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
- * &lt;span&gt; tag, make sure you use a &lt;div&gt;.
+ * If you want this to work under IE, don't attach this component to a 
&lt;span&gt; tag, make sure
+ * you use a &lt;div&gt;.
  * <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)
@@ -128,9 +115,11 @@
 {
        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.
@@ -171,10 +160,10 @@
        }
 
        /**
-        * 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
         */
@@ -189,36 +178,31 @@
        }
 
        /**
-        * 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.
+                *            <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
+                * @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
         */
@@ -228,8 +212,7 @@
                 * 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);
        }
@@ -245,9 +228,8 @@
        }
 
        /**
-        * 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
@@ -268,8 +250,8 @@
        }
 
        /**
-        * 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
@@ -277,7 +259,7 @@
        public void setPageCreator(PageCreator creator)
        {
                setContent(empty);
-               pageCreator = creator;          
+               pageCreator = creator;
        }
 
        /**
@@ -320,9 +302,9 @@
        }
 
        /**
-        * 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.
@@ -351,16 +333,21 @@
        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"
-                               + " var close = function(w) { 
w.setTimeout(function() {\n" + "          win.current.close();\n" + "     }, 
0);  } \n"
-                               + "     try { close(window.parent); } catch 
(ignore) { close(window); };\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"
+                       + " var close = function(w) { w.setTimeout(function() 
{\n"
+                       + "             win.current.close();\n"
+                       + "     }, 0);  } \n"
+                       + "     try { close(window.parent); } catch (ignore) { 
close(window); };\n" + "}";
        }
 
        /**
@@ -379,9 +366,8 @@
        }
 
        /**
-        * 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.
@@ -402,9 +388,8 @@
        }
 
        /**
-        * 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
@@ -435,10 +420,9 @@
        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
         */
@@ -458,11 +442,10 @@
        }
 
        /**
-        * 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
@@ -484,12 +467,11 @@
        }
 
        /**
-        * 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
@@ -510,13 +492,12 @@
        }
 
        /**
-        * 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)
        {
@@ -524,12 +505,12 @@
        }
 
        /**
-        * Returns true if the initial height should be used (in favor of 
preserving
-        * real content height).
+        * 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)
+        * @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()
        {
@@ -558,8 +539,8 @@
        }
 
        /**
-        * 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.
@@ -580,8 +561,8 @@
        }
 
        /**
-        * 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.
@@ -602,8 +583,8 @@
        }
 
        /**
-        * 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
@@ -618,8 +599,8 @@
        }
 
        /**
-        * 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
         */
@@ -629,9 +610,8 @@
        }
 
        /**
-        * 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
@@ -642,9 +622,8 @@
        }
 
        /**
-        * 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
@@ -666,12 +645,11 @@
        }
 
        /**
-        * 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
@@ -770,7 +748,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;
                }
@@ -792,8 +770,8 @@
        }
 
        /**
-        * 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
         */
@@ -805,8 +783,7 @@
        /**
         * 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()
        {
@@ -894,7 +871,8 @@
                @Override
                protected void respond(AjaxRequestTarget target)
                {
-                       if (closeButtonCallback == null || 
closeButtonCallback.onCloseButtonClicked(target) == true)
+                       if (closeButtonCallback == null ||
+                               
closeButtonCallback.onCloseButtonClicked(target) == true)
                        {
                                close(target);
                        }
@@ -957,7 +935,8 @@
 
                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");
@@ -1027,8 +1006,10 @@
                // 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;
                }
@@ -1038,8 +1019,10 @@
                // 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);


Reply via email to