cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <>
Subject Re: [Woody] Class and Union widget questions
Date Sun, 26 Oct 2003 12:51:45 GMT
Timothy Larson wrote:

>I implemented a "Class" widget definition which contains a list of widgets,
>but its createInstance() is designed to not create instances of those widgets.
>Instead, you use a "New" widget definition which references a "Class" widget
>definition, and the "New" createInstance() creates instances of the class's
>widgets.  The issue is that this breaks the sequence that is used in the
>container widgets (Form, Repeater, etc.):
>  subwidget = subdefinition.createInstance();
>  parentwidget.addWidget(subwidget);
>What do you think of changing this to:
>  subdefinition.createInstance(parentwidget);
>and in the subwidget definition's createInstance() have this:
>  widget = new SomeWidget();
>  parentwidget.addWidget(widget);
>This would involve changing the signature of createInstance(), making addWiget()
>public, and touching every widget to make the changes.
>What do you think?

Why not, if this is required by the union widget, although I must admit 
I not fully understand the need :-/

But we must ensure that we won't go into an infinite loop through e.g. 
parent.addWidget(child) calling child.setParent(parent) and in turn 
parent.addWidget(child)... Note that this can be avoided e.g. by testing 
that child.getParent() != parent before calling child.setParent(parent)


Sylvain Wallez                                  Anyware Technologies 
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance  -

View raw message