本文整理匯總了Java中com.google.gwt.core.client.Callback.onFailure方法的典型用法代碼示例。如果您正苦於以下問題:Java Callback.onFailure方法的具體用法?Java Callback.onFailure怎麽用?Java Callback.onFailure使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.gwt.core.client.Callback
的用法示例。
在下文中一共展示了Callback.onFailure方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: doLogin
import com.google.gwt.core.client.Callback; //導入方法依賴的package包/類
/**
* Get the OAuth 2.0 token for which this application may not have already
* been granted access, by displaying a popup to the user.
*/
@Override
void doLogin(String authUrl, Callback<String, Throwable> callback) {
if (window != null && window.isOpen()) {
callback.onFailure(new IllegalStateException("Authentication in progress"));
} else {
window = openWindow(authUrl, height, width);
if (window == null) {
callback.onFailure(new RuntimeException(
"The authentication popup window appears to have been blocked"));
}
}
}
示例2: 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);
}
};
}