Author: knopp
Date: Wed Jan 17 15:17:49 2007
New Revision: 497240
URL: http://svn.apache.org/viewvc?view=rev&rev=497240
Log:
Modal window fixes
Modified:
incubator/wicket/branches/wicket-1.x/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/modal/ModalWindow.java
Modified:
incubator/wicket/branches/wicket-1.x/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/modal/ModalWindow.java
URL:
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/modal/ModalWindow.java?view=diff&rev=497240&r1=497239&r2=497240
==============================================================================
---
incubator/wicket/branches/wicket-1.x/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/modal/ModalWindow.java
(original)
+++
incubator/wicket/branches/wicket-1.x/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/modal/ModalWindow.java
Wed Jan 17 15:17:49 2007
@@ -102,8 +102,7 @@
* 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 generated using
- * <code>hashCode()</code>.
+ * 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.
@@ -137,8 +136,9 @@
*/
public ModalWindow(String id)
{
- super(id);
- this.cookieName = "modal-window-" + hashCode();
+ super(id);
+ setVersioned(false);
+ this.cookieName = null;
add(empty = new WebMarkupContainer(getContentId()));
add(new CloseButtonBehavior());
@@ -295,14 +295,24 @@
/**
* @return javascript that closes current modal window
*/
- 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"
- + " window.parent.setTimeout(function()
{\n" + " win.current.close();\n"
- + " }, 0);\n" + "}";
- }
+ 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" + "}";
+ }
/**
* Returns the id of content component.