In some cases, I want to show the user a modal window with a progress bar during a long request. (I use a method for individual user interface elements setEnabled (true/ false), but I want a more elegant solution.)
For example, at the entry point, until all elements are initialized -
public void onModuleLoad() {
}
And also, for example, when filling out the dependent list (one-to-many relationship)
@UiHandler("listBox")
public void onListBoxChange(ChangeEvent event) {
someService.findDependencies(id, new AsyncCallback<List<DependencyDTO>>() {
public void onFailure(Throwable caught) {
}
public void onSuccess(List<DependencyDTO> data) {
}
});
}
In Vaadin applications, I can add the following code to the listener, for example -
...
Thread thread = new Thread() {
@Override
public void run() {
window.removeWindow(blockerWindow);
}
};
thread.start();
blockerWindow = new BlockerWindow();
window.addWindow(blockerWindow);
...
In my case, I can use the following method to display a window with a progress bar -
private void freezeInterface() {
blockerWindow = new BlockerWindow()
blockerWindow.setGlassEnabled(true);
blockerWindow.setAnimationEnabled(true);
blockerWindow.setModal(true);
blockerWindow.center();
blockerWindow.show();
}
And the method to hide the window is
private void unfreezeInterface() {
blockerWindow.hide();
}
Question: when hides the window.
For example, at the entry point there are a number of requests -
...
service1.findDependenciesForListBox1(id1, new AsyncCallback<List<Dependency1DTO>>() {
public void onFailure(Throwable caught) {
}
public void onSuccess(List<Dependency1DTO> data) {
}
});
service2.findDependenciesForListBox2(id2, new AsyncCallback<List<Dependency2DTO>>() {
public void onFailure(Throwable caught) {
}
public void onSuccess(List<Dependency2DTO> data) {
}
});
serviceN.findDependenciesForListBoxN(idN, new AsyncCallback<List<DependencyNDTO>>() {
public void onFailure(Throwable caught) {
}
public void onSuccess(List<DependencyNDTO> data) {
}
});
Etc.
onSuccess .
timer, , schedule.
...
blockerWindow.show();
private void unfreezeInterface() {
timer = new Timer() {
public void run() {
blockerWindow.hide();
}
};
timer.schedule(15000);
}
...
GWT?