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 Summary
FieldsFields inherited from class java.util.EventObject
source -
Constructor Summary
ConstructorsConstructorDescriptionAttachmentClickEvent(AiMessageList source, boolean fromClient, int itemIndex, int attachmentIndex) Creates the event. -
Method Summary
Modifier and TypeMethodDescription@Nullable AiMessageListItem.Attachmentint@Nullable AiMessageListItemgetItem()intMethods inherited from class com.vaadin.flow.component.ComponentEvent
getSource, getUI, isFromClient, unregisterListenerMethods inherited from class java.util.EventObject
toString
-
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 componentfromClient-trueif the event comes from the clientitemIndex- the index of the message the attachment belongs toattachmentIndex- 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
- Returns:
- the message whose attachment was clicked, or
nullif the index no longer resolves
-
getAttachment
- Returns:
- the clicked attachment, or
nullif the index no longer resolves
-