I want navigate to “foo”, this is a view with information of loading, when “foo” is loaded that “bar” load (read data) and when “bar” is loaded navigate to “bar”.
OK, that makes sense. You need to use a background thread. In the enter method of “foo”, start a thread that calls navigateTo(“bar”); You need to synchronize the thread properly, so you need to wrap your call in a Runnable and pass it to your UI. All in all, it should look something like this:
[code]
public void enter(){
final UI ui= getUI();
ui.setPollInterval(1000);
new Thread(){
@Override
public void run() {
//synchronize session
ui.access(new Runnable() {
@Override
public void run() {
ui.setPollInterval(0);
ui.getNavigator().navigateTo("bar");
}
});
}
}.start();
}
[/code]What will happen is that your thread will try to run, but it can’t, until the current request is being processed. That request will load up “foo” normally, and start polling the server each second. Then your thread will run, navigate to “bar”, and turn off the polling. “foo” should be visible until “bar” has loaded.