From 6bbba9f4484ff9f5c335d30857740dd8845afbab Mon Sep 17 00:00:00 2001 From: Yuriy Artamonov Date: Fri, 14 Jun 2013 10:42:49 +0000 Subject: [PATCH] Navigate to invalid field on screen #PL-2214 --- .../web/src/com/haulmont/cuba/web/gui/WebWindow.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/web/src/com/haulmont/cuba/web/gui/WebWindow.java b/modules/web/src/com/haulmont/cuba/web/gui/WebWindow.java index 6087d16a33..779a92e500 100644 --- a/modules/web/src/com/haulmont/cuba/web/gui/WebWindow.java +++ b/modules/web/src/com/haulmont/cuba/web/gui/WebWindow.java @@ -271,11 +271,11 @@ public class WebWindow implements Window, Component.Wrapper, com.vaadin.ui.Component c = vComponent; com.vaadin.ui.Component prevC = null; while (c != null) { - if (c instanceof com.vaadin.ui.Component.Focusable) { - ((com.vaadin.ui.Component.Focusable) c).focus(); - } else if (c instanceof TabSheet && !((TabSheet) c).getSelectedTab().equals(prevC)) { + if (c instanceof TabSheet && !((TabSheet) c).getSelectedTab().equals(prevC)) { ((TabSheet) c).setSelectedTab(prevC); break; + } else if (c instanceof com.vaadin.ui.Component.Focusable) { + ((com.vaadin.ui.Component.Focusable) c).focus(); } prevC = c; c = c.getParent(); @@ -605,17 +605,19 @@ public class WebWindow implements Window, Component.Wrapper, public T getComponent(String id) { final String[] elements = ValuePathHelper.parse(id); if (elements.length == 1) { + //noinspection unchecked T component = (T) allComponents.get(id); if (component != null) return component; else + //noinspection unchecked return (T) getTimer(id); } else { Component frame = allComponents.get(elements[0]); if (frame != null && frame instanceof Container) { final List subList = Arrays.asList(elements).subList(1, elements.length); String subPath = ValuePathHelper.format(subList.toArray(new String[subList.size()])); - return (T) ((Container) frame).getComponent(subPath); + return ((Container) frame).getComponent(subPath); } else return null; }