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