Example usage for com.google.gwt.core.client RunAsyncCallback onFailure

List of usage examples for com.google.gwt.core.client RunAsyncCallback onFailure

Introduction

In this page you can find the example usage for com.google.gwt.core.client RunAsyncCallback onFailure.

Prototype

void onFailure(Throwable reason);

Source Link

Document

Called when, for some reason, the necessary code cannot be loaded.

Usage

From source file:de.swm.commons.mobile.client.widgets.progressbar.MobileProgressBar.java

License:Apache License

/**
 * {@inheritDoc}/*from  w ww  .j a  v a2 s.  c  om*/
 * 
 * @see de.swm.issng.gkpk.client.utils.progressbar.IProgressBarWaitDialog#start()
 */
@Override
public void start(final RunAsyncCallback callbackToExecute) {

    if (isStopped || !this.loadingPanel.isVisible()) {
        showDialog();
    }
    isStopped = false;
    final CancelMonitor monitor = new CancelMonitor();
    RunAsyncCallback wrappedCallback = new RunAsyncCallback() {

        @Override
        public void onFailure(Throwable error) {
            if (!monitor.isCanceled()) {
                callbackToExecute.onFailure(error);
            }
            cancelCallbacksAndForceStop();
        }

        @Override
        public void onSuccess() {
            if (!monitor.isCanceled()) {
                callbackToExecute.onSuccess();
            }
            removeFromQueue(this);
        }

    };

    callbacksToCancel.add(monitor);
    runAsyncCallbacks.add(wrappedCallback);
    GWT.runAsync(wrappedCallback);
}