From: Leif Åstrand Date: Fri, 17 Feb 2012 10:52:50 +0000 (+0200) Subject: Update to simulate captions in ChildComponentContainer (#8313) X-Git-Tag: 7.0.0.alpha2~434^2~35 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0edb315f69b50a789be3bf6737bbe73ed0feefee;p=vaadin-framework.git Update to simulate captions in ChildComponentContainer (#8313) --- diff --git a/src/com/vaadin/terminal/gwt/client/ComponentLocator.java b/src/com/vaadin/terminal/gwt/client/ComponentLocator.java index 0a35c2d32c..51e600abaf 100644 --- a/src/com/vaadin/terminal/gwt/client/ComponentLocator.java +++ b/src/com/vaadin/terminal/gwt/client/ComponentLocator.java @@ -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