Project

General

Profile

Update UI from background thread

Added by Jan Goyvaerts about 13 years ago

What's the usual way to update the UI from a background thread ? (ie. setting progress, status messages, ...)

Typically for Swing application you would rely on SwingUtilities to check whether this is the EDT and otherwise to enqueue the UI change into the EDT thread.

But how does this work for JWt ?

TIA !

Jan


Replies (4)

RE: Update UI from background thread - Added by Hristo Hristov almost 13 years ago

+1 for this question

I have a similar problem: I want to create a JWt web application which can subscribe to pubnub channel and show every received message in the UI. But how to start listening in the background and update the UI when new message is received? Are background tasks even supported?

last but not least, thanks for this awesome toolkit, love it :)

RE: Update UI from background thread - Added by Wim Dumon almost 13 years ago

Hello,

This is possible when you use JWt's server push infrastructure.

See http://www.webtoolkit.eu/jwt/latest/doc/javadoc/eu/webtoolkit/jwt/WApplication.html#enableUpdates%28boolean%29

Best regards,

Wim.

RE: Update UI from background thread - Added by Dave Loyall over 11 years ago

How about polling?

I chose jaywitty because of how easy it was to prototype simple UIs. I want to control back end processes. The UIs will only be used locally, so polling is fine for me.

I looked at WTimer, but it doesn't seem to be what I need.

Incidentally, simply refreshing the page doesn't do what I need, either... I guess that the WApplication I instantiated during the initial page load is still hanging around...

?

Thanks,

---Dave

RE: Update UI from background thread - Added by Wim Dumon over 11 years ago

Hello Dave,

If I understand your question correctly, WTimer should be the answer (however, I'd still recommend server push, since it's almost as easy to use with Wt).

How does WTimer not do what you need?

BR,

Wim.

    (1-4/4)