Re: create EventLink without onPassivate
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
Hi Thiago! Well, I have different entry points to show a different amount of the same type of data. Either I can enter the page 1) using a PK (which results in a list of child entities) or 2) a combination of two PKs (a direct parent / child relation) or 3) an intervall (which directly results in child entities for the intervall having multiple roots) or 4) a search string 5) a.s.o. This is all reflected in readable URLs. The data and all componts used on my page are (more or less) the same regardless of the entry path. But to show some details I always use a combination of PKs which I do not have in my activation context for method 1, 3, 4, 5, but I know it from the hibernate objects anyway. So consider I have a loop to build up my JSON Objects including an eventlink: I have to reset my page state prior eventlink creation which on the other hand destroys my initial onActivate context. So a workaround is something like this: push activation context reset context in loop and create eventlinks pop activation context 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. The other way round: I can create PageLinks with arbitrary page activation context objects, why not EventLinks? Jens Sorry, I am a non native english speaker as you may have recognized already, hopefully you understand what I mean. 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
Re: create EventLink without onPassivate
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
create EventLink without onPassivate
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