Well, findComponent on a dataTable child component works with MyFaces
as well, but you get back a component which is not configured with the
row's context.

that's the problem.

regards,

Martin

On 1/20/06, Abrams, Howard A <[EMAIL PROTECTED]> wrote:
> AFAIK, findComponent on a Table items works in the RI. (I found a note
> to myself from last august to figure out why MyFaces does not :) ).
>
> Because the table is a naming container, I believe you can override its
> findComponent method to do the right thing. I imagine this is what the
> RI's HtmlDataTable does, but I have not seen the source.
>
> It has been 5 months since I've looked at this, so someone please verify
> what I'm talking about. It's quite possible I am remembering incorrectly
> and the RI doesn't work but I tweaked something in my components to get
> it working. I do know I had some tweaks to call setRowIndex, but that
> was after I had found the component already using
> viewRoot.findComponent().  (...Forgive me, it's all a bit fuzzy at the
> moment...)
>
> > -----Original Message-----
> > From: Martin Marinschek [mailto:[EMAIL PROTECTED]
> > Sent: Friday, January 20, 2006 6:22 AM
> > To: MyFaces Development
> > Subject: Re: findComponent, dataTable, messages
> >
> > Well,
> >
> > we won't be able to do this on UIComponent. The problem is, that we
> > can't extend the API - that's fixed. So there'll be the need for some
> > extra-handling to be done outside of UIComponent, and also for some
> > instanceOfs. Of course not instanceOf for UIData, but some generic
> > marker interface.which implements this functionality.
> >
> > regards,
> >
> > Martin
> >
> > On 1/20/06, Mario Ivankovits <[EMAIL PROTECTED]> wrote:
> > > 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
> > >
> > >
> >
> >
> > --
> >
> > http://www.irian.at
> >
> > Your JSF powerhouse -
> > JSF Consulting, Development and
> > Courses in English and German
> >
> > Professional Support for Apache MyFaces
>
>


--

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Reply via email to