summaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/ui/Window.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/vaadin/ui/Window.java')
-rw-r--r--src/com/vaadin/ui/Window.java28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/com/vaadin/ui/Window.java b/src/com/vaadin/ui/Window.java
index b31255cb26..5c2769c756 100644
--- a/src/com/vaadin/ui/Window.java
+++ b/src/com/vaadin/ui/Window.java
@@ -1,4 +1,4 @@
-/*
+/*
@ITMillApache2LicenseForJavaFiles@
*/
@@ -1120,6 +1120,10 @@ public class Window extends Panel implements URIHandler, ParameterHandler,
if (parent == null) {
fireClose();
} else {
+
+ // focus is restored to the parent window
+ parent.focus();
+
// subwindow is removed from parent
parent.removeWindow(this);
}
@@ -2089,7 +2093,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler,
* <code>
* // within the window using helper
* subWindow.setCloseShortcut(KeyCode.ESCAPE, null);
- *
+ *
* // or globally
* getWindow().addAction(new Window.CloseShortcut(subWindow, KeyCode.ESCAPE));
* </code>
@@ -2180,4 +2184,24 @@ public class Window extends Panel implements URIHandler, ParameterHandler,
removeListener(BlurEvent.EVENT_ID, BlurEvent.class, listener);
}
+ /**
+ * {@inheritDoc}
+ *
+ * If the window is a sub-window focusing will cause the sub-window to be
+ * brought on top of other sub-windows on gain keyboard focus.
+ */
+ @Override
+ public void focus() {
+ if (getParent() != null) {
+ /*
+ * When focusing a sub-window it basically means it should be
+ * brought to the front. Instead of just moving the keyboard focus
+ * we focus the window and bring it top-most.
+ */
+ bringToFront();
+ } else {
+ super.focus();
+ }
+ }
+
}