Thiago,

Using the ComponentSource service methods won't get me a handle to the current rendering component...

if i'm wrong, can you please provide an example?

I'm trying to find a good re-usable/injectable home for some convenience methods. eg:

    public boolean isCurrentPage(Class<?> pageClass)
    {
        return getCurrentPageName().equals(getPageName(pageClass));
    }

    public String getPageName(Class<?> pageClass)
    {
return componentClassResolver.resolvePageClassNameToPageName(pageClass.getName());
    }

    public String getCurrentPageName()
    {
        return componentResources.getPageName();
    }

There are to be more, some more complex.

p.

On 23/11/2010 10:31 PM, Thiago H. de Paula Figueiredo wrote:
On Tue, 23 Nov 2010 08:39:03 -0200, Paul Stanton <p...@mapshed.com.au> wrote:

"@Environmental
private ComponentResources componentResources;"

I have been unable to get this to work since ComponentResources is not in fact available on the Environment.

I guess your service is being invoked after or before rendering, not during it. Try using the ComponentSource service methods. They will return a Component instance for you. Don't forget that pages are components too. :) Then use its getComponentResources() to get the ComponentResources.

By the way, what exactly are you trying to do?


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

Reply via email to