Hey, so my problem here is that when I have multiple tabs open and I try to use Notifications while running in a background thread under a ProgressIndicator my notification shows up on the other tab rather than the one I was working in. I was guessing the background thread is not able to get a hold of the current UI but I tried storing a reference to the ui and using the deprecated method off the ui to show notifications but its still doing the same thing. What am I missing? Any suggestions?
//implementation of ProgressIndicator that enables/dissables itself on attach/detach.
final BusyWindow bw = EditEnvPanel.this.uiCompFact.createBusyWindow("Saving changes");
final Lock lock = getSession().getLock();
final UI ui = getUI();
ui.addWindow(bw);
Runnable r = new Runnable(){
public void run(){
lock.lock();
try{
updatedEnv = EditEnvPanel.this.dao.saveEnvironment(env);
ui.getNavigator().navigateTo(EnvDetailPanel.getFragment(updatedEnv.getEnvId()));
} catch (IllegalArgumentException e){
// ui.showNotification(e.getMessage(), Type.WARNING_MESSAGE);
Notification.show(e.getMessage(), Type.WARNING_MESSAGE);
}
finally{
if(lock != null)
lock.unlock();
bw.close();
}
}
};
this.execSvc.submit(r);