cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <>
Subject Re: [CForms] Repeater is not a ContainerWidget?
Date Sat, 01 May 2004 12:47:33 GMT
Bruno Dumon wrote:

>On Fri, 2004-04-30 at 23:04, Marc Portier wrote:


>>3/ make Repeater again a ContainerWidget (which it IMHO is not...
>but feels as the easiest way out of this.
>Maybe this case illustrates that Repeater should be a ContainerWidget
>after all? If it's not a ContainerWidget, how could it possibly contain
>widgets as children (which the RepeaterRows are)?

Same feeling here: a repeater *contains* rows, which in turn *contain* 

>Lets look at the interface (javadocs dropped):
>public interface ContainerWidget extends Widget {
>    public void addWidget(Widget widget);
>    public boolean hasWidget(String id);
>    public Widget getWidget(String id);
>    public Iterator getChildren();
>Of these methods, the only one that is problematic is addWidget. But it
>seems like that method can be problematic for other ContainerWidgets as
>well, eg MultiValueField or RepeaterRow.
>I also see a problem with that method 'tout court', in that we have an
>addWidget but not a removeWidget?

Mmmh... we need addWidget on some container widgets as part of their 
setup by their widget builder. But it doesn't seem to me we need it at 
all in the interface. It's a private contract between the buider and the 
instances it creates.

Now about getWidget(): it is used to crawl down the widget tree, but its 
name is inconsistent with getParent() which is used to crawl up the 
tree. getChild() looks better to me. So what about having:
- getChild(id) searching in the _direct_ children of a widget.
- getWidget(path) performing a tree traversal using the dotted notation 
(e.g. "").

These two methods would be available on ContainerWidget only (including 



Sylvain Wallez                                  Anyware Technologies 
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }

View raw message