aboutsummaryrefslogtreecommitdiffstats
path: root/client/src/com
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <teemusa@vaadin.com>2015-11-24 11:35:35 +0200
committerJohannes Dahlström <johannesd@vaadin.com>2015-12-02 15:07:56 +0000
commit85a1e621e7b64bb16de61b5f511837362a90b352 (patch)
tree24fa26bb462d7c5102e61695a09e8e4bf1a2e359 /client/src/com
parent9f1f3eda477f3f61f98a55573708e446df38c3ac (diff)
downloadvaadin-framework-85a1e621e7b64bb16de61b5f511837362a90b352.tar.gz
vaadin-framework-85a1e621e7b64bb16de61b5f511837362a90b352.zip
Remove VOverlay dependency and use PopupPanel instead in Grid (#18698)
Change-Id: Id28a9fa8a204c1e2a12160e2e1dba1823f3726a5
Diffstat (limited to 'client/src/com')
-rw-r--r--client/src/com/vaadin/client/widgets/Grid.java34
1 files changed, 30 insertions, 4 deletions
diff --git a/client/src/com/vaadin/client/widgets/Grid.java b/client/src/com/vaadin/client/widgets/Grid.java
index 1304c40030..2fc2b4610b 100644
--- a/client/src/com/vaadin/client/widgets/Grid.java
+++ b/client/src/com/vaadin/client/widgets/Grid.java
@@ -34,8 +34,10 @@ import java.util.logging.Logger;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.core.shared.GWT;
+import com.google.gwt.dom.client.BodyElement;
import com.google.gwt.dom.client.BrowserEvents;
import com.google.gwt.dom.client.DivElement;
+import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.EventTarget;
import com.google.gwt.dom.client.NativeEvent;
@@ -88,7 +90,6 @@ import com.vaadin.client.renderers.Renderer;
import com.vaadin.client.renderers.WidgetRenderer;
import com.vaadin.client.ui.FocusUtil;
import com.vaadin.client.ui.SubPartAware;
-import com.vaadin.client.ui.VOverlay;
import com.vaadin.client.ui.dd.DragAndDropHandler;
import com.vaadin.client.ui.dd.DragAndDropHandler.DragAndDropCallback;
import com.vaadin.client.ui.dd.DragHandle;
@@ -3595,7 +3596,7 @@ public class Grid<T> extends ResizeComposite implements
private final Grid<?> grid;
- private VOverlay overlay;
+ private PopupPanel overlay;
private Sidebar(Grid<?> grid) {
this.grid = grid;
@@ -3687,9 +3688,34 @@ public class Grid<T> extends ResizeComposite implements
* Creates and initializes the overlay.
*/
private void createOverlay() {
- overlay = GWT.create(VOverlay.class);
+ overlay = new PopupPanel() {
+
+ @Override
+ protected void onAttach() {
+ // PopupPanel by default attaches itself directly to the
+ // body. Try to find a Vaadin overlay container and move the
+ // overlay there if found.
+
+ // FIXME: This is a hack; Grid should not have
+ // Vaadin-specific behavior special-cased. Instead, there
+ // should be a customization point for setting the overlay
+ // container.
+
+ BodyElement body = Document.get().getBody();
+ Element target = body.getFirstChildElement();
+ while (!target.hasClassName("v-overlay-container")
+ && target != null) {
+ target = target.getNextSiblingElement();
+ }
+
+ if (target != null) {
+ target.appendChild(getElement());
+ }
+
+ super.onAttach();
+ }
+ };
overlay.setAutoHideEnabled(true);
- overlay.setOwner(grid);
overlay.addStyleDependentName("popup");
overlay.add(content);
overlay.addAutoHidePartner(rootContainer.getElement());