You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by iv...@apache.org on 2013/03/04 21:42:54 UTC

git commit: WICKET-5075

Updated Branches:
  refs/heads/master 67053bb3b -> e916ac5a4


WICKET-5075


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/e916ac5a
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/e916ac5a
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/e916ac5a

Branch: refs/heads/master
Commit: e916ac5a4ae5fb8db225367d3d29d4773a6da3ee
Parents: 67053bb
Author: Igor Vaynberg <ig...@gmail.com>
Authored: Mon Mar 4 12:42:49 2013 -0800
Committer: Igor Vaynberg <ig...@gmail.com>
Committed: Mon Mar 4 12:42:49 2013 -0800

----------------------------------------------------------------------
 .../ajax/markup/html/modal/ModalWindow.java        |   45 ++++++++-------
 1 files changed, 24 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/e916ac5a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalWindow.java
----------------------------------------------------------------------
diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalWindow.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalWindow.java
index 347db83..a7f1f76 100644
--- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalWindow.java
+++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalWindow.java
@@ -17,11 +17,12 @@
 package org.apache.wicket.extensions.ajax.markup.html.modal;
 
 import org.apache.wicket.Component;
-import org.apache.wicket.util.io.IClusterable;
 import org.apache.wicket.Page;
 import org.apache.wicket.WicketRuntimeException;
 import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior;
 import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.core.request.handler.PageProvider;
+import org.apache.wicket.core.request.handler.RenderPageRequestHandler;
 import org.apache.wicket.markup.ComponentTag;
 import org.apache.wicket.markup.head.CssHeaderItem;
 import org.apache.wicket.markup.head.IHeaderResponse;
@@ -33,12 +34,11 @@ import org.apache.wicket.model.IModel;
 import org.apache.wicket.model.Model;
 import org.apache.wicket.request.IRequestHandler;
 import org.apache.wicket.request.cycle.RequestCycle;
-import org.apache.wicket.core.request.handler.PageProvider;
-import org.apache.wicket.core.request.handler.RenderPageRequestHandler;
 import org.apache.wicket.request.resource.CssResourceReference;
 import org.apache.wicket.request.resource.JavaScriptResourceReference;
 import org.apache.wicket.request.resource.ResourceReference;
 import org.apache.wicket.resource.CoreLibrariesContributor;
+import org.apache.wicket.util.io.IClusterable;
 import org.apache.wicket.util.lang.EnumeratedType;
 import org.apache.wicket.util.string.AppendingStringBuffer;
 import org.apache.wicket.util.string.Strings;
@@ -60,13 +60,14 @@ import org.apache.wicket.util.string.Strings;
  * <code>{@link #setPageCreator(ModalWindow.PageCreator)}</code> method.
  * </ul>
  * In case the content is a component, it is not rendered until the window is shown (method
- * <code>{@link #show(org.apache.wicket.ajax.AjaxRequestTarget)})</code>. The window can be made visible from an ajax
- * handler using <code>{@link #show(org.apache.wicket.ajax.AjaxRequestTarget)}</code>.
+ * <code>{@link #show(org.apache.wicket.ajax.AjaxRequestTarget)})</code>. The window can be made
+ * visible from an ajax handler using
+ * <code>{@link #show(org.apache.wicket.ajax.AjaxRequestTarget)}</code>.
  * <p>
  * To close the window there are multiple options. Static method
- * <code>{@link #close(org.apache.wicket.ajax.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>{@link #close(org.apache.wicket.ajax.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>{@link #setCloseButtonCallback(ModalWindow.CloseButtonCallback)}</code>. If you want to be
  * notified when the window is closed (either using the close button or calling
  * <code>{@link #close(org.apache.wicket.ajax.AjaxRequestTarget)})</code>, you can use
@@ -189,10 +190,12 @@ public class ModalWindow extends Panel
 	{
 		/**
 		 * Methods invoked after the button has been clicked. The invocation is done using an ajax
-		 * call, so <code>{@link org.apache.wicket.ajax.AjaxRequestTarget}</code> instance is available.
+		 * call, so <code>{@link org.apache.wicket.ajax.AjaxRequestTarget}</code> instance is
+		 * available.
 		 * 
 		 * @param target
-		 *            <code>{@link org.apache.wicket.ajax.AjaxRequestTarget}</code> instance bound with the ajax request.
+		 *            <code>{@link org.apache.wicket.ajax.AjaxRequestTarget}</code> instance bound
+		 *            with the ajax request.
 		 * 
 		 * @return True if the window can be closed (will close the window), false otherwise
 		 */
@@ -212,7 +215,8 @@ public class ModalWindow extends Panel
 		 * Called after the window has been closed.
 		 * 
 		 * @param target
-		 *            <code>{@link org.apache.wicket.ajax.AjaxRequestTarget}</code> instance bound with the ajax request.
+		 *            <code>{@link org.apache.wicket.ajax.AjaxRequestTarget}</code> instance bound
+		 *            with the ajax request.
 		 */
 		public void onClose(AjaxRequestTarget target);
 	}
@@ -408,13 +412,11 @@ public class ModalWindow extends Panel
 	private static String getCloseJavacriptInternal()
 	{
 		return "var win;\n" //
-			+ "try {\n"
-			+ "	win = window.parent.Wicket.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"
+			+ "  try {\n" + "     win = window.Wicket.Window;\n"
 			+ "  } catch (ignore) {\n"
 			+ "  }\n"
 			+ "}\n"
@@ -630,7 +632,7 @@ public class ModalWindow extends Panel
 
 	/**
 	 * Sets a flag whether to ask the user before leaving the page.
-	 *
+	 * 
 	 * @param unloadConfirmation
 	 *            a flag whether to ask the user before leaving the page
 	 * @return {@code this} instance, for chaining
@@ -643,9 +645,9 @@ public class ModalWindow extends Panel
 
 	/**
 	 * Returns whether the user should be asked before leaving the page.
-	 *
-	 * @return {@code true} if the user should be asked if the last action
-	 *  causes leaving the page, {@code false} otherwise
+	 * 
+	 * @return {@code true} if the user should be asked if the last action causes leaving the page,
+	 *         {@code false} otherwise
 	 */
 	public boolean showUnloadConfirmation()
 	{
@@ -1149,7 +1151,7 @@ public class ModalWindow extends Panel
 			CloseButtonBehavior behavior = getBehaviors(CloseButtonBehavior.class).get(0);
 			buffer.append("settings.onCloseButton = function() { ");
 			buffer.append(behavior.getCallbackScript());
-			buffer.append("};\n");
+			buffer.append(";return false;};\n");
 		}
 
 		postProcessSettings(buffer);
@@ -1252,7 +1254,8 @@ public class ModalWindow extends Panel
 	}
 
 	/**
-	 * Gives the possibility to provide custom {@link org.apache.wicket.ajax.attributes.IAjaxCallListener}
+	 * Gives the possibility to provide custom
+	 * {@link org.apache.wicket.ajax.attributes.IAjaxCallListener}
 	 * 
 	 * @return the behavior that should be used for the window close button
 	 */