From 720ee8097614a9485d74dd0cc462d0c2d0297cec Mon Sep 17 00:00:00 2001 From: Marc Englund Date: Mon, 29 Oct 2012 17:10:21 +0200 Subject: [PATCH] Overlay container #9220 Change-Id: Iea5b44fc0c48ec1161890d9e084847266ce0d3d2 --- .../components/notification/notification.scss | 2 +- .../reindeer/notification/notification.scss | 2 +- .../VaadinBrowserSpecificOverrides.gwt.xml | 9 +++ .../client/ApplicationConfiguration.java | 2 +- .../vaadin/client/ApplicationConnection.java | 14 +++- .../src/com/vaadin/client/LayoutManager.java | 6 +- client/src/com/vaadin/client/Util.java | 7 +- .../src/com/vaadin/client/VDebugConsole.java | 4 +- .../src/com/vaadin/client/VErrorMessage.java | 18 +++++ client/src/com/vaadin/client/VTooltip.java | 13 ++- client/src/com/vaadin/client/ui/VOverlay.java | 79 ++++++++++++++++++- .../src/com/vaadin/client/ui/VPopupImpl.java | 17 ++++ .../vaadin/client/ui/VPopupImplMozilla.java | 17 ++++ .../client/ui/combobox/VFilterSelect.java | 1 + .../client/ui/datefield/VPopupCalendar.java | 2 + .../src/com/vaadin/client/ui/form/VForm.java | 2 + .../com/vaadin/client/ui/menubar/MenuBar.java | 1 + .../vaadin/client/ui/menubar/VMenuBar.java | 1 + .../client/ui/notification/VNotification.java | 6 +- .../client/ui/popupview/VPopupView.java | 2 +- .../com/vaadin/client/ui/slider/VSlider.java | 3 + .../com/vaadin/client/ui/window/VWindow.java | 20 ++--- .../client/ui/window/WindowConnector.java | 2 + .../v7a3/CapsLockWarningConnector.java | 1 + .../v7b1/CapsLockWarningWithRpcConnector.java | 1 + 25 files changed, 196 insertions(+), 36 deletions(-) create mode 100644 client/src/com/vaadin/client/ui/VPopupImpl.java create mode 100644 client/src/com/vaadin/client/ui/VPopupImplMozilla.java diff --git a/WebContent/VAADIN/themes/chameleon/components/notification/notification.scss b/WebContent/VAADIN/themes/chameleon/components/notification/notification.scss index 9036c5c2d6..020c29ed09 100644 --- a/WebContent/VAADIN/themes/chameleon/components/notification/notification.scss +++ b/WebContent/VAADIN/themes/chameleon/components/notification/notification.scss @@ -4,7 +4,7 @@ div.v-Notification { -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0; - font-size: 100%; + font-size: 16px; -webkit-box-shadow: 0 2px 5px rgba(0,0,0,.7); -moz-box-shadow: 0 2px 5px rgba(0,0,0,.7); box-shadow: 0 2px 5px rgba(0,0,0,.7); diff --git a/WebContent/VAADIN/themes/reindeer/notification/notification.scss b/WebContent/VAADIN/themes/reindeer/notification/notification.scss index 464faa8aab..aafff47e96 100644 --- a/WebContent/VAADIN/themes/reindeer/notification/notification.scss +++ b/WebContent/VAADIN/themes/reindeer/notification/notification.scss @@ -5,7 +5,7 @@ border-radius: 4px; -moz-border-radius: 4px; -webkit-border-radius: 4px; - font-size: 100%; + font-size: 16px; background: #c8ccd0; font-weight: bold; } diff --git a/client/src/com/vaadin/VaadinBrowserSpecificOverrides.gwt.xml b/client/src/com/vaadin/VaadinBrowserSpecificOverrides.gwt.xml index 9b3049a60c..09b901ec38 100644 --- a/client/src/com/vaadin/VaadinBrowserSpecificOverrides.gwt.xml +++ b/client/src/com/vaadin/VaadinBrowserSpecificOverrides.gwt.xml @@ -43,5 +43,14 @@ + + + + + + + + + diff --git a/client/src/com/vaadin/client/ApplicationConfiguration.java b/client/src/com/vaadin/client/ApplicationConfiguration.java index 1432e1d5cc..4159b38211 100644 --- a/client/src/com/vaadin/client/ApplicationConfiguration.java +++ b/client/src/com/vaadin/client/ApplicationConfiguration.java @@ -378,8 +378,8 @@ public class ApplicationConfiguration implements EntryPoint { ApplicationConnection a = GWT .create(ApplicationConnection.class); a.init(widgetSet, appConf); - a.start(); runningApplications.add(a); + a.start(); } }); } diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java index 750e733b51..b43ed6c9fa 100644 --- a/client/src/com/vaadin/client/ApplicationConnection.java +++ b/client/src/com/vaadin/client/ApplicationConnection.java @@ -343,6 +343,7 @@ public class ApplicationConnection { rpcManager = GWT.create(RpcManager.class); layoutManager = GWT.create(LayoutManager.class); layoutManager.setConnection(this); + tooltip = GWT.create(VTooltip.class); } public void init(WidgetSet widgetSet, ApplicationConfiguration cnf) { @@ -371,6 +372,9 @@ public class ApplicationConnection { initializeClientHooks(); uIConnector.init(cnf.getRootPanelId(), this); + + tooltip.setOwner(uIConnector.getWidget()); + showLoadingIndicator(); scheduleHeartbeat(); @@ -926,7 +930,8 @@ public class ApplicationConnection { html.append(details); html.append("

