You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Denis Stepanov <de...@gmail.com> on 2010/11/03 12:41:34 UTC

Component context @ActivationRequestParameter

Hello everyone,

we are using tapestry in our ajax application, most web actions like creating, editing etc. are implemented using modal dialogs, problem is that only easy way how to store context is to put it in page link (on Activate approach). 

Now, if you think about switching page navigation layout to ajax layout with one page, you need to pass your context in all your component events. 

Example: EditUserPage is replaced with EditUserComponent and it is showed as the modal dialog when a user clicks on the edit link from UserAllPage, problem here is that all other component events in EditUserComponent should also have context as parameter and that you need to pass context to all child components of EditUserComponent.

I have created my own component annotation like @ActivationRequestParameter which adds query parameter to all component links in that component body, in setupRender phase it adds link listener to thread scope LinkCreationHub and in clearRender phase it removes listener. Also there is a component event filter which triggers events to set parameter back when finds query parameter with specific prefix, and also adds his own listener to delegate query parameters to other component events. It works for me, you can just annotate your context properties in EditUserComponent and they will be restored on next component event like onShowDetail() { return detailBlock; }; 

There is a lot of use cases for that component context annotation approach using ajax.

I would like to see something like that in 5.2, my implementation is 5.1 old (javassist worker etc) and maybe you have a better idea how to implement it. I know that it's a not a perfect solution, the component need to be rendered because of setupRender hook, it's not possible to use activate event because components are not activated.

Thanks,
	Denis


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