001 package org.kuali.student.lum.program.client.rpc; 002 003 import com.google.gwt.core.client.GWT; 004 import com.google.gwt.user.client.Window; 005 006 import org.kuali.student.common.ui.client.application.KSAsyncCallback; 007 import org.kuali.student.common.ui.client.widgets.progress.BlockingTask; 008 import org.kuali.student.common.ui.client.widgets.progress.KSBlockingProgressIndicator; 009 010 /** 011 * @author Igor 012 */ 013 public class AbstractCallback<T> extends KSAsyncCallback<T> { 014 015 private BlockingTask loadingTask; 016 017 public AbstractCallback() { 018 this("Loading"); 019 } 020 021 public AbstractCallback(String text) { 022 loadingTask = new BlockingTask(text); 023 KSBlockingProgressIndicator.addTask(loadingTask); 024 } 025 026 @Override 027 public void onFailure(Throwable caught) { 028 super.onFailure(caught); 029 } 030 031 @Override 032 public void handleFailure(Throwable caught) { 033 KSBlockingProgressIndicator.removeTask(loadingTask); 034 Window.alert("Call failed on server."); 035 GWT.log("Exception:", caught); 036 } 037 038 @Override 039 public void onSuccess(T result) { 040 KSBlockingProgressIndicator.removeTask(loadingTask); 041 } 042 }