com.google.gwt.core.client.GWT.runAsync()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.5k)|赞(0)|评价(0)|浏览(131)

本文整理了Java中com.google.gwt.core.client.GWT.runAsync()方法的一些代码示例,展示了GWT.runAsync()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GWT.runAsync()方法的具体详情如下:
包路径:com.google.gwt.core.client.GWT
类名称:GWT
方法名:runAsync

GWT.runAsync介绍

[英]Run the specified callback once the necessary code for it has been loaded.
[中]加载所需的代码后,运行指定的回调。

代码示例

代码示例来源:origin: org.geomajas.widget/geomajas-widget-searchandfilter-gwt

private void removeHandler() {
    GWT.runAsync(new RunAsyncCallback() {
      public void onSuccess() {
        removeSaveRequestHandler(oneOffHandler);
      }
      public void onFailure(Throwable reason) {
      }
    });
  }
}

代码示例来源:origin: errai/errai

@Override
public void execute(final Runnable task) {
 GWT.runAsync(new RunAsyncCallback() {
  @Override
  public void onFailure(final Throwable reason) {
   GWT.log("failed async execution", reason);
  }
  @Override
  public void onSuccess() {
   task.run();
  }
 });
}

代码示例来源:origin: org.jboss.errai/errai-common

@Override
public void execute(final Runnable task) {
 GWT.runAsync(new RunAsyncCallback() {
  @Override
  public void onFailure(final Throwable reason) {
   GWT.log("failed async execution", reason);
  }
  @Override
  public void onSuccess() {
   task.run();
  }
 });
}

代码示例来源:origin: bedatadriven/activityinfo

@Override
public void load(final PageId pageId, final PageState pageState, final AsyncCallback<Page> callback) {
  GWT.runAsync(new RunAsyncCallback() {
    @Override
    public void onSuccess() {
      DataEntryPage dataEntryPage = dataEntryPageProvider.get();
      dataEntryPage.navigate(pageState);
      callback.onSuccess(dataEntryPage);
    }
    @Override
    public void onFailure(Throwable throwable) {
      callback.onFailure(throwable);
    }
  });
}

代码示例来源:origin: org.dominokit.domino.impl/domino-gwt

@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();
      }
    });
  }
}

代码示例来源:origin: com.progressoft.brix.domino.impl/domino-gwt

@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();
      }
    });
  }
}

代码示例来源:origin: org.jboss.errai/errai-common

/**
 * Deliver/dispatch the new bean instance asynchronously.
 * @param bean
 * @param callback
 */
public static final void createBean(final Object bean, @SuppressWarnings("rawtypes") final CreationalCallback callback) {
 GWT.runAsync(new RunAsyncCallback() {
  @SuppressWarnings("unchecked")
  public void onSuccess() {
   callback.callback(bean);
  }
  public void onFailure(Throwable caught) {
   // can't really fail
  }
 });
}

代码示例来源:origin: errai/errai

/**
 * Deliver/dispatch the new bean instance asynchronously.
 * @param bean
 * @param callback
 */
public static final void createBean(final Object bean, @SuppressWarnings("rawtypes") final CreationalCallback callback) {
 GWT.runAsync(new RunAsyncCallback() {
  @SuppressWarnings("unchecked")
  public void onSuccess() {
   callback.callback(bean);
  }
  public void onFailure(Throwable caught) {
   // can't really fail
  }
 });
}

代码示例来源:origin: org.eagle-i/eagle-i-search-gwt

/**
 * Access the module's instance. The callback
 * runs asynchronously, once the necessary
 * code has downloaded.
 */
public static void createAsync(final ModuleClient client) {
  GWT.runAsync( new RunAsyncCallback() {
    @Override
    public void onFailure(final Throwable err) {
      client.onUnavailable();
    }
    @Override
    public void onSuccess() {
      if ( instance == null ) {
        instance = new InstancePageWrapper();
      }
      client.onSuccess( instance );
    }
  } );
}

代码示例来源:origin: org.eagle-i/eagle-i-search-gwt

/**
 * Access the module's instance. The callback
 * runs asynchronously, once the necessary
 * code has downloaded.
 */
public static void createAsync(final ModuleClient client) {
  GWT.runAsync( new RunAsyncCallback() {
    @Override
    public void onFailure(final Throwable err) {
      client.onUnavailable();
    }
    @Override
    public void onSuccess() {
      if ( instance == null ) {
        instance = new ResultsPageWrapper();
      }
      client.onSuccess( instance );
    }
  } );
}

代码示例来源:origin: bedatadriven/activityinfo

