You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Steve Eynon <st...@alienfactory.co.uk> on 2011/09/12 06:25:25 UTC

Can Mixins Contribute to Container Parameters?

Hi,

Can mixins contribute / set the parameters of it's container? It's
something I've needed to do a couple of times now but have not been
able to work out a way.

If the container has setters then I know I can do something like:

@InjectContainer
private MyComponent dave;

void setupRender() {
    dave.setDrink("Beer");
}

But I'm trying to change parameters which don't have a setter -
specifically the context of the core Form component.

Can anyone enlighten me? If Mixins can container parameters, then
there really would be nothing they couldn't do!

Cheers,

Steve.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Can Mixins Contribute to Container Parameters?

Posted by Steve Eynon <st...@alienfactory.co.uk>.
Wow, that looks to be the ticket, thanks!

I can't believe I'm still discovering new nooks and crannies in T5.2!

Steve.

On 12 September 2011 19:54, Robert Zeigler <ro...@roxanemy.com> wrote:
> Have you tried the @BindParameter annotation?
>
> http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/annotations/BindParameter.html
>
> eg:
>
> public class MyMixin {
>    @BindParameter
>    private Object context;
>
>    void setupRender() {
>        context = "some new context";
>    }
> }
>
>
> Robert
>
> On Sep 11, 2011, at 9/1111:25 PM , Steve Eynon wrote:
>
>> Hi,
>>
>> Can mixins contribute / set the parameters of it's container? It's
>> something I've needed to do a couple of times now but have not been
>> able to work out a way.
>>
>> If the container has setters then I know I can do something like:
>>
>> @InjectContainer
>> private MyComponent dave;
>>
>> void setupRender() {
>>    dave.setDrink("Beer");
>> }
>>
>> But I'm trying to change parameters which don't have a setter -
>> specifically the context of the core Form component.
>>
>> Can anyone enlighten me? If Mixins can container parameters, then
>> there really would be nothing they couldn't do!
>>
>> Cheers,
>>
>> Steve.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Can Mixins Contribute to Container Parameters?

Posted by Robert Zeigler <ro...@roxanemy.com>.
Have you tried the @BindParameter annotation?

http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/annotations/BindParameter.html

eg:

public class MyMixin {
    @BindParameter
    private Object context;

    void setupRender() {
	context = "some new context";
    }
}


Robert

On Sep 11, 2011, at 9/1111:25 PM , Steve Eynon wrote:

> Hi,
> 
> Can mixins contribute / set the parameters of it's container? It's
> something I've needed to do a couple of times now but have not been
> able to work out a way.
> 
> If the container has setters then I know I can do something like:
> 
> @InjectContainer
> private MyComponent dave;
> 
> void setupRender() {
>    dave.setDrink("Beer");
> }
> 
> But I'm trying to change parameters which don't have a setter -
> specifically the context of the core Form component.
> 
> Can anyone enlighten me? If Mixins can container parameters, then
> there really would be nothing they couldn't do!
> 
> Cheers,
> 
> Steve.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org