]> source.dussan.org Git - vaadin-framework.git/commitdiff
Update to simulate captions in ChildComponentContainer (#8313)
authorLeif Åstrand <leif@vaadin.com>
Fri, 17 Feb 2012 10:52:50 +0000 (12:52 +0200)
committerLeif Åstrand <leif@vaadin.com>
Fri, 17 Feb 2012 10:52:50 +0000 (12:52 +0200)
src/com/vaadin/terminal/gwt/client/ComponentLocator.java

index 0a35c2d32c30edfda33dbd87f2ea52a72178bdfc..51e600abafd50f330d57cc952c019554e8aadb9c 100644 (file)
@@ -480,27 +480,25 @@ public class ComponentLocator {
                     // the same type before it
                     int nextIndex = 0;
                     for (Widget child : layout) {
-                        // Don't count captions
-                        if (child instanceof VCaption) {
-                            continue;
-                        }
-
                         boolean matchingType = nextWidgetClassName.equals(Util
                                 .getSimpleName(child));
-                        if (widgetPosition == 0) {
-                            // This is the n:th child
-
-                            // Error if not the expected type
-                            if (!matchingType) {
-                                return null;
-                            }
+                        if (matchingType && widgetPosition == 0) {
+                            // This is the n:th child that we looked for
                             break;
+                        } else if (widgetPosition < 0) {
+                            // Error if we're past the desired position without
+                            // a match
+                            return null;
                         } else if (matchingType) {
                             // If this was another child of the expected type,
                             // increase the count for the next step
                             nextIndex++;
                         }
-                        widgetPosition--;
+
+                        // Don't count captions
+                        if (!(child instanceof VCaption)) {
+                            widgetPosition--;
+                        }
                     }
 
                     // Advance to the next step, this time checking for the