View Javadoc

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   import org.kuali.student.common.ui.client.application.KSAsyncCallback;
6   import org.kuali.student.common.ui.client.widgets.progress.BlockingTask;
7   import org.kuali.student.common.ui.client.widgets.progress.KSBlockingProgressIndicator;
8   
9   /**
10   * @author Igor
11   */
12  public class AbstractCallback<T> extends KSAsyncCallback<T> {
13  
14      private BlockingTask loadingTask;
15  
16      public AbstractCallback() {
17          this("Loading");
18      }
19  
20      public AbstractCallback(String text) {
21          loadingTask = new BlockingTask(text);
22          KSBlockingProgressIndicator.addTask(loadingTask);
23      }
24      
25      @Override
26  	public void onFailure(Throwable caught) {
27  		super.onFailure(caught);
28  	}
29  
30  	@Override
31      public void handleFailure(Throwable caught) {
32          KSBlockingProgressIndicator.removeTask(loadingTask);
33          Window.alert("Call failed on server.");
34          GWT.log("Exception:", caught);
35      }
36  
37      @Override
38      public void onSuccess(T result) {
39          KSBlockingProgressIndicator.removeTask(loadingTask);
40      }
41  }