"); - VNotification n = VNotification.createNotification(1000 * 60 * 45); + VNotification n = VNotification.createNotification(1000 * 60 * 45, + uIConnector.getWidget()); n.addEventListener(new NotificationRedirect(url)); n.show(html.toString(), VNotification.CENTERED_TOP, VNotification.STYLE_SYSTEM); @@ -1375,8 +1380,8 @@ public class ApplicationConnection { if (html.length() != 0) { /* 45 min */ - VNotification n = VNotification - .createNotification(1000 * 60 * 45); + VNotification n = VNotification.createNotification( + 1000 * 60 * 45, uIConnector.getWidget()); n.addEventListener(new NotificationRedirect(url)); n.show(html, VNotification.CENTERED_TOP, VNotification.STYLE_SYSTEM); @@ -2578,6 +2583,7 @@ public class ApplicationConnection { public VContextMenu getContextMenu() { if (contextMenu == null) { contextMenu = new VContextMenu(); + contextMenu.setOwner(uIConnector.getWidget()); DOM.setElementProperty(contextMenu.getElement(), "id", "PID_VAADIN_CM"); } @@ -2680,7 +2686,7 @@ public class ApplicationConnection { /* Extended title handling */ - private final VTooltip tooltip = new VTooltip(this); + private final VTooltip tooltip; private ConnectorMap connectorMap = GWT.create(ConnectorMap.class); diff --git a/client/src/com/vaadin/client/LayoutManager.java b/client/src/com/vaadin/client/LayoutManager.java index 1106d6eae2..9ed8f261e7 100644 --- a/client/src/com/vaadin/client/LayoutManager.java +++ b/client/src/com/vaadin/client/LayoutManager.java @@ -400,9 +400,9 @@ public class LayoutManager { if (passes > 100) { VConsole.log(LOOP_ABORT_MESSAGE); - VNotification.createNotification(VNotification.DELAY_FOREVER) - .show(LOOP_ABORT_MESSAGE, VNotification.CENTERED, - "error"); + VNotification.createNotification(VNotification.DELAY_FOREVER, + connection.getRootConnector().getWidget()).show( + LOOP_ABORT_MESSAGE, VNotification.CENTERED, "error"); break; } } diff --git a/client/src/com/vaadin/client/Util.java b/client/src/com/vaadin/client/Util.java index bf4dca7712..c9fe22528d 100644 --- a/client/src/com/vaadin/client/Util.java +++ b/client/src/com/vaadin/client/Util.java @@ -114,7 +114,7 @@ public class Util { } } - private static ComponentConnector findConnectorFor(Widget widget) { + public static ComponentConnector findConnectorFor(Widget widget) { List runningApplications = ApplicationConfiguration .getRunningApplications(); for (ApplicationConnection applicationConnection : runningApplications) { @@ -702,8 +702,9 @@ public class Util { // If the overlay has an owner, try to find the owner's connector VOverlay overlay = findWidget(element, VOverlay.class); if (overlay != null && overlay.getOwner() != null) { - return getConnectorForElement(client, RootPanel.get(), overlay - .getOwner().getElement()); + + return getConnectorForElement(client, client.getRootConnector() + .getWidget(), overlay.getOwner().getElement()); } else { return null; } diff --git a/client/src/com/vaadin/client/VDebugConsole.java b/client/src/com/vaadin/client/VDebugConsole.java index 0d1c6d89f6..a5dbc9ede5 100644 --- a/client/src/com/vaadin/client/VDebugConsole.java +++ b/client/src/com/vaadin/client/VDebugConsole.java @@ -694,8 +694,8 @@ public class VDebugConsole extends VOverlay implements Console { e.printStackTrace(); } try { - VNotification.createNotification(VNotification.DELAY_FOREVER).show( - "

