Re: create EventLink without onPassivate

2018-08-23 Thread Thiago H. de Paula Figueiredo
On Wed, Aug 22, 2018 at 8:45 AM Jens Breitenstein 
wrote:

> Hi Thiago!
>

Hello!


> or simply a method which allows me to create the eventlink bypassing
> onPassivate and accepting a "new context object array". I know that this
> might introduce a different class of errors because the logic of link
> creation is now spread across different places, but I believe its still
> easier to deal with compared to modifying a "complex" page state in a loop.
>

I'd just pass everything you need in the EventLink context and ignore the
page activation context in the logic of the corresponding event handler
page. In other words, if you set variables a and b in onActivate(), ignore
them in the event link handler method.

Or, better yet, create a separate page for serving the JSON objects,
returning them in onActivate() according to the page activation context
received. You'd get URLs using PageRenderLinkSource. I believe you're
mixing two different things in the same page.

The other way round: I can create PageLinks with arbitrary page
> activation context objects, why not EventLinks?
>

Because PageLink is very different from EventLink. Pages have their own
activation context, events are part of a page. In a page, everything is
supposed to work according to its page activation context, event links
included. So what you're trying to do, the way you're doing, is going
against the rationale behind the framework, and, in Tapestry and in any
other framework out there, this usually doesn't go well.


> Sorry, I am a non native english speaker as you may have recognized
> already, hopefully you understand what I mean.
>

No problem! It was clear. I'm not an English speaker either. :)


>
>
> Am 21.08.18 um 23:56 schrieb Thiago H. de Paula Figueiredo:
> > Hello!
> >
> > Why do you want to have EventLinks with an activation context different
> > from the current one? This doesn't look good at first look, to be honest.
> >
> > On Thu, Aug 16, 2018 at 10:35 AM Jens Breitenstein  >
> > wrote:
> >
> >> Hi all!
> >>
> >> I use ComponentResources to create my EventLinks. As the page context
> >> (in this example "id") is added to the link onPassivate gets called.
> >> This results in a link like
> >>
> >>   /mypage:mycomponent?t:ac=id
> >>
> >> Each component context "cc1", "cc2" passed to the createEventLink method
> >> results in a link like
> >>
> >> /mypage:mycomponent/cc1/cc2?t:ac=id
> >>
> >> My goal is to replace the exisiting ac, means the activation context of
> >> the page which is used in onPassivate to create "arbitrary" eventlinks
> >> like this
> >>
> >> /webui/mypage:mycomponent?t:ac=ec1/ec2
> >>
> >> without accessing the page members prior link creation. Of course it's
> >> possible to convert the Link to URI / String and perform some string
> >> manipulations, but I wonder if there is a "real Tapestry" solution?
> >>
> >>
> >> Thanks in advance
> >>
> >> Jens
> >>
> >>
> >>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

-- 
Thiago


Re: create EventLink without onPassivate

2018-08-21 Thread Thiago H. de Paula Figueiredo
Hello!

Why do you want to have EventLinks with an activation context different
from the current one? This doesn't look good at first look, to be honest.

On Thu, Aug 16, 2018 at 10:35 AM Jens Breitenstein 
wrote:

> Hi all!
>
> I use ComponentResources to create my EventLinks. As the page context
> (in this example "id") is added to the link onPassivate gets called.
> This results in a link like
>
>  /mypage:mycomponent?t:ac=id
>
> Each component context "cc1", "cc2" passed to the createEventLink method
> results in a link like
>
> /mypage:mycomponent/cc1/cc2?t:ac=id
>
> My goal is to replace the exisiting ac, means the activation context of
> the page which is used in onPassivate to create "arbitrary" eventlinks
> like this
>
> /webui/mypage:mycomponent?t:ac=ec1/ec2
>
> without accessing the page members prior link creation. Of course it's
> possible to convert the Link to URI / String and perform some string
> manipulations, but I wonder if there is a "real Tapestry" solution?
>
>
> Thanks in advance
>
> Jens
>
>
>

-- 
Thiago