You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by shymon <sh...@poczta.onet.pl> on 2008/10/30 02:27:15 UTC

T5: Multiple handlers for one event - calling order

In comments to
http://tapestryjava.blogspot.com/2007/08/handling-direct-urls-in-tapestry-5.html
Lewis has written that:



> When a single method is overloaded with different parameters, the order of
> invocation is fewest parameters to most parameters.
> So onActivate() will be invoked before onActivate(String, String).
> 

But I have noticed calling order is exactly opposite: onActivate(String,
String) is called before onActivate(). Excerpt from log follows:


...
[INFO] AppModule.TimingFilter Request time: 2609 ms
[DEBUG] pages.Index Dispatch event: ComponentEvent[activate from (self)]
[DEBUG] pages.Index Invoking:
myapp.webclient.pages.Index.onActivate(java.lang.String, java.lang.String)
(at Index.java:261)
[DEBUG] pages.Index Invoking: myapp.webclient.pages.Index.onActivate() (at
Index.java:252)
[DEBUG] pages.Index Dispatch event: ComponentEvent[passivate from (self)]
[DEBUG] pages.Index Dispatch event: ComponentEvent[passivate from (self)]
...


Where is the truth? (except, it's out there ;))

-- 
View this message in context: http://www.nabble.com/T5%3A-Multiple-handlers-for-one-event---calling-order-tp20239292p20239292.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

Re: T5: Multiple handlers for one event - calling order

Posted by shymon <sh...@poczta.onet.pl>.


Thiago H. de Paula Figueiredo wrote:
> 
> 
> You're welcome again!
> 
> Is it just me or this message list has been having an increase in new  
> members? This is very good news, IMHO. :)
> 
> 

I'm totally new member so

this._messageListUsers++;   ;)

After about two years of dealing with servlets and JSP I was looking around
for
some nice framework. I must admit that I was captivated by T5. Captivated
mostly by it's 
ideological simplicity. I think T5 singles out from the rest of java
frameworks :)

Hope I will not change my opinion after next 1000 lines of code :)


-- 
View this message in context: http://www.nabble.com/T5%3A-Multiple-handlers-for-one-event---calling-order-tp20239292p20253040.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: Multiple handlers for one event - calling order

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Thu, 30 Oct 2008 13:59:35 -0300, shymon <sh...@poczta.onet.pl>  
escreveu:

> I was just playing with activation context. Finally I replaced all
> onActivate methods with one
> taking object array as argument: onActivate(Object[] aParams). But now I
> will give EventContext a try.

EventContext has some nice conversion features that you would need to  
write yourself if using an Object[].

> Thanks once again :),

You're welcome again!

Is it just me or this message list has been having an increase in new  
members? This is very good news, IMHO. :)

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

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


Re: T5: Multiple handlers for one event - calling order

Posted by shymon <sh...@poczta.onet.pl>.


Thiago H. de Paula Figueiredo wrote:
> 
> 
> When your page class ends up having more than one onActivate method, most  
> of the time it is a better idea to have a single onActivate(EventContext  
> e). Take a look at  
> http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/EventContext.html.
> 
> 

I was just playing with activation context. Finally I replaced all
onActivate methods with one
taking object array as argument: onActivate(Object[] aParams). But now I
will give EventContext a try.

Thanks once again :),
Shymon

-- 
View this message in context: http://www.nabble.com/T5%3A-Multiple-handlers-for-one-event---calling-order-tp20239292p20251045.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: Multiple handlers for one event - calling order

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Wed, 29 Oct 2008 22:55:03 -0300, shymon <sh...@poczta.onet.pl>  
escreveu:

> hmmm, what to say... thanks :)

You're welcome!

When your page class ends up having more than one onActivate method, most  
of the time it is a better idea to have a single onActivate(EventContext  
e). Take a look at  
http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/EventContext.html.

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
Consultor, desenvolvedor e instrutor em Java
http://www.arsmachina.com.br/thiago

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


Re: T5: Multiple handlers for one event - calling order

Posted by shymon <sh...@poczta.onet.pl>.
hmmm, what to say... thanks :)

-- 
View this message in context: http://www.nabble.com/T5%3A-Multiple-handlers-for-one-event---calling-order-tp20239292p20239594.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: Multiple handlers for one event - calling order

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Wed, 29 Oct 2008 22:27:15 -0300, shymon <sh...@poczta.onet.pl>  
escreveu:

> In comments to
> http://tapestryjava.blogspot.com/2007/08/handling-direct-urls-in-tapestry-5.html
> Lewis has written that:
> But I have noticed calling order is exactly opposite: onActivate(String,
> String) is called before onActivate(). Excerpt from log follows:
> Where is the truth? (except, it's out there ;))

The truth out there in the blog post dates. :) Your linked post is from  
August 29, 2007. Things have changed since them. In Tapestry's JIRA,  
Howard said in September 22, 2007: "This order is determined by the  
compare() method of TransformMethodSignature; it is now set up to sort  
ascending by name, then descending by parameter count (within a single  
name)." [1], which is exactly what you've found in your tests. ;)

[1] https://issues.apache.org/jira/browse/TAPESTRY-1730

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

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