Author: gseitz
Date: Sat May 17 11:16:17 2008
New Revision: 657411
URL: http://svn.apache.org/viewvc?rev=657411&view=rev
Log:
WICKET-1541: replace all non word characters in windowtitle with "_"
Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/link/PopupSettings.java
Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/link/PopupSettings.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/link/PopupSettings.java?rev=657411&r1=657410&r2=657411&view=diff
==============================================================================
---
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/link/PopupSettings.java
(original)
+++
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/link/PopupSettings.java
Sat May 17 11:16:17 2008
@@ -102,11 +102,11 @@
/**
* Construct. If you are not using these popup settings with an
external link - in which case we
- * don't need to know about a page map - you should use one of the
constructors with a
- * [EMAIL PROTECTED] PageMap} argument. Typically, you should put any
popup in a separate page map as
- * Wicket holds references to a limited number of pages/ versions only.
If you don't put your
- * popup in a separate page map, the user might get page expired
exceptions when getting back to
- * the main window again.
+ * don't need to know about a page map - you should use one of the
constructors with a [EMAIL PROTECTED]
+ * PageMap} argument. Typically, you should put any popup in a separate
page map as Wicket holds
+ * references to a limited number of pages/ versions only. If you don't
put your popup in a
+ * separate page map, the user might get page expired exceptions when
getting back to the main
+ * window again.
*/
public PopupSettings()
{
@@ -116,44 +116,46 @@
* Construct.
*
* @param displayFlags
- * Display flags
+ * Display flags
*/
public PopupSettings(final int displayFlags)
{
- this.displayFlags = displayFlags;
+ this(null, displayFlags);
}
/**
* Construct.
*
* @param pagemap
- * The pagemap where this popup must be in. Typically, you
should put any popup in a
- * separate page map as Wicket holds references to a limited
number of pages/
- * versions only. If you don't put your popup in a separate
page map, the user might
- * get page expired exceptions when getting back to the main
window again.
+ * The pagemap where this popup must be in. Typically, you
should put any popup in a
+ * separate page map as Wicket holds references to a
limited number of pages/ versions
+ * only. If you don't put your popup in a separate page
map, the user might get page
+ * expired exceptions when getting back to the main window
again.
*/
public PopupSettings(IPageMap pagemap)
{
- pageMapName = pagemap.getName();
- windowName = pageMapName;
+ this(pagemap, 0);
}
/**
* Construct.
*
* @param pagemap
- * The pagemap where this popup must be in. Typically, you
should put any popup in a
- * separate page map as Wicket holds references to a limited
number of pages/
- * versions only. If you don't put your popup in a separate
page map, the user might
- * get page expired exceptions when getting back to the main
window again.
+ * The pagemap where this popup must be in. Typically, you
should put any popup in a
+ * separate page map as Wicket holds references to a
limited number of pages/ versions
+ * only. If you don't put your popup in a separate page
map, the user might get page
+ * expired exceptions when getting back to the main window
again.
* @param displayFlags
- * Display flags
+ * Display flags
*/
public PopupSettings(IPageMap pagemap, final int displayFlags)
{
this.displayFlags = displayFlags;
- pageMapName = pagemap.getName();
- windowName = pageMapName;
+ if (pagemap != null)
+ {
+ pageMapName = pagemap.getName();
+ windowName = pageMapName;
+ }
}
/**
@@ -172,7 +174,7 @@
else
{
// Fix for IE bug.
- windowTitle = windowTitle.replace(':', '_');
+ windowTitle = windowTitle.replaceAll("\\W", "_");
}
StringBuffer script = new StringBuffer("var w = window.open(" +
target + ", '").append(
@@ -214,7 +216,7 @@
* Sets the popup window height.
*
* @param popupHeight
- * the popup window height.
+ * the popup window height.
* @return This
*/
public PopupSettings setHeight(int popupHeight)
@@ -227,7 +229,7 @@
* Sets the left position of the popup window.
*
* @param popupPositionLeft
- * the left position of the popup window.
+ * the left position of the popup window.
* @return This
*/
public PopupSettings setLeft(int popupPositionLeft)
@@ -242,7 +244,7 @@
* setting the target explicitly.
*
* @param target
- * the target of the link
+ * the target of the link
*/
public void setTarget(String target)
{
@@ -253,7 +255,7 @@
* Sets the top position of the popup window.
*
* @param popupPositionTop
- * the top position of the popup window.
+ * the top position of the popup window.
* @return This
*/
public PopupSettings setTop(int popupPositionTop)
@@ -266,7 +268,7 @@
* Sets the popup window width.
*
* @param popupWidth
- * the popup window width.
+ * the popup window width.
* @return This
*/
public PopupSettings setWidth(int popupWidth)
@@ -282,7 +284,7 @@
* will be reused rather than opening a second window
*
* @param popupWindowName
- * window name.
+ * window name.
* @return This
*/
public PopupSettings setWindowName(String popupWindowName)
@@ -303,7 +305,7 @@
/**
* @param flag
- * The flag to test
+ * The flag to test
* @return Yes or no depending on whether the flag is set
*/
private String flagToString(final int flag)
@@ -336,10 +338,10 @@
* Gets the pagemap where the popup page must be created in.
*
* @param callee
- * Calling component
+ * Calling component
* @return The pagemap where the popup page must be created in
*/
- public IPageMap getPageMap(Component< ? > callee)
+ public IPageMap getPageMap(Component<?> callee)
{
if (pageMapName != null)
{
@@ -352,7 +354,7 @@
throw new IllegalArgumentException(
"when the page map is not set, argument
callee may not be null");
}
- Page< ? > page = callee.getPage();
+ Page<?> page = callee.getPage();
if (page == null)
{
throw new IllegalStateException(callee +