@Environment problem

View: New views
7 Messages — Rating Filter:   Alert me  

@Environment problem

by Petros Petrou :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

Re: @Environment problem

by Sven Homburg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

wich version of tapestry are you using (5.0.??)

2008/7/22 Petros Petrou <petros@...>:

>
> 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: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>


--
with regards
Sven Homburg
http://tapestry5-components.googlecode.com
http://chenillekit.googlecode.com
best regards
Sven

Re: @Environment problem

by kristian.marinkovic :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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" <homburgs@...>
22.07.2008 14:44
Bitte antworten an
"Tapestry users" <users@...>


An
"Tapestry users" <users@...>
Kopie

Thema
Re: @Environment problem






wich version of tapestry are you using (5.0.??)

2008/7/22 Petros Petrou <petros@...>:

>
> 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: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>


--
with regards
Sven Homburg
http://tapestry5-components.googlecode.com
http://chenillekit.googlecode.com


Re: @Environment problem

by Petros Petrou :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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" <homburgs@googlemail.com>
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 <petros@cypoz.com>:

>
> 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: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


--
with regards
Sven Homburg
http://tapestry5-components.googlecode.com
http://chenillekit.googlecode.com

Re: @Environment problem

by kristian.marinkovic :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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 <petros@...>
22.07.2008 17:05
Bitte antworten an
"Tapestry users" <users@...>


An
users@...
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" <homburgs@...>
> 22.07.2008 14:44
> Bitte antworten an
> "Tapestry users" <users@...>
>
>
> An
> "Tapestry users" <users@...>
> Kopie
>
> Thema
> Re: @Environment problem
>
>
>
>
>
>
> wich version of tapestry are you using (5.0.??)
>
> 2008/7/22 Petros Petrou <petros@...>:
>
>>
>> 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: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>>
>
>
> --
> 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: users-unsubscribe@...
For additional commands, e-mail: users-help@...



Re: @Environment problem

by Chris Lewis-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Petros,

Instead of RenderSupport, try DocumentLinker. It should be available in
such cases, the only issue is that it's internal. I don't remember if
the "rules" are not to use internal services at all, or simply not to
extend them.

chris

Petros Petrou wrote:

> 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" <homburgs@...>
>> 22.07.2008 14:44
>> Bitte antworten an
>> "Tapestry users" <users@...>
>>
>>
>> An
>> "Tapestry users" <users@...>
>> Kopie
>>
>> Thema
>> Re: @Environment problem
>>
>>
>>
>>
>>
>>
>> wich version of tapestry are you using (5.0.??)
>>
>> 2008/7/22 Petros Petrou <petros@...>:
>>
>>    
>>> 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: users-unsubscribe@...
>>> For additional commands, e-mail: users-help@...
>>>
>>>
>>>      
>> --
>> with regards
>> Sven Homburg
>> http://tapestry5-components.googlecode.com
>> http://chenillekit.googlecode.com
>>
>>
>>
>>    
>
>  

--
http://thegodcode.net


Re: @Environment problem

by kristian.marinkovic :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi chris,

the DocumentLinker is a service is a service that is only
accessible via the RenderSupport service and therefore
suffers the same problem

see TapestryModule:

public void contributeMarkupRenderer(...)
{
....
MarkupRendererFilter pageRenderSupport = new MarkupRendererFilter()
{
    public void renderMarkup(MarkupWriter writer, MarkupRenderer renderer)
    {
        DocumentLinkerImpl linker = new
DocumentLinkerImpl(productionMode);

        RenderSupportImpl support = new RenderSupportImpl(linker,
symbolSource, assetSource,

g,
kris





Chris Lewis <chris_lewis@...>
23.07.2008 13:11
Bitte antworten an
"Tapestry users" <users@...>


An
Tapestry users <users@...>
Kopie

Thema
Re: @Environment problem






Petros,

Instead of RenderSupport, try DocumentLinker. It should be available in
such cases, the only issue is that it's internal. I don't remember if
the "rules" are not to use internal services at all, or simply not to
extend them.

chris

Petros Petrou wrote:
> 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" <homburgs@...>
>> 22.07.2008 14:44
>> Bitte antworten an
>> "Tapestry users" <users@...>
>>
>>
>> An
>> "Tapestry users" <users@...>
>> Kopie
>>
>> Thema
>> Re: @Environment problem
>>
>>
>>
>>
>>
>>
>> wich version of tapestry are you using (5.0.??)
>>
>> 2008/7/22 Petros Petrou <petros@...>:
>>
>>
>>> 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: users-unsubscribe@...
>>> For additional commands, e-mail: users-help@...
>>>
>>>
>>>
>> --
>> with regards
>> Sven Homburg
>> http://tapestry5-components.googlecode.com
>> http://chenillekit.googlecode.com
>>
>>
>>
>>
>
>

--
http://thegodcode.net