Class AiMessageList.AttachmentClickEvent

java.lang.Object
java.util.EventObject
com.vaadin.flow.component.ComponentEvent<AiMessageList>
io.jmix.aichat.component.messagelist.AiMessageList.AttachmentClickEvent
All Implemented Interfaces:
Serializable
Enclosing class:
AiMessageList

@DomEvent("attachment-click-flow") public static class AiMessageList.AttachmentClickEvent extends com.vaadin.flow.component.ComponentEvent<AiMessageList>
Fired when the user clicks an attachment of a message. The item and the attachment are resolved lazily against the list's current items when the getters are called, and are null if the indexes no longer match (the items changed between the click and its handling).

Must be public so Flow can instantiate it reflectively from the client DOM event (a package-private event class is silently dropped).

See Also:
  • Field Details

    • itemIndex

      protected int itemIndex
    • attachmentIndex

      protected int attachmentIndex
  • Constructor Details

    • AttachmentClickEvent

      public AttachmentClickEvent(AiMessageList source, boolean fromClient, @EventData("event.detail.itemIndex") int itemIndex, @EventData("event.detail.attachmentIndex") int attachmentIndex)
      Creates the event.
      Parameters:
      source - the source component
      fromClient - true if the event comes from the client
      itemIndex - the index of the message the attachment belongs to
      attachmentIndex - the index of the clicked attachment within that message
  • Method Details

    • getItemIndex

      public int getItemIndex()
      Returns:
      the index of the message the clicked attachment belongs to
    • getAttachmentIndex

      public int getAttachmentIndex()
      Returns:
      the index of the clicked attachment within its message
    • getItem

      public @Nullable AiMessageListItem getItem()
      Returns:
      the message whose attachment was clicked, or null if the index no longer resolves
    • getAttachment

      public @Nullable AiMessageListItem.Attachment getAttachment()
      Returns:
      the clicked attachment, or null if the index no longer resolves