Package io.jmix.aichat.data
Class AbstractAiChatItems<T extends AiChatMessage>
java.lang.Object
io.jmix.aichat.data.AbstractAiChatItems<T>
- Type Parameters:
T- the application's message type
- All Implemented Interfaces:
AiChatItems<T>,DataUnit,Serializable
- Direct Known Subclasses:
ContainerAiChatItems,ListAiChatItems
public abstract class AbstractAiChatItems<T extends AiChatMessage>
extends Object
implements AiChatItems<T>, Serializable
Base class for
AiChatItems implementations: owns the lazily created
event bus, the items-change notification, and the constant-ACTIVE
data-unit state every source shares. Subclasses keep only their storage
logic and call fireItemsChangeEvent(io.jmix.aichat.data.AiChatItems.ItemsChangeType, java.util.Collection<? extends T>) on mutation.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jmix.aichat.data.AiChatItems
AiChatItems.ItemsChangeEvent<T extends AiChatMessage>, AiChatItems.ItemsChangeTypeNested classes/interfaces inherited from interface io.jmix.flowui.data.DataUnit
DataUnit.StateChangeEvent -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.RegistrationaddItemsChangeListener(Consumer<AiChatItems.ItemsChangeEvent<T>> listener) Adds a listener notified when the messages or one of their properties change.com.vaadin.flow.shared.RegistrationRegisters a new state change listener.protected voidfireItemsChangeEvent(AiChatItems.ItemsChangeType changeType, Collection<? extends T> changes) protected EventBusgetState()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.jmix.aichat.data.AiChatItems
addItem, getItems, removeItem
-
Field Details
-
eventBus
-
-
Constructor Details
-
AbstractAiChatItems
public AbstractAiChatItems()
-
-
Method Details
-
addItemsChangeListener
public com.vaadin.flow.shared.Registration addItemsChangeListener(Consumer<AiChatItems.ItemsChangeEvent<T>> listener) Description copied from interface:AiChatItemsAdds a listener notified when the messages or one of their properties change.- Specified by:
addItemsChangeListenerin interfaceAiChatItems<T extends AiChatMessage>- Parameters:
listener- the listener to add- Returns:
- a registration for removing the listener
-
getState
-
addStateChangeListener
public com.vaadin.flow.shared.Registration addStateChangeListener(Consumer<DataUnit.StateChangeEvent> listener) Description copied from interface:DataUnitRegisters a new state change listener.- Specified by:
addStateChangeListenerin interfaceDataUnit- Parameters:
listener- the listener to be added- Returns:
- a registration object for removing an event listener added to a source
-
fireItemsChangeEvent
protected void fireItemsChangeEvent(AiChatItems.ItemsChangeType changeType, Collection<? extends T> changes) -
getEventBus
-