You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by bogdan_cm <bo...@rbccm.com> on 2011/11/09 23:13:42 UTC

EventLinks and their handlers

I am stuck on a rather silly operation. I have an eventLink in the tml and
it's event handler in the class like so:

tml ->    < a t:id='postConversationLink'>click the link < / a >

class -> 

        @Component(parameters = {"event=postConversationEvent"})
	private EventLink postConversationLink;
	
	  @OnEvent(value="postConversationEvent", component="postConversationLink")
	  void valueChosen()
	  {
	    System.out.println("annotated version");
	  }
	  
	  void onPostConversationEventFromPostConversationLink()
	  {
		  System.out.println("convention version");  
	  }


To me both the annotated version and the convetion version look correct.
However, for both i get the error: Request event 'postconversationevent' ...
was not handled. 
>From the message it looks like the link is actually generating the event,
but somehow it cannot be matched to any of the two handlers. 

Thank you, 
Bogdan. 

--
View this message in context: http://tapestry.1045711.n5.nabble.com/EventLinks-and-their-handlers-tp4979300p4979300.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: EventLinks and their handlers

Posted by Steve Eynon <st...@alienfactory.co.uk>.
Cool, cheers Taha,

This took me a while to understand so I'll re-iterate for my sake!

You're saying for EventLinks we need to drop the "From" clause because
the event isn't acutally raised in the eventLink but the container, so
the following should work:

@OnEvent(value="postConversationEvent")
void valueChosen() {
    System.out.println("annotated version");
}

void onPostConversationEvent() {
    System.out.println("convention version");
}

Steve.

On 10 November 2011 12:27, Taha Hafeez Siddiqi <ta...@gmail.com> wrote:
> Hi
>
> EventLinks have event handlers of the form
>
> on'EventName'
>
> and the event name defaults to the component id.
>
> 'FromComponent' is not going to work as the event is triggered in the container without reference to the component triggering it. This allows shorter url
>
> http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/EventLink.html
>
> regards
> Taha
>
> On Nov 10, 2011, at 3:43 AM, bogdan_cm wrote:
>
>> I am stuck on a rather silly operation. I have an eventLink in the tml and
>> it's event handler in the class like so:
>>
>> tml ->    < a t:id='postConversationLink'>click the link < / a >
>>
>> class ->
>>
>>        @Component(parameters = {"event=postConversationEvent"})
>>       private EventLink postConversationLink;
>>
>>         @OnEvent(value="postConversationEvent", component="postConversationLink")
>>         void valueChosen()
>>         {
>>           System.out.println("annotated version");
>>         }
>>
>>         void onPostConversationEventFromPostConversationLink()
>>         {
>>                 System.out.println("convention version");
>>         }
>>
>>
>> To me both the annotated version and the convetion version look correct.
>> However, for both i get the error: Request event 'postconversationevent' ...
>> was not handled.
>> From the message it looks like the link is actually generating the event,
>> but somehow it cannot be matched to any of the two handlers.
>>
>> Thank you,
>> Bogdan.
>>
>> --
>> View this message in context: http://tapestry.1045711.n5.nabble.com/EventLinks-and-their-handlers-tp4979300p4979300.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
>>
>
>

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


Re: EventLinks and their handlers

Posted by Taha Hafeez Siddiqi <ta...@gmail.com>.
Hi

EventLinks have event handlers of the form

on'EventName'

and the event name defaults to the component id. 

'FromComponent' is not going to work as the event is triggered in the container without reference to the component triggering it. This allows shorter url

http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/EventLink.html

regards
Taha

On Nov 10, 2011, at 3:43 AM, bogdan_cm wrote:

> I am stuck on a rather silly operation. I have an eventLink in the tml and
> it's event handler in the class like so:
> 
> tml ->    < a t:id='postConversationLink'>click the link < / a >
> 
> class -> 
> 
>        @Component(parameters = {"event=postConversationEvent"})
> 	private EventLink postConversationLink;
> 	
> 	  @OnEvent(value="postConversationEvent", component="postConversationLink")
> 	  void valueChosen()
> 	  {
> 	    System.out.println("annotated version");
> 	  }
> 	  
> 	  void onPostConversationEventFromPostConversationLink()
> 	  {
> 		  System.out.println("convention version");  
> 	  }
> 
> 
> To me both the annotated version and the convetion version look correct.
> However, for both i get the error: Request event 'postconversationevent' ...
> was not handled. 
> From the message it looks like the link is actually generating the event,
> but somehow it cannot be matched to any of the two handlers. 
> 
> Thank you, 
> Bogdan. 
> 
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/EventLinks-and-their-handlers-tp4979300p4979300.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
>