@Override
  public void load(final PageId pageId, final PageState pageState, final AsyncCallback<Page> callback) {

    GWT.runAsync(new RunAsyncCallback() {
      @Override
      public void onFailure(Throwable reason) {
        callback.onFailure(reason);
      }

      @Override
      public void onSuccess() {
        if (ReportsPage.PAGE_ID.equals(pageId)) {
          callback.onSuccess(reportsPage.get());

        } else if (ReportDesignPage.PAGE_ID.equals(pageId)) {
          ReportDesignPage page = reportDesignPage.get();
          page.navigate(pageState);
          callback.onSuccess(page);

        } else {
          GWT.log("ReportLoader received a request it didn't know how to handle: " + pageState.toString(),
              null);
        }
      }
    });
  }
}

代码示例来源:origin: bedatadriven/activityinfo

@Override
public void load(final PageId pageId, final PageState place, final AsyncCallback<Page> callback) {
  GWT.runAsync(new RunAsyncCallback() {
    @Override
    public void onFailure(Throwable caught) {

代码示例来源:origin: org.geomajas.widget/geomajas-widget-featureinfo-gwt

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) {
        }
      });
    }
  }
}

代码示例来源:origin: bedatadriven/activityinfo

@Override
  public void load(final PageId pageId, final PageState pageState, final AsyncCallback<Page> callback) {

    BaseStylesheet.INSTANCE.ensureInjected();

    GWT.runAsync(new RunAsyncCallback() {
      @Override
      public void onSuccess() {
        if (pageState instanceof ResourcePlace) {
          ResourcePlace resourcePlace = (ResourcePlace) pageState;
          ResourcePage page = new ResourcePage(eventBus, resourceLocator, resourcePlace.getPageId(), stateProvider);
          page.navigate(pageState);
          callback.onSuccess(page);
        }
      }

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

代码示例来源:origin: bedatadriven/activityinfo

private void loadSynchronizerImpl(final AsyncCallback<Synchronizer> callback) {
  Log.trace("loadSynchronizerImpl() starting...");
  GWT.runAsync(new RunAsyncCallback() {
    @Override
    public void onFailure(Throwable throwable) {
      Log.trace("loadSynchronizerImpl() failed");
      callback.onFailure(throwable);
    }
    @Override
    public void onSuccess() {
      Log.trace("loadSynchronizerImpl() succeeded");
      Synchronizer impl = null;
      try {
        impl = synchronizerProvider.get();
      } catch (Exception caught) {
        Log.error("SynchronizationImpl constructor threw exception", caught);
        callback.onFailure(caught);
        return;
      }
      callback.onSuccess(impl);
    }
  });
}

代码示例来源:origin: net.wetheinter/gwt-reflect

com.google.gwt.core.client.GWT.runAsync(ConstPool.class, new RunAsyncCallback() {

代码示例来源:origin: com.vaadin.addon/vaadin-touchkit-agpl

/**
 * Loads TouchKit theme. Called automatically by entrypoint.
 */
public void load() {
  VTouchKitResources.INSTANCE.css().ensureInjected();
  
  if(ApplicationConfiguration.isDebugMode()) {
    GWT.runAsync(new RunAsyncCallback() {
      @Override
      public void onSuccess() {
        DebugWindowStyles dws = GWT
            .create(DebugWindowStyles.class);
        dws.css().ensureInjected();
      }
      
      @Override
      public void onFailure(Throwable reason) {
      }
    });
  }
}

代码示例来源:origin: net.wetheinter/gwt-user

if (GWT.isClient()) {
 com.google.gwt.core.client.GWT.runAsync(ConstPool.class,
  new RunAsyncCallback() {

代码示例来源:origin: org.geomajas.widget/geomajas-widget-featureinfo-gwt

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) {
    }
  });
}

代码示例来源:origin: org.geomajas.widget/geomajas-widget-advancedviews-gwt

protected void renderViewConfig(ViewConfig viewConfig) {
  themeChange = true;
  RangeConfig config = getRangeConfigForCurrentScale(viewConfig, mapWidget.getMapModel().getMapView()
      .getCurrentScale());
  if (themeInfo.isHideOtherlayers()) {
    for (Layer<?> layer : mapWidget.getMapModel().getLayers()) {
      layer.setVisible(false);
    }
  }
  for (LayerConfig layerConfig : config.getLayerConfigs()) {
    Layer<?> layer = mapWidget.getMapModel().getLayer(layerConfig.getLayer().getId());
    if (layer != null) {
      layer.setVisible(layerConfig.isVisible());
      if (layer instanceof RasterLayer) {
        ((RasterLayer) layer).setOpacity(layerConfig.getOpacity());
      }
    } else {
      GWT.log("ThemeWidget: could not find layer: " + layerConfig.getLayer().getId());
    }
  }
  // LayerShownEvents are run async, we need to deactivate after these.
  GWT.runAsync(new RunAsyncCallback() {
    public void onSuccess() {
      themeChange = false;
    }
    public void onFailure(Throwable reason) {
      }
  });
}

相关文章