You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by maxthesecond <ma...@yahoo.com> on 2008/05/08 12:01:27 UTC

T5 Event bubling


a page:  A
      a wraper component: B
           a component:  C inside wraper having an action link with
id=addToChart


At the page level by now I can only trap the events from C like

          @OnEvent(component="B")
	  void whatevernamewilldothejob(String ID){
          }
			
or
	  void onActionFromB(String Id){
	   }

	
Are those the only posiblities?
I reviewed all posts related to events and see no clear statment about the
isue.

And of course the problem is: what shall I do to distinguish two different
acction links in my component?
After all If I look at the generated url from the action link it contains
afaik all the needed information 

/page.container.component.addToChart

If the way to go is EventLink component Ok but then ActionLinks is much less
useful.

Thanks


-- 
View this message in context: http://www.nabble.com/T5-Event-bubling-tp17124159p17124159.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: T5 Event bubling

Posted by maxthesecond <ma...@yahoo.com>.
Thanks a lot you solve it! I hope

But It seems me not that logical, after all, the url carries all the
information, to make such an assert I will have to know the details and how
all does it work, I found the current solution a little convoluted.



宁德辉 wrote:
> 
> I think it is easy to understand that Page A doesn't know what's wrapped
> in component B, like 'addToChart', so you can only deal with event froom B
> but not 'addToChart'.
> And I think ActionLink is a more general EventLink, with event name
> "action".
> 
> For your case, you can use EventLink to specify special event name.
> 
> Or you can fire your customized event name in Component B like what Form
> component does.
> 
> Component B.java
> 
> @Inject
>     private ComponentResources _resource;
> void onActionFromAddToChart() {
>     _resource.triggerEvent("addToChart", new Object[]{values}, null);
> }
> 
> Then in Page A
> 
> void onAddToChart() {
>     // Do your logic.
> }
> 
> 
> Hope that helps.
> 
> Thanks!
> 
> DH
> 
> 
> ----- Original Message ----- 
> From: "maxthesecond" <ma...@yahoo.com>
> To: <us...@tapestry.apache.org>
> Sent: Thursday, May 08, 2008 6:01 PM
> Subject: T5 Event bubling
> 
> 
>> 
>> 
>> a page:  A
>>      a wraper component: B
>>           a component:  C inside wraper having an action link with
>> id=addToChart
>> 
>> 
>> At the page level by now I can only trap the events from C like
>> 
>>          @OnEvent(component="B")
>>   void whatevernamewilldothejob(String ID){
>>          }
>> 
>> or
>>   void onActionFromB(String Id){
>>    }
>> 
>> 
>> Are those the only posiblities?
>> I reviewed all posts related to events and see no clear statment about
>> the
>> isue.
>> 
>> And of course the problem is: what shall I do to distinguish two
>> different
>> acction links in my component?
>> After all If I look at the generated url from the action link it contains
>> afaik all the needed information 
>> 
>> /page.container.component.addToChart
>> 
>> If the way to go is EventLink component Ok but then ActionLinks is much
>> less
>> useful.
>> 
>> Thanks
>> 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/T5-Event-bubling-tp17124159p17124159.html
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>> 
>>
> 

-- 
View this message in context: http://www.nabble.com/T5-Event-bubling-tp17124159p17124821.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: T5 Event bubling

Posted by dhning <dh...@gaonline.com.cn>.
I think it is easy to understand that Page A doesn't know what's wrapped in component B, like 'addToChart', so you can only deal with event froom B but not 'addToChart'.
And I think ActionLink is a more general EventLink, with event name "action".

For your case, you can use EventLink to specify special event name.

Or you can fire your customized event name in Component B like what Form component does.

Component B.java

@Inject
    private ComponentResources _resource;
void onActionFromAddToChart() {
    _resource.triggerEvent("addToChart", new Object[]{values}, null);
}

Then in Page A

void onAddToChart() {
    // Do your logic.
}


Hope that helps.

Thanks!

DH


----- Original Message ----- 
From: "maxthesecond" <ma...@yahoo.com>
To: <us...@tapestry.apache.org>
Sent: Thursday, May 08, 2008 6:01 PM
Subject: T5 Event bubling


> 
> 
> a page:  A
>      a wraper component: B
>           a component:  C inside wraper having an action link with
> id=addToChart
> 
> 
> At the page level by now I can only trap the events from C like
> 
>          @OnEvent(component="B")
>   void whatevernamewilldothejob(String ID){
>          }
> 
> or
>   void onActionFromB(String Id){
>    }
> 
> 
> Are those the only posiblities?
> I reviewed all posts related to events and see no clear statment about the
> isue.
> 
> And of course the problem is: what shall I do to distinguish two different
> acction links in my component?
> After all If I look at the generated url from the action link it contains
> afaik all the needed information 
> 
> /page.container.component.addToChart
> 
> If the way to go is EventLink component Ok but then ActionLinks is much less
> useful.
> 
> Thanks
> 
> 
> -- 
> View this message in context: http://www.nabble.com/T5-Event-bubling-tp17124159p17124159.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
>