On Tue, Jan 17, 2012 at 3:19 PM, humcasma <[email protected]> wrote:
>
> Martin Grigorov-4 wrote
>>
>> Yes. Just add both to the target when the data is available
>>
>
> Well, I have now managed to get both the textarea updated while my
> background thread is running, and the dropdownchoice updated when the thread
> is finished. For that I use an AbstractAjaxTimerBehavior that I add to the
> textarea component (I guess I could also add it to my Page). Then, on the
> onTimer() method I add the textarea and/or the dropdownchoice to the target.
> So far, so good. The only problem now is that the timer is running all the
> time, even when I do not needed (i.e. even when the background thread is not
> running). I would like to start the timer when I launch the background
> thread and stop it when the thread is finished. I saw here
> (https://issues.apache.org/jira/browse/WICKET-1525) that there are plans to
> have a resettable timer. I tried to use the

If I understand you correctly then all you need is just
timerBehavior.stop(). You don't need the restart functionality.
You can also remove the behavior from the component and add new
behavior instance later if you need it.

Btw WICKET-1525 is implemented in Wicket 6.0

> AbstractAjaxRestartableTimerBehavior class provided there, but I have
> encountered a problem. I create an AbstractAjaxRestartableTimerBehavior
> timer and add it to my Page. In the onTimer() method I check whether I have
> to update the textarea and the dropdownchoice and, if so, I add them to the
> target. If I find out that the background thread has finished, I also stop
> the timer (i.e. I stop the timer inside the onTimer() method). Everything
> works fine until I stop the timer. The onTimer() method finishes ok, but
> then I get an "Access Denied" message on the browser and the following
> warning:
>
> WARN  - RequestListenerInterface   - behavior not enabled; ignore call.
> Behavior test.web.gui.Index$1@17574b9 at component [Page class =
> test.web.gui.Index, id = 1, render count = 2]
>
> More details: My Page consists of a textarea, a timer and a form. The form
> contains the dropdownchoice. I have tried adding the timer to the textarea,
> but get the same error (but for the textarea component). I have tried
> submitting the form via Ajax and normally. Same error.
>
> Hope you know what the problem is and can help me.
>
> Cheers,
> Humberto
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Update-component-after-background-thread-is-finished-tp4300126p4303428.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to