You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Martin Funk <ma...@googlemail.com> on 2009/06/07 19:40:48 UTC
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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Component lifecycle question
Posted by Martin Funk <ma...@googlemail.com>.
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<ma...@googlemail.com> 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-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@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-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
Re: Component lifecycle question
Posted by Alex Objelean <al...@yahoo.com>.
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<ma...@googlemail.com> 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-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Component lifecycle question
Posted by Martin Funk <ma...@googlemail.com>.
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<ma...@googlemail.com> 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-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
Re: Component lifecycle question
Posted by Igor Vaynberg <ig...@gmail.com>.
On Sun, Jun 7, 2009 at 10:40 AM, Martin Funk<ma...@googlemail.com> 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-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org