Modal window with progressbar for long tasks

我怕爱的太早我们不能终老 提交于 2019-12-05 17:24:52

If you know the number of responses to get, you can use such approach:

class TaskCompletedHandler{ // inner class
    private static final int NUMBER_OF_RESPONSES = 4;//just example

    private int tasksCompleted;

    public void notifyOfCompletedTask(){
        tasksCompleted++;
        if (tasksCompleted == NUMBER_OF_RESPONSES){
            blockerWindow.hide(); 
        }
    }
}

create instance of this class before showing modal window and then notify this handler in AsyncCallback

service1.findDependenciesForListBox1(id1, new AsyncCallback<List<Dependency1DTO>>() {
   public void onFailure(Throwable caught) {
      taskCompletedHandler.notifyOfCompletedTask();
      // exception handling here
   }
   public void onSuccess(List<Dependency1DTO> data) {
      taskCompletedHandler.notifyOfCompletedTask();
      // listBox1 filling here
   }
});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!