From: Henri Sara
Date: Thu, 28 Oct 2010 08:58:56 +0000 (+0000)
Subject: #3865 closing sub-windows from code should send close event, test for window closing
X-Git-Tag: 6.7.0.beta1~949
X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=146924c65421cab4779c353706d477b45f63a433;p=vaadin-framework.git
#3865 closing sub-windows from code should send close event, test for window closing
svn changeset:15758/svn branch:6.5
---
diff --git a/WebContent/release-notes.html b/WebContent/release-notes.html
index 308b1417d0..727eaac791 100644
--- a/WebContent/release-notes.html
+++ b/WebContent/release-notes.html
@@ -51,6 +51,9 @@ contains a number of significant enhancements.
Table.setColumnCollapsed throws IllegalStateException instead of IllegalAccessException is collapsing is not allowed.
+
Window.removeWindow(Window) now triggers window close listeners also when called explicitly.
+ See #3865 for more info.
+
diff --git a/src/com/vaadin/ui/Window.java b/src/com/vaadin/ui/Window.java
index fde6058f93..fed7dabd36 100644
--- a/src/com/vaadin/ui/Window.java
+++ b/src/com/vaadin/ui/Window.java
@@ -1102,11 +1102,9 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
*
*
*
- * If one wants change the default behavior, register a window close
- * listenter and do something else. For example, you could re-open the
- * browser-level window with mainWindow.open(), re-add the removed
- * sub-window back to its parent or remove browser-level window
- * automatically from the application.
+ * To explicitly close a sub-window, use {@link #removeWindow(Window)}. To
+ * react to a window being closed (after it is closed), register a
+ * {@link CloseListener}.
*
*/
protected void close() {
@@ -1116,7 +1114,6 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
} else {
// subwindow is removed from parent
parent.removeWindow(this);
- fireClose();
}
}
@@ -1250,8 +1247,8 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
* user closes the window.
*
*
- * Note that removing windows using {@link #removeWindow(Window)} will not
- * fire the CloseListener.
+ * Since Vaadin 6.5, removing windows using {@link #removeWindow(Window)}
+ * does fire the CloseListener.
*
*/
public interface CloseListener extends Serializable {
@@ -1277,8 +1274,8 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
* mean it will be destroyed.
*
*
- * Note that removing windows using {@link #removeWindow(Window)} will not
- * fire the CloseListener.
+ * Since Vaadin 6.5, removing windows using {@link #removeWindow(Window)}
+ * does fire the CloseListener.
*
*
* @param listener
@@ -1431,12 +1428,16 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
/**
* Remove the given subwindow from this window.
*
+ * Since Vaadin 6.5, {@link CloseListener}s are called also when explicitly
+ * removing a window by calling this method.
+ *
* @param window
* Window to be removed.
*/
public void removeWindow(Window window) {
subwindows.remove(window);
window.setParent(null);
+ window.fireClose();
requestRepaint();
}
diff --git a/tests/src/com/vaadin/tests/components/window/CloseSubWindow.html b/tests/src/com/vaadin/tests/components/window/CloseSubWindow.html
new file mode 100644
index 0000000000..d4d404fbe6
--- /dev/null
+++ b/tests/src/com/vaadin/tests/components/window/CloseSubWindow.html
@@ -0,0 +1,87 @@
+
+
+
+
+
+
+CloseSubWindow
+
+
+