Uncaught client side exception


" + VNotification.createNotification(VNotification.DELAY_FOREVER, null) + .show("

Uncaught client side exception


" + exceptionText, VNotification.CENTERED, "error"); } catch (Exception e2) { // Just swallow this exception diff --git a/client/src/com/vaadin/client/VErrorMessage.java b/client/src/com/vaadin/client/VErrorMessage.java index 3e3807a5da..a1823b3bc9 100644 --- a/client/src/com/vaadin/client/VErrorMessage.java +++ b/client/src/com/vaadin/client/VErrorMessage.java @@ -20,16 +20,33 @@ import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Element; import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.HTML; +import com.google.gwt.user.client.ui.Widget; import com.vaadin.client.ui.VOverlay; public class VErrorMessage extends FlowPanel { public static final String CLASSNAME = "v-errormessage"; + private Widget owner; + public VErrorMessage() { super(); setStyleName(CLASSNAME); } + /** + * Set the owner, i.e the Widget that created this {@link VErrorMessage}. + * The owner must be set if the {@link VErrorMessage} is created + * 'stand-alone' (not within a {@link VOverlay}), or theming might not work + * properly. + * + * @see VOverlay#setOwner(Widget) + * @param owner + * the owner (creator Widget) + */ + public void setOwner(Widget owner) { + this.owner = owner; + } + public void updateMessage(String htmlErrorMessage) { clear(); if (htmlErrorMessage == null || htmlErrorMessage.length() == 0) { @@ -50,6 +67,7 @@ public class VErrorMessage extends FlowPanel { if (errorContainer == null) { errorContainer = new VOverlay(); errorContainer.setWidget(this); + errorContainer.setOwner(owner); } errorContainer.setPopupPosition( DOM.getAbsoluteLeft(indicatorElement) diff --git a/client/src/com/vaadin/client/VTooltip.java b/client/src/com/vaadin/client/VTooltip.java index 8de559264d..a4c4766e4f 100644 --- a/client/src/com/vaadin/client/VTooltip.java +++ b/client/src/com/vaadin/client/VTooltip.java @@ -50,13 +50,19 @@ public class VTooltip extends VOverlay { private boolean closing = false; private boolean opening = false; - private ApplicationConnection ac; + // Open next tooltip faster. Disabled after 2 sec of showTooltip-silence. private boolean justClosed = false; - public VTooltip(ApplicationConnection client) { + /** + * Used to show tooltips; usually used via the singleton in + * {@link ApplicationConnection}. NOTE that #setOwner(Widget)} should be + * called after instantiating. + * + * @see ApplicationConnection#getVTooltip() + */ + public VTooltip() { super(false, false, true); - ac = client; setStyleName(CLASSNAME); FlowPanel layout = new FlowPanel(); setWidget(layout); @@ -268,6 +274,7 @@ public class VTooltip extends VOverlay { */ private boolean resolveConnector(Element element) { + ApplicationConnection ac = getApplicationConnection(); ComponentConnector connector = Util.getConnectorForElement(ac, RootPanel.get(), element); diff --git a/client/src/com/vaadin/client/ui/VOverlay.java b/client/src/com/vaadin/client/ui/VOverlay.java index 6dfcd97516..064e9fae44 100644 --- a/client/src/com/vaadin/client/ui/VOverlay.java +++ b/client/src/com/vaadin/client/ui/VOverlay.java @@ -30,7 +30,10 @@ import com.google.gwt.user.client.Element; import com.google.gwt.user.client.ui.PopupPanel; import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.Widget; +import com.vaadin.client.ApplicationConnection; import com.vaadin.client.BrowserInfo; +import com.vaadin.client.ComponentConnector; +import com.vaadin.client.Util; /** * In Vaadin UI this Overlay should always be used for all elements that @@ -126,6 +129,15 @@ public class VOverlay extends PopupPanel implements CloseHandler { */ private Widget owner; + /* + * ApplicationConnection that this overlay belongs to, which is needed to + * create the overlay in the correct container so that the correct styles + * are applied. If not given, owner will be used to figure out, and as a + * last fallback, the overlay is created w/o container, potentially missing + * styles. + */ + protected ApplicationConnection ac; + /** * The shim iframe behind the overlay, allowing PDFs and applets to be * covered by overlays. @@ -328,14 +340,25 @@ public class VOverlay extends PopupPanel implements CloseHandler { return leftFix; } + /* + * A "thread local" of sorts, set temporarily so that VOverlayImpl knows + * which VOverlay is using it, so that it can be attached to the correct + * overlay container. + * + * TODO this is a strange pattern that we should get rid of when possible. + */ + protected static VOverlay current; + @Override public void show() { + current = this; super.show(); if (isAnimationEnabled()) { new ResizeAnimation().run(POPUP_PANEL_ANIMATION_DURATION); } else { positionOrSizeUpdated(1.0); } + current = null; } @Override @@ -482,14 +505,14 @@ public class VOverlay extends PopupPanel implements CloseHandler { DOM.getChild(shadow, 5).getOffsetHeight()); } + Element container = getElement().getParentElement().cast(); // Attach to dom if not there already if (isShadowEnabled() && !isShadowAttached()) { - RootPanel.get().getElement().insertBefore(shadow, getElement()); + container.insertBefore(shadow, getElement()); sinkShadowEvents(); } if (needsShimElement() && !isShimElementAttached()) { - RootPanel.get().getElement() - .insertBefore(getShimElement(), getElement()); + container.insertBefore(getShimElement(), getElement()); } } @@ -592,4 +615,54 @@ public class VOverlay extends PopupPanel implements CloseHandler { public void setOwner(Widget owner) { this.owner = owner; } + + /** + * Get the {@link ApplicationConnection} that this overlay belongs to. If + * it's not set, {@link #getOwner()} is used to figure it out. + * + * @return + */ + protected ApplicationConnection getApplicationConnection() { + if (ac != null) { + return ac; + } else if (owner != null) { + ComponentConnector c = Util.findConnectorFor(owner); + if (c != null) { + ac = c.getConnection(); + } + return ac; + } else { + return null; + } + } + + /** + * Gets the 'overlay container' element pertaining to the given + * {@link ApplicationConnection}. Each overlay should be created in a + * overlay container element, so that the correct theme and styles can be + * applied. + * + * @param ac + * @return + */ + public Element getOverlayContainer() { + ApplicationConnection ac = getApplicationConnection(); + if (ac == null) { + // could not figure out which one we belong to, styling might fail + return RootPanel.get().getElement(); + } else { + String id = ac.getConfiguration().getRootPanelId(); + id = id += "-overlays"; + Element container = DOM.getElementById(id); + if (container == null) { + container = DOM.createDiv(); + container.setId(id); + String styles = ac.getRootConnector().getWidget().getParent() + .getStyleName(); + container.setClassName(styles); + RootPanel.get().getElement().appendChild(container); + } + return container; + } + } } diff --git a/client/src/com/vaadin/client/ui/VPopupImpl.java b/client/src/com/vaadin/client/ui/VPopupImpl.java new file mode 100644 index 0000000000..842025a94f --- /dev/null +++ b/client/src/com/vaadin/client/ui/VPopupImpl.java @@ -0,0 +1,17 @@ +package com.vaadin.client.ui; + +import com.google.gwt.dom.client.Element; +import com.google.gwt.user.client.ui.impl.PopupImpl; + +public class VPopupImpl extends PopupImpl { + + @Override + public void onShow(Element popup) { + // Move the overlay to the appropriate overlay container + Element e = VOverlay.current.getOverlayContainer(); + e.appendChild(popup); + + super.onShow(popup); + } + +} diff --git a/client/src/com/vaadin/client/ui/VPopupImplMozilla.java b/client/src/com/vaadin/client/ui/VPopupImplMozilla.java new file mode 100644 index 0000000000..4e5b46f056 --- /dev/null +++ b/client/src/com/vaadin/client/ui/VPopupImplMozilla.java @@ -0,0 +1,17 @@ +package com.vaadin.client.ui; + +import com.google.gwt.dom.client.Element; +import com.google.gwt.user.client.ui.impl.PopupImplMozilla; + +public class VPopupImplMozilla extends PopupImplMozilla { + + @Override + public void onShow(Element popup) { + // Move the overlay to the appropriate overlay container + Element e = VOverlay.current.getOverlayContainer(); + e.appendChild(popup); + + super.onShow(popup); + } + +} diff --git a/client/src/com/vaadin/client/ui/combobox/VFilterSelect.java b/client/src/com/vaadin/client/ui/combobox/VFilterSelect.java index c08371af95..4241daca6f 100644 --- a/client/src/com/vaadin/client/ui/combobox/VFilterSelect.java +++ b/client/src/com/vaadin/client/ui/combobox/VFilterSelect.java @@ -201,6 +201,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, */ SuggestionPopup() { super(true, false, true); + setOwner(VFilterSelect.this); menu = new SuggestionMenu(); setWidget(menu); diff --git a/client/src/com/vaadin/client/ui/datefield/VPopupCalendar.java b/client/src/com/vaadin/client/ui/datefield/VPopupCalendar.java index 0762b965e1..05f1d004f8 100644 --- a/client/src/com/vaadin/client/ui/datefield/VPopupCalendar.java +++ b/client/src/com/vaadin/client/ui/datefield/VPopupCalendar.java @@ -102,6 +102,8 @@ public class VPopupCalendar extends VTextualDate implements Field, }); popup = new VOverlay(true, true, true); + popup.setOwner(this); + popup.setWidget(calendar); popup.addCloseHandler(this); diff --git a/client/src/com/vaadin/client/ui/form/VForm.java b/client/src/com/vaadin/client/ui/form/VForm.java index eb206e75b9..ac877bd12f 100644 --- a/client/src/com/vaadin/client/ui/form/VForm.java +++ b/client/src/com/vaadin/client/ui/form/VForm.java @@ -72,6 +72,8 @@ public class VForm extends ComplexPanel implements KeyDownHandler { fieldSet.appendChild(errorMessage.getElement()); fieldSet.appendChild(footerContainer); + + errorMessage.setOwner(this); } @Override diff --git a/client/src/com/vaadin/client/ui/menubar/MenuBar.java b/client/src/com/vaadin/client/ui/menubar/MenuBar.java index c5ea865e2f..cb44023516 100644 --- a/client/src/com/vaadin/client/ui/menubar/MenuBar.java +++ b/client/src/com/vaadin/client/ui/menubar/MenuBar.java @@ -398,6 +398,7 @@ public class MenuBar extends Widget implements PopupListener { { setWidget(item.getSubMenu()); item.getSubMenu().onShow(); + setOwner(MenuBar.this); } @Override diff --git a/client/src/com/vaadin/client/ui/menubar/VMenuBar.java b/client/src/com/vaadin/client/ui/menubar/VMenuBar.java index 83b1c58d0a..1837cbc8f4 100644 --- a/client/src/com/vaadin/client/ui/menubar/VMenuBar.java +++ b/client/src/com/vaadin/client/ui/menubar/VMenuBar.java @@ -559,6 +559,7 @@ public class VMenuBar extends SimpleFocusablePanel implements final int shadowSpace = 10; popup = new VOverlay(true, false, true); + popup.setOwner(this); /* * Use parents primary style name if possible and remove the submenu diff --git a/client/src/com/vaadin/client/ui/notification/VNotification.java b/client/src/com/vaadin/client/ui/notification/VNotification.java index 44dfaffd6e..1c456a53b3 100644 --- a/client/src/com/vaadin/client/ui/notification/VNotification.java +++ b/client/src/com/vaadin/client/ui/notification/VNotification.java @@ -424,10 +424,11 @@ public class VNotification extends VOverlay { final int delay = notification .getIntAttribute(UIConstants.ATTRIBUTE_NOTIFICATION_DELAY); - createNotification(delay).show(html, position, style); + createNotification(delay, client.getRootConnector().getWidget()).show( + html, position, style); } - public static VNotification createNotification(int delayMsec) { + public static VNotification createNotification(int delayMsec, Widget owner) { final VNotification notification = GWT.create(VNotification.class); notification.delayMsec = delayMsec; if (BrowserInfo.get().isTouchDevice()) { @@ -440,6 +441,7 @@ public class VNotification extends VOverlay { } }.schedule(notification.delayMsec + TOUCH_DEVICE_IDLE_DELAY); } + notification.setOwner(owner); return notification; } diff --git a/client/src/com/vaadin/client/ui/popupview/VPopupView.java b/client/src/com/vaadin/client/ui/popupview/VPopupView.java index fd1e9e2dbe..88ee3afada 100644 --- a/client/src/com/vaadin/client/ui/popupview/VPopupView.java +++ b/client/src/com/vaadin/client/ui/popupview/VPopupView.java @@ -204,7 +204,7 @@ public class VPopupView extends HTML { public CustomPopup() { super(true, false, true); // autoHide, not modal, dropshadow - + setOwner(VPopupView.this); // Delegate popup keyboard events to the relevant handler. The // events do not propagate automatically because the popup is // directly attached to the RootPanel. diff --git a/client/src/com/vaadin/client/ui/slider/VSlider.java b/client/src/com/vaadin/client/ui/slider/VSlider.java index 58db8494f0..ab080dc17f 100644 --- a/client/src/com/vaadin/client/ui/slider/VSlider.java +++ b/client/src/com/vaadin/client/ui/slider/VSlider.java @@ -72,6 +72,9 @@ public class VSlider extends SimpleFocusablePanel implements Field, private final HTML feedback = new HTML("", false); private final VOverlay feedbackPopup = new VOverlay(true, false, true) { + { + setOwner(VSlider.this); + } @Override public void show() { diff --git a/client/src/com/vaadin/client/ui/window/VWindow.java b/client/src/com/vaadin/client/ui/window/VWindow.java index 264ed57ced..e7bfd4dbdb 100644 --- a/client/src/com/vaadin/client/ui/window/VWindow.java +++ b/client/src/com/vaadin/client/ui/window/VWindow.java @@ -36,7 +36,6 @@ import com.google.gwt.user.client.Element; import com.google.gwt.user.client.Event; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.HasWidgets; -import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.Widget; import com.vaadin.client.ApplicationConnection; import com.vaadin.client.BrowserInfo; @@ -433,16 +432,11 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, private void showModalityCurtain() { DOM.setStyleAttribute(getModalityCurtain(), "zIndex", "" + (windowOrder.indexOf(this) + Z_INDEX)); - if (isShowing()) { - RootPanel.getBodyElement().insertBefore(getModalityCurtain(), - getElement()); - } else { - DOM.appendChild(RootPanel.getBodyElement(), getModalityCurtain()); - } + getOverlayContainer().appendChild(getModalityCurtain()); } private void hideModalityCurtain() { - DOM.removeChild(RootPanel.getBodyElement(), modalityCurtain); + modalityCurtain.removeFromParent(); } /* @@ -450,12 +444,13 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, * iframes (etc) do not steal event. */ private void showDraggingCurtain() { - DOM.appendChild(RootPanel.getBodyElement(), getDraggingCurtain()); + getElement().getParentElement().insertBefore(getDraggingCurtain(), + getElement()); } private void hideDraggingCurtain() { if (draggingCurtain != null) { - DOM.removeChild(RootPanel.getBodyElement(), draggingCurtain); + draggingCurtain.removeFromParent(); } } @@ -464,12 +459,13 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, * that iframes (etc) do not steal event. */ private void showResizingCurtain() { - DOM.appendChild(RootPanel.getBodyElement(), getResizingCurtain()); + getElement().getParentElement().insertBefore(getResizingCurtain(), + getElement()); } private void hideResizingCurtain() { if (resizingCurtain != null) { - DOM.removeChild(RootPanel.getBodyElement(), resizingCurtain); + resizingCurtain.removeFromParent(); } } diff --git a/client/src/com/vaadin/client/ui/window/WindowConnector.java b/client/src/com/vaadin/client/ui/window/WindowConnector.java index b975ab8e88..3091ab82d0 100644 --- a/client/src/com/vaadin/client/ui/window/WindowConnector.java +++ b/client/src/com/vaadin/client/ui/window/WindowConnector.java @@ -75,6 +75,8 @@ public class WindowConnector extends AbstractComponentContainerConnector getWidget().contentPanel.getElement()); getLayoutManager().registerDependency(this, getWidget().header); getLayoutManager().registerDependency(this, getWidget().footer); + + getWidget().setOwner(getConnection().getRootConnector().getWidget()); } @Override diff --git a/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a3/CapsLockWarningConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a3/CapsLockWarningConnector.java index 7b1a56dc62..044c5a18f6 100644 --- a/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a3/CapsLockWarningConnector.java +++ b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a3/CapsLockWarningConnector.java @@ -19,6 +19,7 @@ public class CapsLockWarningConnector extends AbstractExtensionConnector { final Widget passwordWidget = ((ComponentConnector) target).getWidget(); final VOverlay warning = new VOverlay(); + warning.setOwner(passwordWidget); warning.add(new HTML("Caps Lock is enabled!")); passwordWidget.addDomHandler(new KeyPressHandler() { diff --git a/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7b1/CapsLockWarningWithRpcConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7b1/CapsLockWarningWithRpcConnector.java index fdd14d40d5..b7dead9819 100644 --- a/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7b1/CapsLockWarningWithRpcConnector.java +++ b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7b1/CapsLockWarningWithRpcConnector.java @@ -23,6 +23,7 @@ public class CapsLockWarningWithRpcConnector extends AbstractExtensionConnector final Widget passwordWidget = ((ComponentConnector) target).getWidget(); final VOverlay warning = new VOverlay(); + warning.setOwner(passwordWidget); warning.add(new HTML("Caps Lock is enabled!")); passwordWidget.addDomHandler(new KeyPressHandler() { -- 2.39.5