Class ActionResponse

java.lang.Object
com.axelor.rpc.Response
com.axelor.rpc.ActionResponse

public class ActionResponse extends Response
An implementation of Response to be used with controllers.
  • Constructor Details

    • ActionResponse

      public ActionResponse()
  • Method Details

    • setReload

      public void setReload(boolean reload)
      Set the reload flag.

      The client user reload flag to refresh the view.

      Parameters:
      reload - whether to reload client view
    • setCanClose

      public void setCanClose(boolean canClose)
      Set the canClose flag.

      The client uses the canClose flag to decide whether the view can be closed.

      Parameters:
      canClose - whether the view can be closed.
    • setInfo

      public void setInfo(String message)
      Set an info message.

      This message will be shown on the client screen as a dialog.

      Parameters:
      message - the message to show on client
    • setInfo

      public void setInfo(String message, String title)
      Set an info message.

      This message will be shown on the client screen as a dialog.

      Parameters:
      message - the message to show on client
      title - the title of the modal
    • setInfo

      public void setInfo(String message, String title, String confirmBtnTitle)
      Set an info message.

      This message will be shown on the client screen as a dialog.

      Parameters:
      message - the message to show on client
      title - the title of the modal
      confirmBtnTitle - the title of the confirm button
    • setNotify

      public void setNotify(String message)
      Set a notification message.

      The message will be show on the client screen as a notification.

      Parameters:
      message - the message to show on client
    • setNotify

      public void setNotify(String message, String title)
      Set a notification message.

      The message will be show on the client screen as a notification.

      Parameters:
      message - the message to show on client
      title - the title of the notification box
    • setAlert

      public void setAlert(String message)
      Set an alert message.

      The message will be shown on the client screen as an alert dialog.

      Parameters:
      message - the message to show as an alert
    • setAlert

      public void setAlert(String message, String title)
      Set an alert message.

      The message will be shown on the client screen as an alert dialog.

      Parameters:
      message - the message to show as an alert
      title - the title of the modal
    • setAlert

      public void setAlert(String message, String title, String confirmBtnTitle, String cancelBtnTitle, String action)
      Set an alert message.

      The message will be shown on the client screen as an alert dialog.

      Parameters:
      message - the message to show as an alert
      title - the title of the modal
      confirmBtnTitle - the title of the confirm button
      cancelBtnTitle - the title of the cancel button
      action - action to be executed on error or alert message to make corrective measures, when error dialog is closed or alert dialog is canceled.
    • setError

      public void setError(String message)
      Set an error message.

      The message will be shown on the client screen as an error dialog.

      Parameters:
      message - the message to show as an error
    • setError

      public void setError(String message, String title)
      Set an error message.

      The message will be shown on the client screen as an error dialog.

      Parameters:
      message - the message to show as an error
      title - the title of the modal
    • setError

      public void setError(String message, String title, String confirmBtnTitle, String action)
      Set an error message.

      The message will be shown on the client screen as an error dialog.

      Parameters:
      message - the message to show as an error
      title - the title of the modal
      confirmBtnTitle - the title of the confirm button
      action - action to be executed on error or alert message to make corrective measures, when error dialog is closed or alert dialog is canceled.
    • setPending

      public void setPending(String actions)
      Set the comma separated list of pending actions.

      This can be used along with setAlert(String), setError(String) methods.

      Parameters:
      actions - the list of pending actions
    • setExportFile

      public void setExportFile(String path)
      Set the file path to be exported.

      The file path is copied to a dedicated temporary file for pending export.

      The client will initiate downloading the export file.

      Parameters:
      path - the path to the export file
    • setExportFile

      public void setExportFile(String path, String fileName)
      Set the file path to be exported.

      The file path is copied to a dedicated temporary file for pending export.

      The client will initiate downloading the export file.

      Parameters:
      path - the path to the export file
      fileName - the name of the downloaded export file
    • setExportFile

      public void setExportFile(Path path)
      Set the file path to be exported.

      The file path is copied to a dedicated temporary file for pending export.

      The client will initiate downloading the export file.

      Parameters:
      path - the path to the export file
    • setExportFile

      public void setExportFile(Path path, String fileName)
      Set the file path to be exported.

      The file path is copied to a dedicated temporary file for pending export.

      The client will initiate downloading the export file.

      Parameters:
      path - the path to the export file
      fileName - the name of the downloaded export file
    • setExportFile

      public void setExportFile(InputStream stream, String fileName)
      Set the file stream to be exported.

      This creates a pending export file from the given stream.

      The client will initiate downloading the export file.

      Parameters:
      stream - the stream to the export file
      fileName - the name of the downloaded export file
    • setValues

      public void setValues(Object context)
      Set record values.

      The client will update current view with these values.

      The context can be a Map, Context or Model proxy obtained with Context.asType(Class). Managed instance of Model should be avoided.

      Parameters:
      context - the context to set, a map or context proxy
      Throws:
      IllegalArgumentException - if passed context is detached non-proxy entity.
      See Also:
    • setValue

      public void setValue(String fieldName, Object value)
      Set value for the given field.
      Parameters:
      fieldName - name of the field
      value - field name
      See Also:
    • setView

      public void setView(Map<String,Object> view)
      Inform the client to open the given view.
      Parameters:
      view - the view to show
    • setView

      public void setView(String title, String model, String mode, String domain)
      Inform the client to open a view for the given model.
      Parameters:
      title - the view title
      model - the model name
      mode - the view mode (e.g. form, grid etc)
      domain - the filter
    • setSignal

      public void setSignal(String signal, Object data)
      Send an arbitrary signal to the client view with the specified data.
      Parameters:
      signal - signal name
      data - signal data
    • setAttrs

      public void setAttrs(Map<String,Map<String,Object>> attrs)
      Set field attributes.

      The client view may update the view fields with the given attributes.

      Parameters:
      attrs - attribute map for the fields
    • setAttr

      public void setAttr(String fieldName, String attr, Object value)
      Set an attribute of a field.
      Parameters:
      fieldName - name of the field
      attr - attribute name
      value - attribute value
    • setRequired

      public void setRequired(String fieldName, boolean required)
      Set the required attribute for the given field.
      Parameters:
      fieldName - name of the field
      required - true or false
    • setReadonly

      public void setReadonly(String fieldName, boolean readonly)
      Set the readonly attribute for the given field.
      Parameters:
      fieldName - name of the field
      readonly - true or false
    • setHidden

      public void setHidden(String fieldName, boolean hidden)
      Set the hidden attribute for the given field.
      Parameters:
      fieldName - name of the field
      hidden - true or false
    • setColor

      public void setColor(String fieldName, String color)
      Set the color attribute for the given field.
      Parameters:
      fieldName - name of the field
      color - CSS compatible color value