You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Barry Books <tr...@gmail.com> on 2011/10/24 14:33:47 UTC

ActivationRequestParameter only works in a page?

I know it's documented but is there any real reason the
ActivationRequestParameter annotation only works in a page and not a
component? I realize poor naming conventions could cause conflicts but
it seems like an unnecessary restriction.

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


Re: ActivationRequestParameter only works in a page?

Posted by Barry Books <tr...@gmail.com>.
The great thing about Tapestry, Don't like it change it!

https://github.com/trsvax/tapestry-bootstrap/blob/master/src/main/java/com/trsvax/bootstrap/services/ComponentRequestParameterWorker.java

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


Re: ActivationRequestParameter only works in a page?

Posted by Denis Stepanov <de...@gmail.com>.
I have something like this implemented in our app for component events only, a field with the special annotation will add its value as a request parameter to all links inside rendering phase and on incoming event the special filter will send restore event to restore field's previous value.

Works great with deep component hierarchy, otherwise you need to preserve that state using context in all events, which is very ugly.

Denis

On 24.10.2011, at 20:39, trsvax wrote:

> In my case the page does not know about the parameter. I have a grid like
> component that is managing what rows in the grid to display. I don't really
> want to make the page care one way or another what part of the grid is
> displaying (or even that is is a grid).
> 
> Since the value is available in the Request it's easy to get in the
> component which makes it seem a bit arbitrary I can use this annotation in a
> page and not a component. 
> 
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/ActivationRequestParameter-only-works-in-a-page-tp4932370p4933666.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: ActivationRequestParameter only works in a page?

Posted by trsvax <tr...@gmail.com>.
In my case the page does not know about the parameter. I have a grid like
component that is managing what rows in the grid to display. I don't really
want to make the page care one way or another what part of the grid is
displaying (or even that is is a grid).

Since the value is available in the Request it's easy to get in the
component which makes it seem a bit arbitrary I can use this annotation in a
page and not a component. 

--
View this message in context: http://tapestry.1045711.n5.nabble.com/ActivationRequestParameter-only-works-in-a-page-tp4932370p4933666.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: ActivationRequestParameter only works in a page?

Posted by Steve Eynon <st...@alienfactory.co.uk>.
If nested components need activation context parameters, the page
could always stick them on the Environmental Stack.

Engineering this further, you could have a service which is injected
into both the page and the component which stores it's state in a
ThreadLocal.

Steve.


On 24 October 2011 21:37, Barry Books <tr...@gmail.com> wrote:
> I would agree about activate/passivate in a component because there is
> no way to namespace the parameters so the component is pretty much
> tied to the page, but since the URL parameters are name/value pairs I
> can name things in such a way to avoid conflicts.
>
> My use case is a pagination component. I want to place the page number
> in the URL but this restriction means more code for no apparent
> reason. Now I need (and I loose the value converters)
>
> @BeginRender
>    void init() {
>        String page = request.getParameter(parm);
>        currentPage = new Integer(page);
> }
>
>
> I suspect there are other use cases like this such as a search component.
>
> ---------------------------------------------------------------------
> 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: ActivationRequestParameter only works in a page?

Posted by Barry Books <tr...@gmail.com>.
I would agree about activate/passivate in a component because there is
no way to namespace the parameters so the component is pretty much
tied to the page, but since the URL parameters are name/value pairs I
can name things in such a way to avoid conflicts.

My use case is a pagination component. I want to place the page number
in the URL but this restriction means more code for no apparent
reason. Now I need (and I loose the value converters)

@BeginRender
    void init() {
    	String page = request.getParameter(parm);
    	currentPage = new Integer(page);
}


I suspect there are other use cases like this such as a search component.

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


Re: ActivationRequestParameter only works in a page?

Posted by derkoe <ta...@gmail.com>.
trsvax wrote:
> 
> I know it's documented but is there any real reason the
> ActivationRequestParameter annotation only works in a page and not a
> component? I realize poor naming conventions could cause conflicts but
> it seems like an unnecessary restriction.
> 

I think that's a very good restriction - I also think that
activate/passivate should not be handled/raised by/to components.

The first point on our Tapestry best practice list is: Never use
onActivate/passivate in components. 

There are many problems with activation context in components: 
 * One problem is when you reuse the component and are not aware of the
activation context handling.
 * I guess the framework's problem is to handle multiple onPassivates. If
you have to components with an activation context to passivate, which one
should Tapestry take?

-- 
Chris

--
View this message in context: http://tapestry.1045711.n5.nabble.com/ActivationRequestParameter-only-works-in-a-page-tp4932370p4932417.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