Interface RichPageWidgetActionContext

All Superinterfaces:
RichPageContext, RichPageParametersContext, RichPageRenderingContext, RichPageWidgetCommonContext, RichPageWidgetContext

public interface RichPageWidgetActionContext extends RichPageWidgetCommonContext
Since:
3.9.2
  • Method Details

    • actionId

      @Nullable String actionId()
      Action ID - The data-action-id ( RichPageWidget.ATTRIBUTE_ACTION_ID ) attribute value of the HTML element that the user clicks on.

      Or the value passed to the executeWidgetAction JavaScript function. See PublicJS.executeWidgetAction(Node, boolean, String) for details.
    • transaction

      @NotNull WriteTransaction transaction()
      Specified by:
      transaction in interface RichPageContext
    • message

      void message(@Nullable String message)
      Sets the message that will be shown to users after the action on the server is executed. (But before any of the other operations like executeJavaScript(String), replaceWithHtml(String) or refresh(boolean)).
      Parameters:
      message - - No message will be shown when null or an empty string is used.
    • executeJavaScript

      void executeJavaScript(@Nullable String script)
      Calling this method means that the given script should be executed on the client side after the action finishes and the optional message(String) is displayed, but before replaceWithHtml(String) or refresh(boolean).
    • replaceWithHtml

      void replaceWithHtml(@NotNull String html)
      Calling this method means that the content of the widget should be replaced by the given html.

      This is mainly meant for widgets that need to display data based on the action, but do not write any data to persistence. Widgets that write data should instead use refresh(boolean) with a "true" value, because then the rendering of the widget is executed in a new a transaction. (Needed for all indexes to update by committing the write transaction where the action was executed).

      It usually does not make sense to use this method together with refresh(boolean).
    • refresh

      void refresh(boolean widget)
      Calling this method means that the widget or whole page should be refreshed after the action.

      It usually does not make sense to use this method together with replaceWithHtml(String).
      Parameters:
      widget - - "true" to refresh the widget, "false" to refresh the whole page.