Class AttachmentClickEvent<T extends AiChatMessage>

java.lang.Object
java.util.EventObject
com.vaadin.flow.component.ComponentEvent<AiChat<T>>
io.jmix.aichat.component.chat.AttachmentClickEvent<T>
Type Parameters:
T - the message type
All Implemented Interfaces:
Serializable

public class AttachmentClickEvent<T extends AiChatMessage> extends com.vaadin.flow.component.ComponentEvent<AiChat<T>>
Fired when the user clicks an attachment of a message. The message is resolved when the click arrives — from the source message the clicked item was rendered from — so a change to the bound items between the click and its handling cannot shift it. It is null when the clicked item has no domain message behind it.
See Also:
  • Field Details

    • message

      protected @Nullable T extends AiChatMessage message
    • attachmentIndex

      protected int attachmentIndex
  • Constructor Details

    • AttachmentClickEvent

      public AttachmentClickEvent(AiChat<T> source, boolean fromClient, @Nullable T message, int attachmentIndex)
      Creates the event.
      Parameters:
      source - the source component
      fromClient - true if the event comes from the client
      message - the message whose attachment was clicked, or null when the clicked item has no domain message behind it
      attachmentIndex - the index of the clicked attachment within that message
  • Method Details

    • getMessage

      public @Nullable T getMessage()
      Returns:
      the message whose attachment was clicked, or null when the clicked item has no domain message — the transient bubble a stopped or failed generation leaves behind, or an item an application added to the inner list itself
    • getFileRef

      public @Nullable FileRef getFileRef()
      Returns:
      the clicked file, or null when there is no message behind the item or the attachment index does not resolve against it