You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by nn kk <in...@abv.bg> on 2014/07/19 00:42:26 UTC

Inject dynamic number of components

 Hi all,
how can I inject and access dynamic number of custom components, I want to access them in the Java class.
I have:
<loop>
    <t:myCustomComponent/>
</loop>

I want to access these components as they are injected and to execute in the onSuccess for everyone of them some method as if it is a single component:

@inject
MyCustomComponent component;

void onSuccess() {
   component.method();
}

I want to the the same for dynamic number of components, created by the loop

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


Re: Inject dynamic number of components

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Fri, 18 Jul 2014 19:42:26 -0300, nn kk <in...@abv.bg> wrote:

>  Hi all,

Hi!

> how can I inject and access dynamic number of custom components, I want  
> to access them in the Java class.
> I have:
> <loop>
>     <t:myCustomComponent/>
> </loop>

I'm sorry, but your question doesn't even make sense, because Tapestry  
doesn't create components instance dynamically. It's all 100% static. The  
rendering of them, though, is 100% dynamic.

In your template above, there are just two component instances, one Loop,  
one MyCustomComponent, no matter how many times the Loop iterates. A  
single MyCustomComponent instance will be rendered many times.

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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


Re: Inject dynamic number of components

Posted by Dmitry Gusev <dm...@gmail.com>.
You need SubmitNotifier:

http://tapestry.apache.org/5.3/apidocs/org/apache/tapestry5/corelib/components/SubmitNotifier.html

On Friday, July 18, 2014, nn kk <in...@abv.bg> wrote:

>  Hi all,
> how can I inject and access dynamic number of custom components, I want to
> access them in the Java class.
> I have:
> <loop>
>     <t:myCustomComponent/>
> </loop>
>
> I want to access these components as they are injected and to execute in
> the onSuccess for everyone of them some method as if it is a single
> component:
>
> @inject
> MyCustomComponent component;
>
> void onSuccess() {
>    component.method();
> }
>
> I want to the the same for dynamic number of components, created by the
> loop
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> <javascript:;>
> For additional commands, e-mail: users-help@tapestry.apache.org
> <javascript:;>
>
>

-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com