T
- The type of the return value. See AsyncCallback
.public abstract class NotifyingAsyncCallback<T> extends Object implements AsyncCallback<T>
AsyncCallback
that sends events on the EventBus
whenever
an async call starts, succeeds, or fails. The events fired are AsyncCallStartEvent
,
AsyncCallSucceedEvent
, AsyncCallFailEvent
.
So the way to use NotifyingAsyncCallback
is the following:
NotifyingAsyncCallback callback = new NotifyingAsyncCallback(eventBus) { ... }; callback.prepare(); someRpcMethod(callback); callback.checkLoading();
Modifier and Type | Class and Description |
---|---|
static class |
NotifyingAsyncCallback.State
This enum indicates the state of the notifying async callback.
|
Constructor and Description |
---|
NotifyingAsyncCallback(EventBus eventBus) |
Modifier and Type | Method and Description |
---|---|
void |
checkLoading()
This method is used to indicate that the async callback is currently loading.
|
protected void |
failure(Throwable caught)
This method is called whenever the asynchronous call returns with a failure.
|
void |
onFailure(Throwable caught) |
void |
onSuccess(T result) |
void |
prepare()
This method is used to place that the async callback in its
INITIALIZED stated. |
protected abstract void |
success(T result)
This method is called whenever the asynchronous call returns successfully.
|
public NotifyingAsyncCallback(EventBus eventBus)
public final void onFailure(Throwable caught)
onFailure
in interface AsyncCallback<T>
public final void onSuccess(T result)
onSuccess
in interface AsyncCallback<T>
public void prepare()
INITIALIZED
stated. It
should be call prior to invoking any RPC that takes this callback as a parameter. See
NotifyingAsyncCallback
for usage.public void checkLoading()
NotifyingAsyncCallback
for usage.protected abstract void success(T result)
result
- the return value of the remote produced call.protected void failure(Throwable caught)
caught
- failure encountered while executing a remote procedure call.Copyright © 2010–2014 Arcbees. All rights reserved.