cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylv...@apache.org>
Subject Re: [CForms] Repeater is not a ContainerWidget?
Date Mon, 03 May 2004 16:43:27 GMT
Marc Portier wrote:

> Sylvain Wallez wrote:


<snip/>

>> Same feeling here: a repeater *contains* rows, which in turn 
>> *contain* widgets.
>
>
> sure,
> just like both List and Map 'contain' values, yet they do so in a 
> semantically distinct way, and there is little shared methods between them


IMO, it's more like Collection and List : a Collection lets you iterate 
through its content, whereas a List extends this behaviour by giving you 
positional access to its content. That's what repeater.getRow() gives us.

There *must* be a unified interface for all widgets that aren't terminal 
(i.e. that contain other widgets). This is key to be able to write 
generic walkers, the simplest one being lookupWidget().

> but just like you guys I can't ignore the use case from Fredy here, 
> but that seems to be a reality that comes together with the existence 
> of getFullyQualifiedId() and is thus better placed as a lookupWidget 
> on the Widget interface (not on some container)


lookupWidget() only makes sense on ContainerWidget (if Repeater 
implements it also, of course), since terminal widgets have no children.

<snip/>

> this sounds similar to my distinction between getWidget and 
> lookupWidget but I think the latter could also be defined on the level 
> of Widget directly.
>
> that would make 'navigating' the widget tree a feature of every widget 
> and as mentioned before more logically come together with the 
> getFullyQualifiedId (that would be equal to some getPath() in fact?)


Reading also Jörg's opinion, my preferred navigation API is :
- getChild(String name) to get a direct child of a widget (replaces 
getWidget which isn't precise enough to say if it considers children 
only or also descendants)
- lookupWidget(String qname) which does a descendant lookup only, based 
on child names sperarated by dots.

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }


Mime
View raw message