Hi! > It does sound a little fragile, though. It means treating UIData > components specially which I don't like. Any use of "instanceof" in an > OO program is a warning sign. Or can the UIData override findComponent > on itself to manage that transparently? If so, that would be nice. > Possibly non-portable though. > You can delegate this executeOnComponent to the component and thus each component can implement its own strategy to find the requested child. So no instanceof needed, though an addition to UIComponent (overriden by UIData). Using a "boolean" return value to indicate the work has been done. Something like the visitor pattern
So something like this (for sure, not jdk15 - I've done just do keep it smaller): on UIComponent: public boolean executeOnComponent(String id, ComponentExecutor process) { if (id.equals(getId()) { process.process(this); return true; } for (UIComponent component : components) { if (component.executeOnComponent(id, process) { return true; } } return false; } on UIData: public boolean executeOnComponent(String id, ComponentExecutor process) { for (int row : rows) { // save the rowNum //skim through rows //set the rowNum // call executeOnComponent on each child // restore the rowNum } reutrn super.executeOnComponent(id, process); } And dont forget to iterate through the facets too. Else you might not find the component embedded in e.g. an panelLayout (a bug with ajax I already filed) No need of instanceof, or do I miss something yet? Ciao, Mario