Re: [Woody] Class and Union widget questions

2003-10-26 Thread Sylvain Wallez
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

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



[Woody] Class and Union widget questions

2003-10-24 Thread Timothy Larson
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?

--Tim Larson


__
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com


Re: [Woody] Class and Union widget questions

2003-10-24 Thread Timothy Larson
About the subject line:
The Class widget definition is intended to allow general reuse of a set of widget
definitions.  It was designed to hold a list of widgets instead of just one
widget so it could be used to add a list of cases to a Union widget.

--Tim Larson


__
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com