From 0edb315f69b50a789be3bf6737bbe73ed0feefee Mon Sep 17 00:00:00 2001 From: =?utf8?q?Leif=20=C3=85strand?= Date: Fri, 17 Feb 2012 12:52:50 +0200 Subject: [PATCH] Update to simulate captions in ChildComponentContainer (#8313) --- .../terminal/gwt/client/ComponentLocator.java | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) 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 -- 2.39.5