1 package org.kuali.student.lum.program.client.rpc;
2
3 import com.google.gwt.core.client.GWT;
4 import com.google.gwt.user.client.Window;
5
6 import org.kuali.student.common.ui.client.application.KSAsyncCallback;
7 import org.kuali.student.common.ui.client.widgets.progress.BlockingTask;
8 import org.kuali.student.common.ui.client.widgets.progress.KSBlockingProgressIndicator;
9
10
11
12
13 public class AbstractCallback<T> extends KSAsyncCallback<T> {
14
15 private BlockingTask loadingTask;
16
17 public AbstractCallback() {
18 this("Loading");
19 }
20
21 public AbstractCallback(String text) {
22 loadingTask = new BlockingTask(text);
23 KSBlockingProgressIndicator.addTask(loadingTask);
24 }
25
26 @Override
27 public void onFailure(Throwable caught) {
28 super.onFailure(caught);
29 }
30
31 @Override
32 public void handleFailure(Throwable caught) {
33 KSBlockingProgressIndicator.removeTask(loadingTask);
34 Window.alert("Call failed on server.");
35 GWT.log("Exception:", caught);
36 }
37
38 @Override
39 public void onSuccess(T result) {
40 KSBlockingProgressIndicator.removeTask(loadingTask);
41 }
42 }