hi petros,

right... you can't use it in an onAction method (component event
method)

a possible solution is to save some informaton in a persistent 
field (session or flash) that is then evaluated during the render 
phase.

as you know, after each component event t5 performs a redirect
to initiate the page rendering. because of the statelessness of 
t5 components/pages you have to somehow remember the 
state info yourself if page/component rendering depends on a 
previous component action.

hope this makes sense :)... 

a simple example:

@Persist("flash")
private boolean renderScriptFlag;

void onActionFromLink()
{
    renderScript = true;
}

void beginRender()
{
    if(renderScriptFlag)
        renderSuport.addScript(....);
}


g,
kris




Petros Petrou <[EMAIL PROTECTED]> 
22.07.2008 17:05
Bitte antworten an
"Tapestry users" <users@tapestry.apache.org>


An
users@tapestry.apache.org
Kopie

Thema
Re: @Environment problem








Thanks Kris/Sven, 

The version I am using is 5.0.13. 

Kris, if I am understanding your explanation correctly this means I have 
no
way of using this code
renderSupport.addScript("%s.show%s(%s);", window1.getClientId(), 
isCenter()
? "Center" : "", isModal()); 
within an action method ?

PS: This is my original issue
http://www.nabble.com/t5components---Window-to18087605.html 
Sorry if I complicated things by creating two different issues. 
Sven, sorry about all these questions but my Javascript skills are very
limited.


Petros
 


kristian.marinkovic wrote:
> 
> the RenderSupport service is only available during
> the render phase (page rendering)
> 
> you are trying to access it during the component event
> phase 
> 
> (i hope i used the correct terms :))
> 
> g,
> kris
> 
> 
> 
> 
> "Sven Homburg" <[EMAIL PROTECTED]> 
> 22.07.2008 14:44
> Bitte antworten an
> "Tapestry users" <users@tapestry.apache.org>
> 
> 
> An
> "Tapestry users" <users@tapestry.apache.org>
> Kopie
> 
> Thema
> Re: @Environment problem
> 
> 
> 
> 
> 
> 
> wich version of tapestry are you using (5.0.??)
> 
> 2008/7/22 Petros Petrou <[EMAIL PROTECTED]>:
> 
>>
>> I have the following code
>>
>> Test.java
>>    @Environmental
>>    private RenderSupport renderSupport;
>>
>>   @OnEvent(value = "action", component = "openWindowActionLink")
>>    void onActionFromOpenWindowActionLink()
>>    {
>>        renderSupport.getClass();
>>    }
>>
>> Test.tml
>> <aa t:id="openWindowActionLink" t:type="ActionLink">Open Window</aa>
>>
>>
>> When the Open Window link is clicked I am getting the following 
> exception
>> No object of type org.apache.tapestry5.RenderSupport is available from 
> the
>> Environment. Available types are
>> org.apache.tapestry5.services.ComponentEventResultProcessor.
>>
>> Does anyone know how I can even approach this problem.
>>
>> Petros
>>
>> --
>> View this message in context:
>> http://www.nabble.com/%40Environment-problem-tp18587443p18587443.html
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> 
> -- 
> with regards
> Sven Homburg
> http://tapestry5-components.googlecode.com
> http://chenillekit.googlecode.com
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/%40Environment-problem-tp18587443p18591002.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to