Thanks Tiago,

I did see that Contenxt type before but didn't look into it since it's in the 
internal package. I'll look into using ArrayEventContext.

Are there plans to make a public API to the EventContext manipulation or to 
maybe create a new set of API for that purpose? 

I would imagine that having parameters embedded in the URL paths will become an 
increasingly popular since it is seen as a more friendly way of generating 
URLs. It would be nice to have a simple way of passing parsed parameters into a 
new event context of a page.


Cheers,

Marek


On 08/09/2010, at 11:53, Thiago H. de Paula Figueiredo wrote:

> 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
> 


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

Reply via email to