Make that:
onActivate(Object[] list)
{
if(params==null || params!=list) //actually a method doing a compare on
the elements of the list
{
//handle context
params = list;
}
}
Britske wrote:
>
> Thanks, removed the onActivate() without params.
>
> Moreover, i didn't test fully and discovered that on a post onActivate is
> called once with the context of the old page and once with the context of
> the new page, so it's not always empty the first time. Probably saying the
> obvious but anyway.. Only in the latter case should the onActivate result
> in update of my lists.
>
> for that i have the following to track the current activation-context
>
> @Persist Object[] params;
>
> now i do:
>
> onActivate(Object[] list)
> {
> if(params!=list) //actually a method doing a compare on the elements of
> the list
> {
> //handle context
> params = list;
> }
> }
>
> thanks for helping me in the right direction,
> Geert-Jan
>
>
>
> Nick Westgate wrote:
>>
>> I'm not going to delve into the logic of your use case.
>> Just put have one activate handler:
>>
>> void onActivate(Object[] context)
>> {
>> if (context.length == 0)
>> {
>> // handle no context
>> {
>> else
>> {
>> // handle context
>> {
>> }
>>
>> Cheers,
>> Nick.
>>
>>
>> Britske wrote:
>>> for a page, I have two activation-methods:
>>>
>>> onActivate()
>>> onActivate(Object[] list);
>>>
>>> when i provide an activation context to the page both methods are called
>>> -onactivate() first-.
>>> This seems correct behavior according to some forum-posts i've read.
>>>
>>> However, both methods call a method syncLists() which does a pretty
>>> expensive operation (get search results based on the activation context
>>> or
>>> default if no activation context exists).
>>>
>>> The problem is that now syncLists() is called twice when the page has an
>>> activation-context (based on calling both of the onActivate()-methods).
>>> Obviously this is unwanted.
>>>
>>> However, I can't remove syncLists() from onActivate() (without params),
>>> because a page-access without activation-context should call syncLists()
>>> as
>>> well.
>>>
>>> so what i need to do is
>>> a. have onActivate() not called when an activatecontext exists
>>> b. detect in onActivate() that an activationcontext exists and based on
>>> that
>>> not call syncLists().
>>> c. don't have syncLists() updated on onActivate() but on a change of the
>>> page (so before the "redirect-after-post")
>>>
>>> I can't find a way to do A. or B. while C. doesn't seem the best option,
>>> because a lot of fields (on the page and in components) would need to be
>>> tagged with @Persist to survive setting them on post and then
>>> redirecting.
>>>
>>> Anyone?
>>>
>>> Thanks,
>>> Geert-Jan
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/-T5-%3A-how-to-prevent-onActivate%28%29-from-firing-with-activationcontext-tf4683298.html#a13384953
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]