本文整理汇总了Java中io.reinert.gdeferred.DoneCallback类的典型用法代码示例。如果您正苦于以下问题:Java DoneCallback类的具体用法?Java DoneCallback怎么用?Java DoneCallback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DoneCallback类属于io.reinert.gdeferred包,在下文中一共展示了DoneCallback类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onGoogleButtonClick
import io.reinert.gdeferred.DoneCallback; //导入依赖的package包/类
@Override
public void onGoogleButtonClick() {
final String profilePictureEndpoint = "https://www.googleapis.com/plus/v1/people/me";
final String authUrl = "https://accounts.google.com/o/oauth2/auth";
final String appClientId = "60734886159-99bmoevf41sott6sa2cijltc85orhc18.apps.googleusercontent.com";
final String scope = "https://www.googleapis.com/auth/plus.login";
requestor.req(profilePictureEndpoint)
.auth(new OAuth2ByHeader(authUrl, appClientId, scope))
.get(JavaScriptObject.class)
.done(new DoneCallback<JavaScriptObject>() {
@Override
public void onDone(JavaScriptObject result) {
final JavaScriptObject image = Overlays.getObject(result, "image");
final String imageUrl = Overlays.getString(image, "url");
view.addImage(imageUrl);
}
});
}
示例2: onFacebookButtonClick
import io.reinert.gdeferred.DoneCallback; //导入依赖的package包/类
@Override
public void onFacebookButtonClick() {
final String profilePictureEndpoint = "https://graph.facebook.com/v2.3/me/picture?redirect=false";
final String authUrl = "https://www.facebook.com/dialog/oauth";
final String appClientId = "366496696889929";
final String scope = "public_profile";
requestor.req(profilePictureEndpoint)
.auth(new OAuth2ByQueryParam(authUrl, appClientId, scope))
.get(JavaScriptObject.class)
.done(new DoneCallback<JavaScriptObject>() {
@Override
public void onDone(JavaScriptObject result) {
final JavaScriptObject data = Overlays.getObject(result, "data");
final String imageUrl = Overlays.getString(data, "url");
view.addImage(imageUrl);
}
});
}
示例3: onWindowsButtonClick
import io.reinert.gdeferred.DoneCallback; //导入依赖的package包/类
@Override
public void onWindowsButtonClick() {
final String profilePictureEndpoint = "https://apis.live.net/v5.0/me";
final String authUrl = "https://login.live.com/oauth20_authorize.srf";
final String appClientId = "000000004015498F";
final String scope = "wl.basic";
requestor.req(profilePictureEndpoint)
.auth(new OAuth2ByQueryParam(authUrl, appClientId, scope))
.get(JavaScriptObject.class)
.done(new DoneCallback<JavaScriptObject>() {
@Override
public void onDone(JavaScriptObject result) {
final String userId = Overlays.getObject(result, "id");
final String imageUrl = "https://apis.live.net/v5.0/" + userId + "/picture";
view.addImage(imageUrl);
}
});
}
示例4: then
import io.reinert.gdeferred.DoneCallback; //导入依赖的package包/类
@Override
public Promise<D, F, P> then(DoneCallback<D> doneCallback, FailCallback<F> failCallback,
ProgressCallback<P> progressCallback) {
done(doneCallback);
fail(failCallback);
progress(progressCallback);
return this;
}
示例5: triggerDone
import io.reinert.gdeferred.DoneCallback; //导入依赖的package包/类
protected void triggerDone(D resolved) {
for (DoneCallback<D> callback : doneCallbacks) {
try {
triggerDone(callback, resolved);
} catch (Exception e) {
log.log(Level.SEVERE, "An uncaught exception occurred in a DoneCallback", e);
}
}
}
示例6: onXmlObjectGet
import io.reinert.gdeferred.DoneCallback; //导入依赖的package包/类
@Override
public void onXmlObjectGet() {
requestor.req("http://www.mocky.io/v2/54aa8cf807b5f2bc0f21ba08")
.get(MyObject.class)
.done(new DoneCallback<MyObject>() {
@Override
public void onDone(MyObject result) {
view.setSingleXmlGetText(result.toString());
}
});
}
示例7: onXmlObjectPost
import io.reinert.gdeferred.DoneCallback; //导入依赖的package包/类
@Override
public void onXmlObjectPost() {
requestor.req("http://httpbin.org/post")
.contentType("application/xml")
.payload(new MyObject("Lorem", 1900, new Date(1420416000000L)))
.post(String.class)
.done(new DoneCallback<String>() {
@Override
public void onDone(String result) {
view.setSingleXmlPostText(result);
}
});
}
示例8: onXmlCollectionPost
import io.reinert.gdeferred.DoneCallback; //导入依赖的package包/类
@Override
public void onXmlCollectionPost() {
requestor.req("http://httpbin.org/post")
.contentType("application/xml")
.payload(Arrays.asList(
new MyObject("Lorem", 1900, new Date(1420416000000L)),
new MyObject("Ipsum", 210, new Date(1420070400000L))))
.post(String.class)
.done(new DoneCallback<String>() {
@Override
public void onDone(String result) {
view.setCollectionXmlPostText(result);
}
});
}
示例9: onJsonObjectGet
import io.reinert.gdeferred.DoneCallback; //导入依赖的package包/类
@Override
public void onJsonObjectGet() {
requestor.req("http://www.mocky.io/v2/54aa93c307b5f2671021ba0c")
.get(MyObject.class)
.done(new DoneCallback<MyObject>() {
@Override
public void onDone(MyObject result) {
view.setSingleJsonGetText(result.toString());
}
});
}
示例10: onJsonObjectPost
import io.reinert.gdeferred.DoneCallback; //导入依赖的package包/类
@Override
public void onJsonObjectPost() {
requestor.req("http://httpbin.org/post")
.contentType("application/json")
.payload(new MyObject("Lorem", 1900, new Date(1420416000000L)))
.post(String.class)
.done(new DoneCallback<String>() {
@Override
public void onDone(String result) {
view.setSingleJsonPostText(result);
}
});
}
示例11: onJsonCollectionPost
import io.reinert.gdeferred.DoneCallback; //导入依赖的package包/类
@Override
public void onJsonCollectionPost() {
requestor.req("http://httpbin.org/post")
.contentType("application/json")
.payload(Arrays.asList(
new MyObject("Lorem", 1900, new Date(1420416000000L)),
new MyObject("Ipsum", 210, new Date(1420070400000L))))
.post(String.class)
.done(new DoneCallback<String>() {
@Override
public void onDone(String result) {
view.setCollectionJsonPostText(result);
}
});
}
示例12: onCustomButtonClick
import io.reinert.gdeferred.DoneCallback; //导入依赖的package包/类
@Override
public void onCustomButtonClick(String key) {
requestor.req("http://httpbin.org/headers")
.auth(new MyAuth(key))
.get(String.class)
.done(new DoneCallback<String>() {
@Override
public void onDone(String result) {
view.setCustomText(result);
}
});
}
示例13: done
import io.reinert.gdeferred.DoneCallback; //导入依赖的package包/类
@Override
public Promise<D, F, P> done(DoneCallback<D> callback) {
doneCallbacks.add(callback);
if (isResolved()) triggerDone(callback, resolveResult);
return this;
}
示例14: getDoneCallbacks
import io.reinert.gdeferred.DoneCallback; //导入依赖的package包/类
protected List<DoneCallback<D>> getDoneCallbacks() {
return doneCallbacks;
}