Java 类com.google.gwt.core.client.RunAsyncCallback 实例源码

项目:unitimes    文件:Client.java   
public void initPageAsync(final String page) {
    GWT.runAsync(new RunAsyncCallback() {
        public void onSuccess() {
            init(page);
            LoadingWidget.getInstance().hide();
        }
        public void onFailure(Throwable reason) {
            Label error = new Label(MESSAGES.failedToLoadPage(reason.getMessage()));
            error.setStyleName("unitime-ErrorMessage");
            RootPanel loading = RootPanel.get("UniTimeGWT:Loading");
            if (loading != null) loading.setVisible(false);
            RootPanel.get("UniTimeGWT:Body").add(error);
            LoadingWidget.getInstance().hide();
            UniTimeNotifications.error(MESSAGES.failedToLoadPage(reason.getMessage()), reason);
        }
    });
}
项目:demo-gwt-springboot    文件:DemoGwtWebApp.java   
private void init() {
       logger.info("Init...");

    addMetaElements();

    // Disable Back Button
    setupHistory();
    setupBootbox();

    GWT.runAsync(new RunAsyncCallback() {
        @Override
        public void onFailure(Throwable reason) {
            logger.info("Error on Async!");
        }

        @Override
        public void onSuccess() {
            createViews();
            removeLoadingImage();

               // Example calling JavaScript with JSNI - old style
               // alert("Lofi Old Style...");
        }
    });
}
项目:unitime    文件:Client.java   
public void initPageAsync(final String page) {
    GWT.runAsync(new RunAsyncCallback() {
        public void onSuccess() {
            init(page);
            LoadingWidget.getInstance().hide();
        }
        public void onFailure(Throwable reason) {
            Label error = new Label(MESSAGES.failedToLoadPage(reason.getMessage()));
            error.setStyleName("unitime-ErrorMessage");
            RootPanel loading = RootPanel.get("UniTimeGWT:Loading");
            if (loading != null) loading.setVisible(false);
            RootPanel.get("UniTimeGWT:Body").add(error);
            LoadingWidget.getInstance().hide();
            UniTimeNotifications.error(MESSAGES.failedToLoadPage(reason.getMessage()), reason);
        }
    });
}
项目:mvp4g    文件:Mvp4gGenerator.java   
String[] getClassesToImport() {
  return new String[] { com.mvp4g.client.history.PlaceService.class.getName(),
                        GWT.class.getName(),
                        com.google.gwt.user.client.History.class.getName(),
                        ServiceDefTarget.class.getName(),
                        PresenterInterface.class.getName(),
                        EventBus.class.getName(),
                        Mvp4gException.class.getName(),
                        HistoryConverter.class.getName(),
                        Mvp4gEventPasser.class.getName(),
                        Mvp4gModule.class.getName(),
                        GinModules.class.getName(),
                        Ginjector.class.getName(),
                        BaseEventBus.class.getName(),
                        EventFilter.class.getName(),
                        EventHandlerInterface.class.getName(),
                        List.class.getName(),
                        NavigationEventCommand.class.getName(),
                        NavigationConfirmationInterface.class.getName(),
                        RunAsyncCallback.class.getName(),
                        Mvp4gRunAsync.class.getName(),
                        Command.class.getName(),
                        HistoryProxyProvider.class.getName(),
                        DefaultHistoryProxy.class.getName() };
}
项目:xapi    文件:JUnitUi.java   
protected void loadTests(final boolean forReal) {
  GWT.runAsync(JUnit4Runner.class, new RunAsyncCallback() {

    @Override
    public void onSuccess() {
      if (forReal) {
        displayTests();
        runTests();
      }
    }

    @Override
    public void onFailure(final Throwable reason) {
      X_Log.error(JUnitUi.class, "RunAsync Failed", reason);
    }
  });
}
项目:xapi    文件:TestEntryPoint.java   
protected void loadTests(final boolean forReal) {
  GWT.runAsync(JUnit4Executor.class, new RunAsyncCallback() {

    @Override
    public void onSuccess() {
      if (forReal) {
        displayTests();
        runTests();
      }
    }

    @Override
    public void onFailure(final Throwable reason) {

    }
  });
}
项目:xapi    文件:TestEntryPoint.java   
protected void addAnnotationTests() {
  GWT.runAsync(AnnotationTests.class, new RunAsyncCallback() {
    @Override
    public void onSuccess() {
      magicClass(AnnotationTests.class);
      try {
        addTests(AnnotationTests.class);
      } catch (final Throwable e) {
        print("Error adding AnnotationTests", e);
      }
    }

    @Override
    public void onFailure(final Throwable reason) {
      print("Error loading AnnotationTests", reason);
    }
  });
}
项目:xapi    文件:TestEntryPoint.java   
protected void addArrayTests() {
  GWT.runAsync(ArrayTests.class, new RunAsyncCallback() {
    @Override
    public void onSuccess() {
      magicClass(ArrayTests.class);
      try {
        addTests(ArrayTests.class);
      } catch (final Throwable e) {
        print("Error adding ArrayTests", e);
      }
    }

    @Override
    public void onFailure(final Throwable reason) {
      print("Error loading ArrayTests", reason);
    }
  });
}
项目:xapi    文件:TestEntryPoint.java   
protected void addConstructorTests() {
  GWT.runAsync(ConstructorTests.class, new RunAsyncCallback() {
    @Override
    public void onSuccess() {
      magicClass(ConstructorTests.class);
      try {
        addTests(ConstructorTests.class);
      } catch (final Throwable e) {
        print("Error adding ConstructorTests", e);
      }
    }

    @Override
    public void onFailure(final Throwable reason) {
      print("Error loading ConstructorTests", reason);
    }
  });
}
项目:xapi    文件:TestEntryPoint.java   
protected void addFieldTests() {
  GWT.runAsync(FieldTests.class, new RunAsyncCallback() {
    @Override
    public void onSuccess() {
      magicClass(FieldTests.class);
      try {
        addTests(FieldTests.class);
      } catch (final Throwable e) {
        print("Error adding FieldTests", e);
      }
    }

    @Override
    public void onFailure(final Throwable reason) {
      print("Error loading FieldTests", reason);
    }
  });
}
项目:xapi    文件:TestEntryPoint.java   
protected void addMethodTests() {
  GWT.runAsync(MethodTests.class, new RunAsyncCallback() {
    @Override
    public void onSuccess() {
      magicClass(MethodTests.class).getMethods();
      try {
        addTests(MethodTests.class);
      } catch (final Throwable e) {
        print("Error adding MethodTests", e);
      }
    }

    @Override
    public void onFailure(final Throwable reason) {
      print("Error loading MethodTests", reason);
    }
  });
}
项目:xapi    文件:SplitPointTest.java   
public void test(Runnable onDone) {
  SplitPointTest.onDone = onDone;
  // start with a regular gwt code split, which forces all our code into split points
  // this makes it more difficult for the auto-generated code splitting to make clean cuts
  InstanceInterface instance = X_Inject.instance(InstanceInterface.class);
  instance.test();
  com.google.gwt.core.client.GWT.runAsync(X_Inject.class, new RunAsyncCallback() {
    @Override
    public void onSuccess() {
      X_Inject.singletonAsync(LogService.class, StartTest.class);
      X_Inject.singletonAsync(ImportTestInterface.class, ImportTestReceiver.class);
      X_Inject.singletonAsync(ImportTestInterface.class, ImportTestCallback.class);
      X_Inject.singletonAsync(ServiceTestInterface.class, ServiceTestCallback.class);
    }

    @Override
    public void onFailure(Throwable reason) {
    }
  });
}
项目:arondor-common-reflection    文件:TestAsyncInstantiator.java   
public static void junitRunAsync(final RunAsyncCallback callback)
{
    new Thread()
    {
        @Override
        public void run()
        {
            if (RUN_ASYNC_DELAY > 0)
            {
                try
                {
                    Thread.sleep(RUN_ASYNC_DELAY);
                }
                catch (InterruptedException e)
                {
                    LOG.error("Could not wait", e);
                }
            }
            callback.onSuccess();
        }
    }.start();

}
项目:domino    文件:GwtAsyncRunner.java   
@Override
public void runAsync(AsyncTask asyncTask) {
    GWT.runAsync(new RunAsyncCallback() {
        @Override
        public void onFailure(Throwable reason) {
            asyncTask.onFailed(reason);
        }

        @Override
        public void onSuccess() {
            asyncTask.onSuccess();
        }
    });
}
项目:unitimes    文件:Client.java   
public void initComponentAsync(final RootPanel panel, final Components comp) {
    GWT.runAsync(new RunAsyncCallback() {
        public void onSuccess() {
            comp.insert(panel);
        }
        public void onFailure(Throwable reason) {
        }
    });
}
项目:unitimes    文件:CourseSelectionSuggestBox.java   
private void openDialogAsync() {
       GWT.runAsync(new RunAsyncCallback() {
        public void onSuccess() {
            openDialog();
        }
        public void onFailure(Throwable reason) {
            UniTimeNotifications.error(MESSAGES.failedToLoadTheApp(reason.getMessage()));
        }
       });
}
项目:unitimes    文件:CourseRequestBox.java   
private void openDialogAsync() {
       GWT.runAsync(new RunAsyncCallback() {
        public void onSuccess() {
            openDialog();
        }
        public void onFailure(Throwable reason) {
            UniTimeNotifications.error(MESSAGES.failedToLoadTheApp(reason.getMessage()));
        }
       });
}
项目:unitimes    文件:StudentSectioningWidget.java   
public void showSuggestionsAsync(final int rowIndex) {
    if (rowIndex < 0) return;
    GWT.runAsync(new RunAsyncCallback() {
        public void onSuccess() {
            openSuggestionsBox(rowIndex);
        }
        public void onFailure(Throwable caught) {
            iStatus.error(MESSAGES.exceptionSuggestionsFailed(caught.getMessage()), caught);
        }
    });
}
项目:unitime    文件:Client.java   
public void initComponentAsync(final RootPanel panel, final Components comp) {
    GWT.runAsync(new RunAsyncCallback() {
        public void onSuccess() {
            comp.insert(panel);
        }
        public void onFailure(Throwable reason) {
        }
    });
}
项目:unitime    文件:CourseSelectionSuggestBox.java   
private void openDialogAsync() {
       GWT.runAsync(new RunAsyncCallback() {
        public void onSuccess() {
            openDialog();
        }
        public void onFailure(Throwable reason) {
            UniTimeNotifications.error(MESSAGES.failedToLoadTheApp(reason.getMessage()));
        }
       });
}
项目:unitime    文件:CourseRequestBox.java   
private void openDialogAsync() {
       GWT.runAsync(new RunAsyncCallback() {
        public void onSuccess() {
            openDialog();
        }
        public void onFailure(Throwable reason) {
            UniTimeNotifications.error(MESSAGES.failedToLoadTheApp(reason.getMessage()));
        }
       });
}
项目:unitime    文件:StudentSectioningWidget.java   
public void showSuggestionsAsync(final int rowIndex) {
    if (rowIndex < 0) return;
    GWT.runAsync(new RunAsyncCallback() {
        public void onSuccess() {
            openSuggestionsBox(rowIndex);
        }
        public void onFailure(Throwable caught) {
            iStatus.error(MESSAGES.exceptionSuggestionsFailed(caught.getMessage()), caught);
        }
    });
}
项目:platypus-js    文件:Loader.java   
private static void loadFacade(final Callback<Void, String> aCallback) {
    final CumulativeCallbackAdapter<Void, String> facadeProcess = new CumulativeCallbackAdapter<Void, String>(2) {

        @Override
        protected void doWork(Void aResult) throws Exception {
            GWT.runAsync(new RunAsyncCallback() {

                @Override
                public void onSuccess() {
                    if (!asyncRan.contains(FACADE_HUB)) {
                        asyncRan.add(FACADE_HUB);
                        JsFacade.init();
                    }
                    aCallback.onSuccess(null);
                }

                @Override
                public void onFailure(Throwable reason) {
                    aCallback.onFailure(reason.toString());
                }
            });
        }

        @Override
        protected void failed(List<String> aReasons) {
            aCallback.onFailure(errorsToString(aReasons));
        }

    };
    loadForms(facadeProcess);
    loadHub(MODEL_HUB, facadeProcess);
}
项目:plugin-editor-codemirror    文件:CodeMirrorEditorExtension.java   
@Inject
public CodeMirrorEditorExtension(final EditorTypeRegistry editorTypeRegistry,
                                 final RequireJsLoader requireJsLoader,
                                 final NotificationManager notificationManager,
                                 final CodeMirrorEditorModule editorModule,
                                 final BaseCodemirrorPromise basePromise,
                                 final BaseCodemirrorInitializer baseInitializer,
                                 final CodeMirrorTextEditorFactory codeMirrorTextEditorFactory,
                                 final CompletionResources completionResources,
                                 final BasePathConstant basePathConstant) {
    this.notificationManager = notificationManager;
    this.requireJsLoader = requireJsLoader;
    this.editorModule = editorModule;
    this.editorTypeRegistry = editorTypeRegistry;
    this.codeMirrorTextEditorFactory = codeMirrorTextEditorFactory;
    this.codemirrorBase = basePathConstant.basePath();

    completionResources.completionCss().ensureInjected();

    Log.debug(CodeMirrorEditorExtension.class, "Codemirror extension module=" + editorModule);
    editorModule.setEditorInitializer(new EditorInitializer() {
        @Override
        public void initialize(final InitializerCallback callback) {
            // add code-splitting of the whole orion editor
            GWT.runAsync(new RunAsyncCallback() {
                @Override
                public void onSuccess() {
                    initBaseCodeMirror(basePromise, baseInitializer, callback);
                }
                @Override
                public void onFailure(final Throwable reason) {
                    callback.onFailure(reason);
                }
            });
        }
    });
    // must not delay
    registerEditor();
    CodeMirrorKeymaps.init();
}
项目:putnami-web-toolkit    文件:ProxyViewCreator.java   
private SourceWriter getSourceWriter(PrintWriter printWriter, GeneratorContext ctx) {
    ClassSourceFileComposerFactory composerFactory =
        new ClassSourceFileComposerFactory(this.packageName, this.viewProxySimpleName);

    composerFactory.setSuperclass(this.placeType.getSimpleSourceName());

    composerFactory.addImport(GWT.class.getName());
    composerFactory.addImport(RunAsyncCallback.class.getName());
    composerFactory.addImport(ViewProxy.class.getName());
    composerFactory.addImport(Place.class.getName());
    composerFactory.addImport(ViewPlace.class.getName());
    composerFactory.addImport(Activity.class.getName());
    composerFactory.addImport(ViewActivity.class.getName());
    composerFactory.addImport(ApplicationUnreachableException.class.getName());
    composerFactory.addImport(this.placeType.getQualifiedSourceName());
    composerFactory.addImport(this.activityDescrition.view().getCanonicalName());
    if (this.placeTokenizerClass != null) {
        composerFactory.addImport(this.placeTokenizerClass.getCanonicalName());
    }
    if (this.viewDecoratorClass != null) {
        composerFactory.addImport(this.viewDecoratorClass.getCanonicalName());
    }

    composerFactory.addImplementedInterface(
        ViewProxy.class.getSimpleName() + "<" + this.placeType.getSimpleSourceName() + ">");

    return composerFactory.createSourceWriter(ctx, printWriter);
}
项目:mythpodcaster    文件:MythPodcaster.java   
@Override
public void onModuleLoad() {
  RootPanel.get().clear();

  GWT.runAsync(new RunAsyncCallback() {
    public void onFailure(Throwable err) {
      Window.alert("code download failure");
    }

    public void onSuccess() {
      RootPanel.get("main").add(new MainWindow());
    }
  });
}
项目:emoji-gwt    文件:Emoji.java   
public Emoji setTheme (String themeName, final Ready ready) {
    if (instance == null && themeName == null) {
        themeName = "apple";
    }

    if (currentThemeName == null
            || (themeName != null && !currentThemeName.equals(themeName))) {
        currentThemeName = themeName;

        GWT.runAsync(new RunAsyncCallback() {

            @Override
            public void onSuccess () {
                instance = ThemeFactory.getTheme(currentThemeName);

                if (ready != null) {
                    ready.ready(Emoji.this);
                }
            }

            @Override
            public void onFailure (Throwable reason) {}
        });

    } else {
        if (ready != null) {
            ready.ready(this);
        }
    }

    return this;
}
项目:geomajas-project-client-gwt    文件:PanelSearchWidget.java   
private void removeHandler() {
    GWT.runAsync(new RunAsyncCallback() {

        public void onSuccess() {
            removeSaveRequestHandler(oneOffHandler);
        }

        public void onFailure(Throwable reason) {
        }
    });
}
项目:geomajas-project-client-gwt    文件:DockableWindow.java   
public void onMinimizeClick(MinimizeClickEvent event) {
    originalWidth = window.getWidth();
    originalLeft = window.getLeft();
    originalTop = window.getTop();
    originalDragRepo = window.getCanDragReposition();
    window.setCanDragReposition(false); // doens't work !?
    window.setAutoCenter(false);
    docked = true;

    GWT.runAsync(new RunAsyncCallback() {
        public void onSuccess() {
            window.animateRect(currentPosition, Document.get().getBody().getClientHeight() - minimizedHeight,
                    minimizedWidth, null, new AnimationCallback() {
                        public void execute(boolean earlyFinish) {
                            currentPosition += window.getWidth(); // not
                                                                // necessarily
                                                                // equal
                                                                // to
                                                                // minimizedWidth.
                        }
                    });
        }

        public void onFailure(Throwable reason) {
        }
    });
}
项目:geomajas-project-client-gwt    文件:DockableWindow.java   
public void onRestoreClick(RestoreClickEvent event) {
    if (docked) {
        currentPosition -= window.getWidth();
        docked = false;
        GWT.runAsync(new RunAsyncCallback() {
            public void onSuccess() {
                window.animateRect(originalLeft, originalTop, originalWidth, null);
                window.setCanDragReposition(originalDragRepo);
            }

            public void onFailure(Throwable reason) {
            }
        });
    }
}
项目:xapi    文件:GwtcProjectGeneratorDefault.java   
public void addClass(Class<?> clazz) {
    if (!finished.add(clazz.getName())) {
        return;
    }
    addGwtModules(clazz);
    if (EntryPoint.class.isAssignableFrom(clazz)) {
        try {
            addMethod(clazz.getMethod("onModuleLoad"));
        } catch (Exception e) {
            X_Log.error(GwtcProjectGenerator.class, "Could not extract onModuleLoad method from ", clazz, e);
        }
    } else if (GWTTestCase.class.isAssignableFrom(clazz)) {
        addGwtTestCase(clazz.asSubclass(GWTTestCase.class));
    } else if (GWTTestSuite.class.isAssignableFrom(clazz)) {
        addGwtTestSuite(clazz.asSubclass(GWTTestSuite.class));
    } else if (RunAsyncCallback.class.isAssignableFrom(clazz)) {
        addAsyncBlock(clazz.asSubclass(RunAsyncCallback.class));
    } else {
        // Check if this class has methods annotated w/ junit @Test
        for (Method m : clazz.getMethods()) {
            if (m.getAnnotation(Test.class) != null) {
                finished.remove(clazz.getName());
                addJUnitClass(clazz);
                return;
            }
        }
        try {
            addMethod(clazz.getMethod("main", String[].class));
        } catch (Exception ignored){
            X_Log.warn(getClass(), "Class",clazz," was added to Gwtc, "
                + "but that class was not a subclass of EntryPoint, RunAsync,"
                + " GWTTestCase, GWTTestSuite, nor did it have a main method, or"
                + " any JUnit 4 annotated @Test method.");
        }
    }
}
项目:Peergos    文件:CwFrame.java   
@Override
protected void asyncOnInitialize(final AsyncCallback<Widget> callback) {
  GWT.runAsync(CwFrame.class, new RunAsyncCallback() {

    public void onFailure(Throwable caught) {
      callback.onFailure(caught);
    }

    public void onSuccess() {
      callback.onSuccess(onInitialize());
    }
  });
}
项目:Peergos    文件:CwCookies.java   
@Override
protected void asyncOnInitialize(final AsyncCallback<Widget> callback) {
  GWT.runAsync(CwCookies.class, new RunAsyncCallback() {

    public void onFailure(Throwable caught) {
      callback.onFailure(caught);
    }

    public void onSuccess() {
      callback.onSuccess(onInitialize());
    }
  });
}
项目:Peergos    文件:CwAnimation.java   
@Override
protected void asyncOnInitialize(final AsyncCallback<Widget> callback) {
  GWT.runAsync(CwAnimation.class, new RunAsyncCallback() {

    public void onFailure(Throwable caught) {
      callback.onFailure(caught);
    }

    public void onSuccess() {
      callback.onSuccess(onInitialize());
    }
  });
}
项目:Peergos    文件:CwCustomDataGrid.java   
@Override
protected void asyncOnInitialize(final AsyncCallback<Widget> callback) {
  GWT.runAsync(CwCustomDataGrid.class, new RunAsyncCallback() {

    @Override
    public void onFailure(Throwable caught) {
      callback.onFailure(caught);
    }

    @Override
    public void onSuccess() {
      callback.onSuccess(onInitialize());
    }
  });
}
项目:Peergos    文件:CwCellList.java   
@Override
protected void asyncOnInitialize(final AsyncCallback<Widget> callback) {
  GWT.runAsync(CwCellList.class, new RunAsyncCallback() {

    public void onFailure(Throwable caught) {
      callback.onFailure(caught);
    }

    public void onSuccess() {
      callback.onSuccess(onInitialize());
    }
  });
}
项目:Peergos    文件:CwCellValidation.java   
@Override
protected void asyncOnInitialize(final AsyncCallback<Widget> callback) {
  GWT.runAsync(CwCellValidation.class, new RunAsyncCallback() {

    public void onFailure(Throwable caught) {
      callback.onFailure(caught);
    }

    public void onSuccess() {
      callback.onSuccess(onInitialize());
    }
  });
}
项目:Peergos    文件:CwCellBrowser.java   
@Override
protected void asyncOnInitialize(final AsyncCallback<Widget> callback) {
  GWT.runAsync(CwCellBrowser.class, new RunAsyncCallback() {

    public void onFailure(Throwable caught) {
      callback.onFailure(caught);
    }

    public void onSuccess() {
      callback.onSuccess(onInitialize());
    }
  });
}
项目:swarm    文件:CwFlexTable.java   
@Override
protected void asyncOnInitialize(final AsyncCallback<Widget> callback) {
  GWT.runAsync(CwFlexTable.class, new RunAsyncCallback() {

    public void onFailure(Throwable caught) {
      callback.onFailure(caught);
    }

    public void onSuccess() {
      callback.onSuccess(onInitialize());
    }
  });
}
项目:swarm    文件:CwBidiFormatting.java   
@Override
protected void asyncOnInitialize(final AsyncCallback<Widget> callback) {
  GWT.runAsync(CwBidiFormatting.class, new RunAsyncCallback() {

    public void onFailure(Throwable caught) {
      callback.onFailure(caught);
    }

    public void onSuccess() {
      callback.onSuccess(onInitialize());
    }
  });
}