Class AiMessageCopyAction

All Implemented Interfaces:
Action, HasShortcutCombination

@ActionType("aichat_messageCopy") public class AiMessageCopyAction extends AiMessageAction<AiMessageCopyAction>
Built-in, client-side copy action. Copies the message's text to the clipboard entirely on the client (inside the user gesture, no server round-trip), then briefly flips its icon to a check mark to confirm. The list recognizes this type and tags it with the "copy" client handler; AiMessageAction.execute(io.jmix.aichat.action.AiMessageActionPerformedEvent) is never called.

Its icon is supplied through CSS — the jmix-ai-message-action-copy class plus the --jmix-ai-message-icon-copy / --jmix-ai-message-icon-check masks — so the action carries no icon component. Its description is localized from the message bundle, but it is only a fallback for a reader of the action itself: when AiMessageList serializes the action it prefers the copy label of its own i18n object.

  • Field Details

    • ID

      public static final String ID
      The action type id, for <action type="aichat_messageCopy"/> in a descriptor.
      See Also:
    • COPY_CLASS_NAME

      public static final String COPY_CLASS_NAME
      The class name the client keys the copy behavior off, applied to the rendered button.
      See Also:
  • Constructor Details

    • AiMessageCopyAction

      public AiMessageCopyAction()
      Creates the action with the default id ID.
    • AiMessageCopyAction

      public AiMessageCopyAction(String id)
      Creates the action with the given id.
      Parameters:
      id - the action id
  • Method Details

    • initAction

      protected void initAction()
      Description copied from class: AiMessageAction
      Hook for subclasses to set defaults (icon, description, class names). Empty by default.

      Called from the constructor, so it runs before the subclass's own field initializers: set state through the inherited setters, not through subclass fields.

      Overrides:
      initAction in class AiMessageAction<AiMessageCopyAction>
    • setMessages

      @Autowired protected void setMessages(Messages messages)