Hi, 

I have a long-running job that runs in another thread. To this job you can
pass listeners to get notifications of various events such as when the job
has ended and various other status events. I'd like to have a Wicket page
with a label that updates when the status of the job changes and a
WebMarkupContainer should be set to visible when the job has finished. My
first approach was to just try to update the components directly from the
listener but that doesn't work since you cannot update a Wicket component
from another thread. My next approach was then to create a level of
indirection by creating a mutable Wicket model object that can be shared
between the two threads. Having added a AjaxSelfUpdatingTimerBehavior to the
label the text was updated correctly with the status changes when the state
of the shared model object was updated. But setting the visibility of the
WebMarkupContainer cannot be done in this way since you explicitly need to
call setVisible on the instance. So the question is, how should I go about?

One approach that I'm thinking of is to add some sort of ajax call-back
method mechanism to the web page that checks a "visbility" state in the
shared model on a frequent time-interval. If the state has changed then
perform whatever logic needed. But how do I make Wicket invoke such a
call-back method every X second? Is this a reasonable approach to solving
these kind of problems?

/Johan
-- 
View this message in context: 
http://www.nabble.com/Changing-model-state-from-another-thread-tp21584253p21584253.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

Reply via email to