Navigate to invalid field on screen #PL-2214

This commit is contained in:
Yuriy Artamonov 2013-06-14 10:42:49 +00:00
parent 9ecaf9ea78
commit 6bbba9f448

View File

@ -271,11 +271,11 @@ public class WebWindow implements Window, Component.Wrapper,
com.vaadin.ui.Component c = vComponent; com.vaadin.ui.Component c = vComponent;
com.vaadin.ui.Component prevC = null; com.vaadin.ui.Component prevC = null;
while (c != null) { while (c != null) {
if (c instanceof com.vaadin.ui.Component.Focusable) { if (c instanceof TabSheet && !((TabSheet) c).getSelectedTab().equals(prevC)) {
((com.vaadin.ui.Component.Focusable) c).focus();
} else if (c instanceof TabSheet && !((TabSheet) c).getSelectedTab().equals(prevC)) {
((TabSheet) c).setSelectedTab(prevC); ((TabSheet) c).setSelectedTab(prevC);
break; break;
} else if (c instanceof com.vaadin.ui.Component.Focusable) {
((com.vaadin.ui.Component.Focusable) c).focus();
} }
prevC = c; prevC = c;
c = c.getParent(); c = c.getParent();
@ -605,17 +605,19 @@ public class WebWindow implements Window, Component.Wrapper,
public <T extends Component> T getComponent(String id) { public <T extends Component> T getComponent(String id) {
final String[] elements = ValuePathHelper.parse(id); final String[] elements = ValuePathHelper.parse(id);
if (elements.length == 1) { if (elements.length == 1) {
//noinspection unchecked
T component = (T) allComponents.get(id); T component = (T) allComponents.get(id);
if (component != null) if (component != null)
return component; return component;
else else
//noinspection unchecked
return (T) getTimer(id); return (T) getTimer(id);
} else { } else {
Component frame = allComponents.get(elements[0]); Component frame = allComponents.get(elements[0]);
if (frame != null && frame instanceof Container) { if (frame != null && frame instanceof Container) {
final List<String> subList = Arrays.asList(elements).subList(1, elements.length); final List<String> subList = Arrays.asList(elements).subList(1, elements.length);
String subPath = ValuePathHelper.format(subList.toArray(new String[subList.size()])); String subPath = ValuePathHelper.format(subList.toArray(new String[subList.size()]));
return (T) ((Container) frame).getComponent(subPath); return ((Container) frame).getComponent(subPath);
} else } else
return null; return null;
} }