當前位置: 首頁>>代碼示例>>Java>>正文


Java Callback.onSuccess方法代碼示例

本文整理匯總了Java中com.google.gwt.core.client.Callback.onSuccess方法的典型用法代碼示例。如果您正苦於以下問題:Java Callback.onSuccess方法的具體用法?Java Callback.onSuccess怎麽用?Java Callback.onSuccess使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.gwt.core.client.Callback的用法示例。


在下文中一共展示了Callback.onSuccess方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: promise

import com.google.gwt.core.client.Callback; //導入方法依賴的package包/類
@Override
public Promise<Void> promise(final ActionEvent event) {
  if (event.getParameters() == null
      || event.getParameters().get(SHOW_HIDDEN_FILES_PARAM_ID) == null) {
    return Promises.reject(
        JsPromiseError.create(
            "Mandatory parameter" + SHOW_HIDDEN_FILES_PARAM_ID + " is not specified"));
  }

  final String showHiddenFilesKey = event.getParameters().get(SHOW_HIDDEN_FILES_PARAM_ID);
  final boolean isShowHiddenFiles = Boolean.valueOf(showHiddenFilesKey);

  final CallbackPromiseHelper.Call<Void, Throwable> call =
      new CallbackPromiseHelper.Call<Void, Throwable>() {

        @Override
        public void makeCall(final Callback<Void, Throwable> callback) {
          projectExplorerPresenter.showHiddenFiles(isShowHiddenFiles);

          callback.onSuccess(null);
        }
      };

  return createFromCallback(call);
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:26,代碼來源:ShowHiddenFilesAction.java

示例2: basicFetch

import com.google.gwt.core.client.Callback; //導入方法依賴的package包/類
private void basicFetch(Criteria criteria, final Callback<ResultSet, Void> callback) {
        final ResultSet resultSet = new ResultSet(this);
        resultSet.setCriteria(criteria);
        resultSet.setFetchMode(FetchMode.BASIC);
//        resultSet.setCriteriaPolicy(CriteriaPolicy.DROPONCHANGE);
        // server resource returns full result in case of SearchType.PIDS query
        if (resultSet.lengthIsKnown()) {
            callback.onSuccess(resultSet);
        } else {
            final HandlerRegistration[] handler = new HandlerRegistration[1];
            handler[0] = resultSet.addDataArrivedHandler(new DataArrivedHandler() {

                @Override
                public void onDataArrived(DataArrivedEvent event) {
                    handler[0].removeHandler();
                    callback.onSuccess(resultSet);
                }
            });
            resultSet.get(0);
        }
    }
 
開發者ID:proarc,項目名稱:proarc,代碼行數:22,代碼來源:SearchDataSource.java

示例3: getModels

import com.google.gwt.core.client.Callback; //導入方法依賴的package包/類
public static void getModels(boolean reload, final Callback<ResultSet, Void> callback) {
    final ResultSet models = getModels(reload);
    if (models.lengthIsKnown()) {
        callback.onSuccess(models);
    } else {
        final HandlerRegistration[] handler = new HandlerRegistration[1];
        handler[0] = models.addDataArrivedHandler(new DataArrivedHandler() {

            @Override
            public void onDataArrived(DataArrivedEvent event) {
                handler[0].removeHandler();
                callback.onSuccess(models);
            }
        });
    }
}
 
開發者ID:proarc,項目名稱:proarc,代碼行數:17,代碼來源:MetaModelDataSource.java

示例4: load

import com.google.gwt.core.client.Callback; //導入方法依賴的package包/類
/**
 * Load the specified script.
 *
 * @param script Path to script.
 * @param callback {@code Callback} called when ready.
 */
public static void load(
        String script, Callback<Void, Exception> callback) {

    if (loadedScripts.contains(script)) {
        callback.onSuccess(null);
        return;
    }

    ScriptInjector.fromUrl(script)
        .setWindow(ScriptInjector.TOP_WINDOW)
        .setCallback(callback)
        .inject();

    loadedScripts.add(script);
}
 
開發者ID:snogaraleal,項目名稱:wbi,代碼行數:22,代碼來源:Script.java

示例5: testVersionSelected_cached

import com.google.gwt.core.client.Callback; //導入方法依賴的package包/類
/**
 * Test that we don't call our dependency when we should have a cached version.
 */
public void testVersionSelected_cached() {
  RestApiService service = EasyMock.createControl().createMock(RestApiService.class);

  // Populate the cache with the service we'll request later.
  loader.cache.put(ServiceLoader.generateCacheKey("service", "version", CallStyle.REST), service);

  @SuppressWarnings("unchecked")
  Callback<ApiService, String> mockCallback = EasyMock.createMock(Callback.class);
  mockCallback.onSuccess(service);
  EasyMock.expectLastCall();
  EasyMock.replay(mockCallback);

  loader.loadService("service", "version", mockCallback);

  EasyMock.verify(mockCallback);
  assertEquals(0, googleApi.invocations);
}
 
開發者ID:showlowtech,項目名稱:google-apis-explorer,代碼行數:21,代碼來源:ServiceLoaderTest.java

示例6: load

import com.google.gwt.core.client.Callback; //導入方法依賴的package包/類
@Override
public void load(final PagingLoadConfig config,
		final Callback<PagingLoadResult<M>, Throwable> callback) {
	final ArrayList<M> temp = new ArrayList<M>();

	for (M model : data) {
		temp.add(model);
	}

	final ArrayList<M> sublist = new ArrayList<M>();
	int start = config.getOffset();
	int limit = temp.size();
	if (config.getLimit() > 0) {
		limit = Math.min(start + config.getLimit(), limit);
	}
	for (int i = config.getOffset(); i < limit; i++) {
		sublist.add(temp.get(i));
	}

	Timer t = new Timer() {

		@Override
		public void run() {
			callback.onSuccess(new PagingLoadResultBean<M>(sublist, temp
					.size(), config.getOffset()));
		}
	};
	t.schedule(delay);

}
 
開發者ID:geowe,項目名稱:sig-seguimiento-vehiculos,代碼行數:31,代碼來源:ObjectPagingProxy.java

示例7: getScriptInjectionCallback

import com.google.gwt.core.client.Callback; //導入方法依賴的package包/類
private static Callback<Void, Exception> getScriptInjectionCallback(
    Callback<Void, Throwable> promiseCallback) {

  return new Callback<Void, Exception>() {
    @Override
    public void onSuccess(Void result) {
      promiseCallback.onSuccess(result);
    }

    @Override
    public void onFailure(Exception reason) {
      promiseCallback.onFailure(reason);
    }
  };
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:16,代碼來源:DevModeScriptInjector.java

示例8: testVersionSelected

import com.google.gwt.core.client.Callback; //導入方法依賴的package包/類
/**
 * Test that the callback gets invoked properly when a service is requested.
 */
public void testVersionSelected() {
  googleApi.service = EasyMock.createControl().createMock(RestApiService.class);

  @SuppressWarnings("unchecked")
  Callback<ApiService, String> mockCallback = EasyMock.createMock(Callback.class);
  mockCallback.onSuccess(googleApi.service);
  EasyMock.replay(mockCallback);

  loader.loadService("service", "version", mockCallback);

  EasyMock.verify(mockCallback);
  assertEquals(1, googleApi.invocations);
}
 
開發者ID:showlowtech,項目名稱:google-apis-explorer,代碼行數:17,代碼來源:ServiceLoaderTest.java

示例9: loadServiceDefinitions

import com.google.gwt.core.client.Callback; //導入方法依賴的package包/類
/**
 * Load the directory document from either cache or the wire and notify the specified callback
 * when done.
 */
public void loadServiceDefinitions(final Callback<Set<ServiceDefinition>, String> callback) {
  if (directoryCache == null) {
    googleApi.loadApiDirectory(new AsyncCallback<Set<ServiceDefinition>>() {
      @Override
      public void onSuccess(Set<ServiceDefinition> unfiltered) {
        // Filter the list of services according to the blacklist.
        directoryCache = Sets.filter(unfiltered, new Predicate<ServiceDefinition>() {
          @Override
          public boolean apply(ServiceDefinition service) {
            return !SERVICE_NAME_BLACKLIST.contains(service.getName())
                && !SERVICE_ID_BLACKLIST.contains(service.getId());
          }
        });

        callback.onSuccess(directoryCache);
        delegate.directoryLoaded(directoryCache);
      }

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

    });
  } else {
    callback.onSuccess(directoryCache);
  }
}
 
開發者ID:showlowtech,項目名稱:google-apis-explorer,代碼行數:33,代碼來源:ServiceLoader.java


注:本文中的com.google.gwt.core.client.Callback.onSuccess方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。