Last active
March 16, 2017 15:23
-
-
Save kevzlou7979/9fd2b67eb7e7a6d7ca9aeeaf66c256b8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Will setup the LoadResultCallback where the async widget has predefined UX upon loading the request | |
// and display the callback result returned by the server | |
LoadResultCallback<Car, MaterialButton> loadResultCallback = new LoadResultCallback<>(asyncButton); | |
// Let the user decide how they perform client to server mechanism (e.g RPC). | |
final CarServiceAsync carServiceAsync = GWT.create(FakeCarService.class); | |
carServiceAsync.getCar(1, new AsyncCallback<Car>() { | |
@Override | |
public void onFailure(Throwable throwable) { | |
loadResultCallback.onFailure(throwable); | |
} | |
@Override | |
public void onSuccess(Car car) { | |
loadResultCallback.onSuccess(car); | |
} | |
}); | |
// Will perform the async load() method and call the asynccallback | |
loadResultCallback.load(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment