No ,I am wrong !
It doesn’t matter about ComponentContainer or HasComponents.
There are bug in answer method.
Component findComponentWithId(HasComponents root, String id) {
for(Component child : root) {
if(id.equals(child.getId())) {
// found it!
return child;
} else if(child instanceof HasComponents) {
// recursively go through all children that themselves have children
return findComponentWithId((HasComponents) child, id);
[color=#FF0000]
[size=5]
[b]
<–bug here(cause short cut)
–>change to:
[/b]
[/size]
[/color]
Component ret= findComponentWithId((HasComponents) child, id);
if(ret!=null)return ret;
}
}
// none was found
return null;
}