|
GWTP Dispatch client 0.6-redhat-2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.gwtplatform.dispatch.client.actionhandler.AbstractClientActionHandler<A,R>
com.gwtplatform.dispatch.client.actionhandler.caching.AbstractCachingClientActionHandler<A,R>
A
- The type of the action extending Action
.R
- The type of the result extending Result
.public abstract class AbstractCachingClientActionHandler<A extends Action<R>,R extends Result>
Abstract base class for client-side action handlers with caching support.
Supported features include:
1. prefetch(A)
/postfetch(A, R)
perform the cache lookup and the
cache store. You can use this to customize the caching logic.
2. Automatic action queuing so that calls in quick succession result in a single trip to the server.
3. Flexibility of cache implementation to support custom caching
Constructor Summary | |
---|---|
AbstractCachingClientActionHandler(Class<A> actionType,
Cache cache)
|
Method Summary | |
---|---|
DispatchRequest |
execute(A action,
com.google.gwt.user.client.rpc.AsyncCallback<R> resultCallback,
ExecuteCommand<A,R> executeCommand)
Handles the specified action. |
protected Cache |
getCache()
|
protected abstract void |
postfetch(A action,
R result)
Override this method to perform an action after the call to the server returns successfully or not. |
protected abstract R |
prefetch(A action)
Override this method to perform an action before the call is sent to the server. |
DispatchRequest |
undo(A action,
R result,
com.google.gwt.user.client.rpc.AsyncCallback<Void> callback,
UndoCommand<A,R> undoCommand)
Undoes the specified action. |
Methods inherited from class com.gwtplatform.dispatch.client.actionhandler.AbstractClientActionHandler |
---|
getActionType |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractCachingClientActionHandler(Class<A> actionType, Cache cache)
Method Detail |
---|
public DispatchRequest execute(A action, com.google.gwt.user.client.rpc.AsyncCallback<R> resultCallback, ExecuteCommand<A,R> executeCommand)
ClientActionHandler
DelegatingDispatchRequest#isCancelled()
against the request
parameter.
action
- The Action
to execute.resultCallback
- The callback to use to communicate the result of the
action. Unless the request is cancelled, you must invoke
AsyncCallback.onSuccess(T)
on this callback once you have
obtained the result. If any failure occurs call
AsyncCallback.onFailure(java.lang.Throwable)
.executeCommand
- Call ExecuteCommand.execute(Action, com.google.gwt.user.client.rpc.AsyncCallback)
on this object to send the action over to the server via gwt-rpc.
As a parameter you can pass resultCallback
or your custom
AsyncCallback
if you want to process the result.
DispatchRequest
object. Never return null
,
instead return a new CompletedDispatchRequest
if you executed, cancelled or ignored the action.public DispatchRequest undo(A action, R result, com.google.gwt.user.client.rpc.AsyncCallback<Void> callback, UndoCommand<A,R> undoCommand)
ClientActionHandler
DelegatingDispatchRequest#isCancelled()
against the request
parameter.
action
- The Action
to undo.result
- The Result
to undo.callback
- The callback to use to indicate when the action has been
undone. Unless the request is cancelled, you must invoke
AsyncCallback.onSuccess(T)
on this callback when you have
successfully undone the action. If any failure occurs call
AsyncCallback.onFailure(java.lang.Throwable)
.undoCommand
- Call UndoCommand.undo(Action, Result, com.google.gwt.user.client.rpc.AsyncCallback)
on
this object to send the action over to the server via gwt-rpc. As
a parameter you can pass callback
or your custom
AsyncCallback
if you want to perform any processing
following the undo.
DispatchRequest
object. Never return null
,
instead return a new CompletedDispatchRequest
if you executed, cancelled or ignored the action.protected abstract R prefetch(A action)
null
result then the action is
never executed on the server and the returned value is used. If the call
returns null
then the action is executed on the server.
You can use this method to fetch the action
from the cache.
action
- The action to be prefetched
null
.protected abstract void postfetch(A action, R result)
null
will be passed in the result
parameter.
You can use this method to add the result to cache, if it is null
you should remove the action
from the cache.
action
- The action that just finished execution on the server.result
- The result after the server call, or null
if the
server call failed.protected Cache getCache()
|
GWTP Dispatch client 0.6-redhat-2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |