You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Tony Nelson <tn...@starpoint.com> on 2011/06/23 23:18:39 UTC

T5 Reference page attributes from a component

In our T4 app we made a lot of use of this type of construct:

    <parameter name="selectedColumn" default-value="ognl:page.selectedColumn" />

This particular component is embedded 4 layers deep and was able to reach back all the way to Page class to get values.  Is there a similar construct in T5 or am I going to have to pass these values explicitly down the components?

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


Re: T5 Reference page attributes from a component

Posted by Martin Strand <do...@gmail.com>.
On Thu, 23 Jun 2011 23:18:39 +0200, Tony Nelson <tn...@starpoint.com>
wrote:

> In our T4 app we made a lot of use of this type of construct:
>
>     <parameter name="selectedColumn"  
> default-value="ognl:page.selectedColumn" />
>
> This particular component is embedded 4 layers deep and was able to  
> reach back all the way to Page class to get values.  Is there a similar  
> construct in T5 or am I going to have to pass these values explicitly  
> down the components?

Perhaps the page could store this data in the Environment and let the  
component access it from there?
Check out the documentation here to see whether it's a suitable option in  
your case:
http://tapestry.apache.org/environmental-services.html

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


Re: T5 Reference page attributes from a component

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Fri, 24 Jun 2011 14:17:43 -0300, Tony Nelson <tn...@starpoint.com>  
wrote:

> Thank you very much for your help.  I was able to get my form to display  
> properly using the Environmental Service and adding the following to my  
> base class:
>
>     void beginRender() {
>         environment.push(SearchParameters.class, getSearchParameters());
>     }
>
>     void afterRender() {
>         environment.pop(SearchParameters.class);
>     }

They're only invoked in render requests, not action (including form  
submission) ones. You can use @PageAttached and @PageDetached, as they're  
invoked in all requests.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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


Re: T5 Reference page attributes from a component

Posted by Taha Tapestry <ta...@gmail.com>.
Hi

There are two phases after you submit a form. First comes the  action phase and then the render phase. You are pushing an object in the render phase so at the time of action the object is not there. 

Regards
Taha 

On Jun 24, 2011, at 10:47 PM, Tony Nelson <tn...@starpoint.com> wrote:

> On Jun 23, 2011, at 6:27 PM, Thiago H. de Paula Figueiredo wrote:
> 
>> On Thu, 23 Jun 2011 18:18:39 -0300, Tony Nelson <tn...@starpoint.com> wrote:
>> 
>>> In our T4 app we made a lot of use of this type of construct:
>>>   <parameter name="selectedColumn" default-value="ognl:page.selectedColumn" />
>> 
>>> This particular component is embedded 4 layers deep and was able to reach back all the way to Page class to get values.  Is there a similar construct in T5
>> 
>> No.
>> 
>>> or am I going to have to pass these values explicitly down the components?
>> 
>> Yes. You can also use the Environmental service.
>> 
> 
> Thank you very much for your help.  I was able to get my form to display properly using the Environmental Service and adding the following to my base class:
> 
>    void beginRender() {
>        environment.push(SearchParameters.class, getSearchParameters());
>    }
> 
>    void afterRender() {
>        environment.pop(SearchParameters.class);
>    }
> 
> However, when I submit the form (from an input type="image") I get the following OperationException:
> 
> Failure writing parameter 'value' of component emailuser/List:pagedtable.columnsorterdata.hidden: No object of type com.starpoint.querybuilder.SearchParameters is available from the Environment. Available types are org.apache.tapestry5.TrackableComponentEventCallback, org.apache.tapestry5.ValidationTracker, org.apache.tapestry5.internal.BeanValidationContext, org.apache.tapestry5.services.ComponentEventResultProcessor, org.apache.tapestry5.services.FormSupport, org.apache.tapestry5.services.Heartbeat.
> 
> The fields form search parameters are in my component as:
> 
>    <t:hidden value="searchParameters.column" encoder="valueEncoderForColumn" id="selectedColumn" />
>    <t:hidden value="searchParameters.sortDirection" id="sortDirection" />
> 
> Am I missing something simple again?
> 
> Thanks again for the help.
> Tony Nelson
> 
> 
> ---------------------------------------------------------------------
> 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: T5 Reference page attributes from a component

Posted by Tony Nelson <tn...@starpoint.com>.
On Jun 23, 2011, at 6:27 PM, Thiago H. de Paula Figueiredo wrote:

> On Thu, 23 Jun 2011 18:18:39 -0300, Tony Nelson <tn...@starpoint.com> wrote:
> 
>> In our T4 app we made a lot of use of this type of construct:
>>    <parameter name="selectedColumn" default-value="ognl:page.selectedColumn" />
> 
>> This particular component is embedded 4 layers deep and was able to reach back all the way to Page class to get values.  Is there a similar construct in T5
> 
> No.
> 
>> or am I going to have to pass these values explicitly down the components?
> 
> Yes. You can also use the Environmental service.
> 

Thank you very much for your help.  I was able to get my form to display properly using the Environmental Service and adding the following to my base class:

    void beginRender() {
        environment.push(SearchParameters.class, getSearchParameters());
    }

    void afterRender() {
        environment.pop(SearchParameters.class);
    }

However, when I submit the form (from an input type="image") I get the following OperationException:

Failure writing parameter 'value' of component emailuser/List:pagedtable.columnsorterdata.hidden: No object of type com.starpoint.querybuilder.SearchParameters is available from the Environment. Available types are org.apache.tapestry5.TrackableComponentEventCallback, org.apache.tapestry5.ValidationTracker, org.apache.tapestry5.internal.BeanValidationContext, org.apache.tapestry5.services.ComponentEventResultProcessor, org.apache.tapestry5.services.FormSupport, org.apache.tapestry5.services.Heartbeat.

The fields form search parameters are in my component as:

    <t:hidden value="searchParameters.column" encoder="valueEncoderForColumn" id="selectedColumn" />
    <t:hidden value="searchParameters.sortDirection" id="sortDirection" />

Am I missing something simple again?

Thanks again for the help.
Tony Nelson


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


Re: T5 Reference page attributes from a component

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Thu, 23 Jun 2011 18:18:39 -0300, Tony Nelson <tn...@starpoint.com>  
wrote:

> In our T4 app we made a lot of use of this type of construct:
>     <parameter name="selectedColumn"  
> default-value="ognl:page.selectedColumn" />

> This particular component is embedded 4 layers deep and was able to  
> reach back all the way to Page class to get values.  Is there a similar  
> construct in T5

No.

> or am I going to have to pass these values explicitly down the  
> components?

Yes. You can also use the Environmental service.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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