Re: Wrapper templates
David Crawshaw <[email protected]> Fri, 4 Apr 2003 22:46:24 +1000
| Newsgroups | gmane.comp.java.xwt.general |
|---|---|
| Message-ID | <[email protected]> |
On Friday, April 4, 2003, at 10:39 PM, Charles Goodwin wrote:
> <redirect target="inner" wrapper="true" listen="halign,valign" />
This listen concept is really interesting, but it's not really what I
was thinking about with wrappers.
The final description by Adam of Child Wrappers is:
http://lists.xwt.org/pipermail/dev/2002-September/001082.html
Off the example in that mail, each child of $target would actually be
an instance of org.xwt.foo. Each instance of org.xwt.foo would have one
child, which is the box originally added to the parent of $target.
That description was pretty confusing, but that's how it stands.
This listener is an interesting idea, not so much as a wrapper, but as
a natural extension of redirect.
<redirect target="inner" listen="variable1, variable2"/>
<template>
<box id="inner">
_variable1 = function(v) {
// Called whenever variable1 is put to on the parent
}
</box>
</template>
I'm just not sure if the cut down code is worth the extra complexity
this brings. Would a _variable1 trap in the parent template be called
if the redirect is listening? If so, would it get called before
$inner._variable1? I would suggest the answer to be yes to both.
I suppose the argument against it is you can get the same functionality
by reusing a 2-line function:
<redirect target="inner"/>
<template>
_variable1 = _variable2 = _variable3= function(v) {
if (arguments.length == 0) return $inner[arguments.trapname];
$inner[arguments.trapname] = v;
}
<box id="inner"/>
</template>
d
_______________________________________________
http://lists.xwt.org/listinfo/dev