]> source.dussan.org Git - vaadin-framework.git/commitdiff
Reverted to using Iterable instead of HasWidgets as PopupView does not implement...
authorArtur Signell <artur.signell@itmill.com>
Mon, 5 Jul 2010 13:21:30 +0000 (13:21 +0000)
committerArtur Signell <artur.signell@itmill.com>
Mon, 5 Jul 2010 13:21:30 +0000 (13:21 +0000)
svn changeset:14079/svn branch:6.4

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

index db0f31d9d221dc46c0c2314da4c74cbc97356a4e..e25dabbbe4f874a0e40be98c8a1d5f78f63160a4 100644 (file)
@@ -336,16 +336,20 @@ public class ComponentLocator {
         }
         String simpleName = Util.getSimpleName(w);
 
-        if (!(parent instanceof HasWidgets)) {
-            /*
-             * Parent does not implement HasWidgets so we cannot find out which
-             * child this is.
-             */
+        /*
+         * Check if the parent implements Iterable. At least VPopupView does not
+         * implement HasWdgets so we cannot check for that.
+         */
+        if (!(parent instanceof Iterable<?>)) {
+            // Parent does not implement Iterable so we cannot find out which
+            // child this is
             return null;
         }
 
+        Iterator<?> i = ((Iterable<?>) parent).iterator();
         int pos = 0;
-        for (Widget child : ((HasWidgets) parent)) {
+        while (i.hasNext()) {
+            Object child = i.next();
             if (child == w) {
                 return basePath + PARENTCHILD_SEPARATOR + simpleName + "["
                         + pos + "]";
@@ -385,10 +389,10 @@ public class ComponentLocator {
                 // The target widget has been found and the rest identifies the
                 // element
                 break;
-            } else if (w instanceof HasWidgets) {
+            } else if (w instanceof Iterable) {
                 // W identifies a widget that contains other widgets, as it
                 // should. Try to locate the child
-                HasWidgets parent = (HasWidgets) w;
+                Iterable<?> parent = (Iterable<?>) w;
 
                 // Part is of type "VVerticalLayout[0]", split this into
                 // VVerticalLayout and 0
@@ -410,7 +414,7 @@ public class ComponentLocator {
                 } else if (widgetClassName.equals("VContextMenu")) {
                     return client.getContextMenu();
                 } else {
-                    iterator = parent.iterator();
+                    iterator = (Iterator<? extends Widget>) parent.iterator();
                 }
 
                 boolean ok = false;