Any reason why _ComponentUtils class is not public? And is there any problem with making it public so I can add a second findComponent method that will traverse the entire tree?
Travis On 11/20/05, Simon Kitching <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Author: prophecy > > Date: Fri Nov 18 14:39:47 2005 > > New Revision: 345590 > > > > URL: http://svn.apache.org/viewcvs?rev=345590&view=rev > > Log: > > - Made t:message elements work with Ajax errors > > - fixed UIComponent.findComponent to actually work. > > > > Modified: > > myfaces/api/trunk/src/java/javax/faces/component/_ComponentUtils.java > > > > Modified: > > myfaces/api/trunk/src/java/javax/faces/component/_ComponentUtils.java > > URL: > > http://svn.apache.org/viewcvs/myfaces/api/trunk/src/java/javax/faces/component/_ComponentUtils.java?rev=345590&r1=345589&r2=345590&view=diff > > ============================================================================== > > --- myfaces/api/trunk/src/java/javax/faces/component/_ComponentUtils.java > > (original) > > +++ myfaces/api/trunk/src/java/javax/faces/component/_ComponentUtils.java > > Fri Nov 18 14:39:47 2005 > > @@ -72,6 +72,7 @@ > > > > static UIComponent findComponent(UIComponent findBase, String id) > > { > > + //System.out.println("findBase: " + findBase + " - " + > > findBase.getId()); > > if (idsAreEqual(id,findBase)) > > { > > return findBase; > > @@ -80,15 +81,17 @@ > > for (Iterator it = findBase.getFacetsAndChildren(); it.hasNext(); ) > > { > > UIComponent childOrFacet = (UIComponent)it.next(); > > - if (!(childOrFacet instanceof NamingContainer)) > > - { > > + //System.out.println("childorfacet: " + childOrFacet + " - " + > > childOrFacet.getId()); > > + // TR - this was not finding all components, removing this if > > statement worked > > + //if (!(childOrFacet instanceof NamingContainer)) > > + //{ > > UIComponent find = findComponent(childOrFacet, id); > > if (find != null) return find; > > - } > > - else if (idsAreEqual(id,childOrFacet)) > > + //} > > + /*else if (idsAreEqual(id,childOrFacet)) > > { > > return childOrFacet; > > - } > > + }*/ > > } > > > > return null; > > > > > > I suspect this change will have broken UIComponentBase.findComponent, > which is a pretty important method. UIComponent.findComponent is > depending on this method to *not* recurse into NamingContainer > components, as it handles those itself. > > In particular, I believe this structure is perfectly valid: > > subview id="foo" --> absolute id "foo" > UIInput id="bar" --> absolute id "foo:bar" > subview id="bar" --> absolute id "bar" > UIInput id="bar" --> absolute id "bar:bar" > > I'm also puzzled why this change was necessary, as I can't find any code > that calls this _ComponentUtils.findComponent method except for > UIComponentBase.findComponent. > > Regards, > > Simon > >
