I’m doing an application with long running searches and I would like to show a simple message with “Searching… please wait.” kind of feedback after search has been initiated.
How do I force an UI update? Is it possible to do it in same thread or do I need to spawn a new thread to do the search and then update the ui?
But then how do I force UI update after the search thread completes?
Example:
Button b = new Button("Search", new ClickListener() {
// Show the info
_infoDisplayAboutWorking.setVisible(true);
// force UI update?
// do the search...
// OK, search done.
_infoDisplayAboutWorking.setVisible(false);
});
Sorry if this is a beginners question - just started experimenting with the toolkit.
_infoDisplayAboutWorking.setVisible(true);
// Use a ProgressIndicator to poll the server
final ProgressIndicator poller = new ProgressIndicator(new Float(0.0));
poller.setPollingInterval(2000); // Poll server for changes every 2 secs
mylayout.addComponent(poller);
// Do the search in separate thread
Thread worker = new Thread() {
public void run() {
// do the search...
// OK, search done.
_infoDisplayAboutWorking.setVisible(false);
mylayout.removeComponent(poller);
}
}
worker.start();