Class 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 java.lang.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 java.lang.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
    • Constructor Summary

      Constructors 
      Constructor Description
      CmsRpcAction()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract void execute()
      Executes the current RPC call.
      T executeSync()
      Executes a synchronized request.
      void onFailure​(java.lang.Throwable t)
      Handle errors.
      protected abstract void onResponse​(T result)
      Handles the result when received from server.
      void onSuccess​(T value)  
      void setLoadingMessage​(java.lang.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 Detail

      • SYNC_TOKEN

        public static final java.lang.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:
        Constant Field Values
    • Method Detail

      • 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:
        execute()
      • onFailure

        public void onFailure​(java.lang.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​(java.lang.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