Package org.opencms.gwt.client.rpc
Class CmsRpcAction<T>
java.lang.Object
org.opencms.gwt.client.rpc.CmsRpcAction<T>
- Type Parameters:
T
- The type of the expected return value
- All Implemented Interfaces:
com.google.gwt.user.client.rpc.AsyncCallback<T>
public abstract class CmsRpcAction<T>
extends Object
implements com.google.gwt.user.client.rpc.AsyncCallback<T>
Consistently manages RPCs errors and 'loading' state.
- Since:
- 8.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The sync token value, used to allow synchronous RPC calls within vaadin, see also com.google.gwt.http.client.RequestBuilder within the super source -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract void
execute()
Executes the current RPC call.Executes a synchronized request.void
Handle errors.protected abstract void
onResponse
(T result) Handles the result when received from server.void
void
setLoadingMessage
(String loadingMessage) Sets the loading message.protected void
show
(boolean blocking) Shows the 'loading message'.void
start
(int delay, boolean blocking) Starts the timer for showing the 'loading' state.void
stop
(boolean displayDone) Stops the timer.
-
Field Details
-
SYNC_TOKEN
The sync token value, used to allow synchronous RPC calls within vaadin, see also com.google.gwt.http.client.RequestBuilder within the super source- See Also:
-
-
Constructor Details
-
CmsRpcAction
public CmsRpcAction()
-
-
Method Details
-
execute
Executes the current RPC call.Initializes client-server communication and will
-
executeSync
Executes a synchronized request.- Returns:
- the RPC result
- See Also:
-
onFailure
Handle errors.- Specified by:
onFailure
in interfacecom.google.gwt.user.client.rpc.AsyncCallback<T>
- See Also:
-
AsyncCallback.onFailure(java.lang.Throwable)
-
onSuccess
- Specified by:
onSuccess
in interfacecom.google.gwt.user.client.rpc.AsyncCallback<T>
- See Also:
-
AsyncCallback.onSuccess(java.lang.Object)
-
setLoadingMessage
Sets the loading message.- Parameters:
loadingMessage
- the loading message to set
-
start
Starts the timer for showing the 'loading' state.Note: Has to be called manually before calling the RPC service.
- Parameters:
delay
- the delay in millisecondsblocking
- shows an blocking overlay iftrue
-
stop
Stops the timer.Note: Has to be called manually on success.
- Parameters:
displayDone
-true
if you want to tell the user that the operation was successful
-
onResponse
Handles the result when received from server.- Parameters:
result
- the result from server- See Also:
-
AsyncCallback.onSuccess(Object)
-
show
Shows the 'loading message'.Overwrite to customize the message.
- Parameters:
blocking
- shows an blocking overlay iftrue
-