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

    Fields
    Modifier and Type
    Field
    Description
    static 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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract void
    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
    onSuccess(T value)
     
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • SYNC_TOKEN

      public static final String 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

  • Method Details

    • execute

      public abstract void execute()
      Executes the current RPC call.

      Initializes client-server communication and will

    • executeSync

      public T executeSync()
      Executes a synchronized request.

      Returns:
      the RPC result
      See Also:
    • onFailure

      public void onFailure(Throwable t)
      Handle errors.

      Specified by:
      onFailure in interface com.google.gwt.user.client.rpc.AsyncCallback<T>
      See Also:
      • AsyncCallback.onFailure(java.lang.Throwable)
    • onSuccess

      public void onSuccess(T value)
      Specified by:
      onSuccess in interface com.google.gwt.user.client.rpc.AsyncCallback<T>
      See Also:
      • AsyncCallback.onSuccess(java.lang.Object)
    • setLoadingMessage

      public void setLoadingMessage(String loadingMessage)
      Sets the loading message.

      Parameters:
      loadingMessage - the loading message to set
    • start

      public void start(int delay, boolean blocking)
      Starts the timer for showing the 'loading' state.

      Note: Has to be called manually before calling the RPC service.

      Parameters:
      delay - the delay in milliseconds
      blocking - shows an blocking overlay if true
    • stop

      public void stop(boolean displayDone)
      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

      protected abstract void onResponse(T result)
      Handles the result when received from server.

      Parameters:
      result - the result from server
      See Also:
      • AsyncCallback.onSuccess(Object)
    • show

      protected void show(boolean blocking)
      Shows the 'loading message'.

      Overwrite to customize the message.

      Parameters:
      blocking - shows an blocking overlay if true