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

Reply via email to