On Tue, 07 Sep 2010 22:30:58 -0300, Marek Stanisław Wawrzyczny <marek_wawrzyc...@internode.on.net> wrote:

Hi,

Hi!

Yes, I'm working with incoming links. The code I have so far:

I guess you're missing some ready-to-use, non internal EventContext implementation. All them in Tapestry 5.1.0.5 (haven't had the time to try 5.2 yet :'() are internal. On the other hand, implementing EventContext using a List and the TypeCoercer service is easy. :) Here's the implementation of ArrayEventContext:


public class ArrayEventContext implements EventContext
{
    private final TypeCoercer typeCoercer;

    private final Object[] values;

    public ArrayEventContext(TypeCoercer typeCoercer, Object... values)
    {
        this.typeCoercer = typeCoercer;
        this.values = values;
    }

    public <T> T get(Class<T> desiredType, int index)
    {
        return typeCoercer.coerce(values[index], desiredType);
    }

    public int getCount()
    {
        return values.length;
    }
}

Then you would use it in your code:

PageRenderRequestParameters newRequest = new PageRenderRequestParameters(
                                                "Page", new 
ArrayEventContext(node), false);

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

Reply via email to