myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Travis Reeder <tree...@gmail.com>
Subject Re: svn commit: r345590 - /myfaces/api/trunk/src/java/javax/faces/component/_ComponentUtils.java
Date Sun, 20 Nov 2005 21:55:00 GMT
This was because when you use forceId, it doesn't work.  Which is also
very important, I tried to keep this out until a better solution went
in.  The reason this didn't work (from what I recall when I first
commented this out), was because it didn't decend into a
NamingContainer.  If I'm doing a findComponent on ViewRoot, shouldn't
it find the component anywhere in the tree?  Fast forward ...  I just
answered my own question looking at the javadocs, says it shouldn't
descend into other NamingContainers.  So much for that.  I'll put this
back in and try to figure out a better workaround.

Travis

On 11/20/05, Simon Kitching <skitching@obsidium.com> wrote:
> prophecy@apache.org 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
>
>
Mime
View raw message