Author: knopp
Date: Wed Jan 17 15:10:54 2007
New Revision: 497233
URL: http://svn.apache.org/viewvc?view=rev&rev=497233
Log:
Modal window fix
Modified:
incubator/wicket/branches/wicket-1.2.x/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/modal/ModalWindow.java
Modified:
incubator/wicket/branches/wicket-1.2.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.2.x/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/modal/ModalWindow.java?view=diff&rev=497233&r1=497232&r2=497233
==============================================================================
---
incubator/wicket/branches/wicket-1.2.x/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/modal/ModalWindow.java
(original)
+++
incubator/wicket/branches/wicket-1.2.x/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/modal/ModalWindow.java
Wed Jan 17 15:10:54 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.
@@ -126,8 +125,8 @@
private static ResourceReference JAVASCRIPT = new
CompressedResourceReference(
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.
@@ -138,7 +137,8 @@
public ModalWindow(String id)
{
super(id);
- this.cookieName = "modal-window-" + hashCode();
+ setVersioned(false);
+ this.cookieName = null;
add(empty = new WebMarkupContainer(getContentId()));
add(new CloseButtonBehavior());
@@ -297,10 +297,20 @@
*/
private static String getCloseJavacript()
{
- return "var win;\n" + "try {\n" + " win =
window.parent.Wicket.Window;\n"
- + "} catch (ignore) {\n" + "}\n"
+ 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"
+ + " window.parent.setTimeout(function() {\n"
+ + " win.current.close();\n"
+ " }, 0);\n" + "}";
}