You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Robert Zeigler <ro...@scazdl.org> on 2009/06/29 19:46:49 UTC
tap5-103
I'm looking at tackling tap5-103 (provide access to component
parameters from within mixins).
One way to do this would be to have some service injectable into
mixins from which you could fetch parameters by name,
similar to how component parameter could be manipulated by name in T3/
T4. This might be the simplest way to implement this, but also the
least elegant for the end-user.
The other thought is to have a sort of chained binding approach,
something like:
@BindParameter("object")//value is optional and defaults to the
variable name
private Object object;
In a use-case like:
<t:beaneditor t:id="myeditor" object="myobject" t:mixins="mymixin"/>
mypage.myobject <=> mymixin.object <=> beaneditor.object
So changes to "object" in beaneditor will be back-propagated to
mymixin.object and from there to mypage.myobject, and vice-versa.
In the case of multiple mixins:
<t:beaneditor t:id="myeditor" object="myobject"
t:mixins="mymixin1,mymixin2,mymixin3"/>
It would just be:
mypage.myobject <=> mymixin1.object <=> mymixin2.object <=>
mymixin3.object <=> beaneditor.object.
Any mixins in the chain that don't bind the parameter of interest
would be bypassed.
I was also thinking about the @MixinAfter and whether that would
affect the ordering within the binding chain... I don't think so.
Thoughts?
Robert
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org
Re: tap5-103
Posted by Howard Lewis Ship <hl...@gmail.com>.
I kind of like this approach. I'm a bit nervous about the basic
functionality. @BindParameter should probably have an attribute to specify
the parameter name to bind (when it doesn't match the field name).
I guess this goes torwards duck-typing; I.e. a mixin is used with any
component that has, for example, a value parameter ... which would be most
of the form control element components.
On Mon, Jun 29, 2009 at 10:46 AM, Robert Zeigler <ro...@scazdl.org> wrote:
> I'm looking at tackling tap5-103 (provide access to component parameters
> from within mixins).
>
> One way to do this would be to have some service injectable into mixins
> from which you could fetch parameters by name,
> similar to how component parameter could be manipulated by name in T3/T4.
> This might be the simplest way to implement this, but also the least
> elegant for the end-user.
>
> The other thought is to have a sort of chained binding approach, something
> like:
>
> @BindParameter("object")//value is optional and defaults to the variable
> name
> private Object object;
>
>
> In a use-case like:
>
> <t:beaneditor t:id="myeditor" object="myobject" t:mixins="mymixin"/>
>
> mypage.myobject <=> mymixin.object <=> beaneditor.object
>
> So changes to "object" in beaneditor will be back-propagated to
> mymixin.object and from there to mypage.myobject, and vice-versa.
> In the case of multiple mixins:
>
> <t:beaneditor t:id="myeditor" object="myobject"
> t:mixins="mymixin1,mymixin2,mymixin3"/>
>
> It would just be:
>
> mypage.myobject <=> mymixin1.object <=> mymixin2.object <=> mymixin3.object
> <=> beaneditor.object.
>
> Any mixins in the chain that don't bind the parameter of interest would be
> bypassed.
>
>
> I was also thinking about the @MixinAfter and whether that would affect the
> ordering within the binding chain... I don't think so.
>
> Thoughts?
>
> Robert
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: dev-help@tapestry.apache.org
>
>
--
Howard M. Lewis Ship
Creator of Apache Tapestry
Director of Open Source Technology at Formos