]> source.dussan.org Git - vaadin-framework.git/commitdiff
#6362 ComponentLocator only uses Widgets implementing SubPartAware as reference if...
authorArtur Signell <artur.signell@itmill.com>
Mon, 31 Jan 2011 13:36:12 +0000 (13:36 +0000)
committerArtur Signell <artur.signell@itmill.com>
Mon, 31 Jan 2011 13:36:12 +0000 (13:36 +0000)
svn changeset:17082/svn branch:6.5

src/com/vaadin/terminal/gwt/client/ComponentLocator.java
src/com/vaadin/terminal/gwt/client/ui/SubPartAware.java

index 5abfafe4ff8008103ef6002112c4de9bbb0d5418..25edb0f7d2bc20b704483bec0882672dc42ff6d2 100644 (file)
@@ -95,6 +95,24 @@ public class ComponentLocator {
             // find the Paintable for all but very special cases (like
             // overlays).
             w = (Widget) client.getPaintable(pid);
+
+            /*
+             * Still if the Paintable contains a widget that implements
+             * SubPartAware, we want to use that as a reference
+             */
+            Widget targetParent = findParentWidget(targetElement, w);
+            while (targetParent != w && targetParent != null) {
+                if (targetParent instanceof SubPartAware) {
+                    /*
+                     * The targetParent widget is a child of the Paintable and
+                     * the first parent (of the targetElement) that implements
+                     * SubPartAware
+                     */
+                    w = targetParent;
+                    break;
+                }
+                targetParent = targetParent.getParent();
+            }
         }
         if (w == null) {
             // Check if the element is part of a widget that is attached
index 55360cf01f52878f366f93f8c5fe6c8640a3c976..f14a14e2c6b15c8f335ba948754235e9c06c11ed 100644 (file)
@@ -4,12 +4,12 @@
 package com.vaadin.terminal.gwt.client.ui;
 
 import com.google.gwt.user.client.Element;
+import com.google.gwt.user.client.ui.Widget;
 import com.vaadin.terminal.gwt.client.ComponentLocator;
-import com.vaadin.terminal.gwt.client.Paintable;
 
 /**
- * Interface implemented by {@link Paintable}s which can provide identifiers for
- * at least one element inside the component. Used by {@link ComponentLocator}.
+ * Interface implemented by {@link Widget}s which can provide identifiers for at
+ * least one element inside the component. Used by {@link ComponentLocator}.
  * 
  */
 public interface SubPartAware {