Re: Component lifecycle question
hm... how about this (i changed the method naming from onRemove to onRemoveFromHierarchy): @Override protected void onRemoveFromHierarchy() { if (AjaxRequestTarget.get() != null) { AjaxRequestTarget.get().appendJavascript("remove the JavaScript objects that belong to me."); } super.onRemoveFromHierarchy(); } with the current api it seems to impossible to implement something like the counterpart of the "poor men's init/onAttach" idiom as described here: http://cwiki.apache.org/confluence/display/WICKET/Page+construction+strategies#Pageconstructionstrategies-UsingComponent%23onBeforeRender mf Am 10.06.2009 um 14:51 schrieb Alex Objelean: Hi Martin, Could you please provide an example of how you could be able to control javascript object if you would have onRemove method? Thanks! Alex Martin Funk-3 wrote: this is how free I felt: https://issues.apache.org/jira/browse/WICKET-2321 I'd be looking forward for that especially in the context of Ajax and keeping control over JavaScript objects on the browser side. Like components that induce the instation of JavaScript objects in the Browser. These should outlive the Component#detach() but be cleaned up on removal of the Component. From my perspective the given patch would be a good way to go. mf Am 08.06.2009 um 18:27 schrieb Igor Vaynberg: On Sun, Jun 7, 2009 at 10:40 AM, Martin Funk wrote: Hi list, in short: Why is there no Component#onRemove() method? because no one asked for it. feel free to create a jira issue with the request. -igor I see that there is Component#onDetach() which is called by Component#remove(), so it might be a good candidate. But onDetach is also called at the end of every RequestCycle. I have things that I want to get done when a Component is removed or replaced, not on every detach. How can I achieve that? mf - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- View this message in context: http://www.nabble.com/Component-lifecycle-question-tp23913399p23961642.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Component lifecycle question
Hi Martin, Could you please provide an example of how you could be able to control javascript object if you would have onRemove method? Thanks! Alex Martin Funk-3 wrote: > > this is how free I felt: > https://issues.apache.org/jira/browse/WICKET-2321 > > I'd be looking forward for that especially in the context of Ajax and > keeping control over JavaScript objects on the browser side. Like > components that induce the instation of JavaScript objects in the > Browser. These should outlive the Component#detach() but be cleaned up > on removal of the Component. From my perspective the given patch would > be a good way to go. > > mf > > Am 08.06.2009 um 18:27 schrieb Igor Vaynberg: > >> On Sun, Jun 7, 2009 at 10:40 AM, Martin >> Funk wrote: >>> Hi list, >>> >>> in short: >>> >>> Why is there no Component#onRemove() method? >> >> because no one asked for it. feel free to create a jira issue with >> the request. >> >> -igor >> >>> >>> I see that there is Component#onDetach() which is called by >>> Component#remove(), so it might be a good candidate. >>> But onDetach is also called at the end of every RequestCycle. >>> I have things that I want to get done when a Component is removed or >>> replaced, not on every detach. >>> >>> How can I achieve that? >>> >>> mf >>> >>> - >>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >>> For additional commands, e-mail: users-h...@wicket.apache.org >>> >>> >> >> - >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> For additional commands, e-mail: users-h...@wicket.apache.org >> > > > -- View this message in context: http://www.nabble.com/Component-lifecycle-question-tp23913399p23961642.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Component lifecycle question
this is how free I felt: https://issues.apache.org/jira/browse/WICKET-2321 I'd be looking forward for that especially in the context of Ajax and keeping control over JavaScript objects on the browser side. Like components that induce the instation of JavaScript objects in the Browser. These should outlive the Component#detach() but be cleaned up on removal of the Component. From my perspective the given patch would be a good way to go. mf Am 08.06.2009 um 18:27 schrieb Igor Vaynberg: On Sun, Jun 7, 2009 at 10:40 AM, Martin Funk wrote: Hi list, in short: Why is there no Component#onRemove() method? because no one asked for it. feel free to create a jira issue with the request. -igor I see that there is Component#onDetach() which is called by Component#remove(), so it might be a good candidate. But onDetach is also called at the end of every RequestCycle. I have things that I want to get done when a Component is removed or replaced, not on every detach. How can I achieve that? mf - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Component lifecycle question
On Sun, Jun 7, 2009 at 10:40 AM, Martin Funk wrote: > Hi list, > > in short: > > Why is there no Component#onRemove() method? because no one asked for it. feel free to create a jira issue with the request. -igor > > I see that there is Component#onDetach() which is called by > Component#remove(), so it might be a good candidate. > But onDetach is also called at the end of every RequestCycle. > I have things that I want to get done when a Component is removed or > replaced, not on every detach. > > How can I achieve that? > > mf > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Component lifecycle question
Hi list, in short: Why is there no Component#onRemove() method? I see that there is Component#onDetach() which is called by Component#remove(), so it might be a good candidate. But onDetach is also called at the end of every RequestCycle. I have things that I want to get done when a Component is removed or replaced, not on every detach. How can I achieve that? mf - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Component lifecycle question
add everything in onbeforerender and add a flag so it only gets added once. -igor On Sun, Apr 5, 2009 at 6:24 AM, Dave Schoorl wrote: > Hi list, > > I want to create the UI of a MarkupContainer after it has been added to the > component hierarchy, because I need to get to the Page for information > needed in constructing the UI. > > MarkupContainer.onBeforeRender() just doesn't smell right and passing the > Page as an argument in the construction of the MarkupContainer is too > bloated. What is the suggested best way to accomplish what I want? > > Thanks in advance, > Dave > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Component lifecycle question
Hi list, I want to create the UI of a MarkupContainer after it has been added to the component hierarchy, because I need to get to the Page for information needed in constructing the UI. MarkupContainer.onBeforeRender() just doesn't smell right and passing the Page as an argument in the construction of the MarkupContainer is too bloated. What is the suggested best way to accomplish what I want? Thanks in advance, Dave - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org