Package io.jmix.aichat.action
Class AiChatAction<A extends AiChatAction<A,E,C>,E extends AiChatMessage,C extends AiChat<E>>
java.lang.Object
io.jmix.flowui.kit.action.AbstractAction
io.jmix.flowui.kit.action.BaseAction<A>
io.jmix.flowui.action.ObservableBaseAction<A>
io.jmix.flowui.action.SecuredBaseAction<A>
io.jmix.aichat.action.AiChatAction<A,E,C>
- Type Parameters:
A- the concrete action type (self-type, for fluent setters)E- the chat's message typeC- theAiChattype this action targets
- All Implemented Interfaces:
ExecutableAction,TargetAction<C>,Action,HasShortcutCombination
public abstract class AiChatAction<A extends AiChatAction<A,E,C>,E extends AiChatMessage,C extends AiChat<E>>
extends SecuredBaseAction<A>
implements TargetAction<C>, ExecutableAction
An abstract base class for actions that can be associated with an
AiChat.
The action reaches its chat through getTarget(); the target is wired by
the chat's actions support when the action is added, and cleared when it is removed.
Business logic goes in ExecutableAction.execute(); a custom
ActionPerformedEvent listener overrides it.
-
Nested Class Summary
Nested classes/interfaces inherited from class io.jmix.flowui.action.SecuredBaseAction
SecuredBaseAction.EnabledRule -
Field Summary
FieldsFields inherited from class io.jmix.flowui.action.SecuredBaseAction
enabledRulesFields inherited from class io.jmix.flowui.action.ObservableBaseAction
uiObservationSupportFields inherited from class io.jmix.flowui.kit.action.BaseAction
enabledExplicitly, visibleExplicitlyFields inherited from class io.jmix.flowui.kit.action.AbstractAction
description, enabled, eventBus, icon, id, shortcutCombination, text, variant, visibleFields inherited from interface io.jmix.flowui.kit.action.Action
PROP_DESCRIPTION, PROP_ENABLED, PROP_ICON, PROP_SHORTCUT_COMBINATION, PROP_TEXT, PROP_VARIANT, PROP_VISIBLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactionPerform(com.vaadin.flow.component.Component component) Executes action logic.protected void@Nullable Cprotected voidHook for subclasses to set defaults (icon, text, variant).voidprotected voidsetTargetInternal(@Nullable C target) withTarget(@Nullable C target) Sets the chat this action operates on and returns this action, for fluent configuration.Methods inherited from class io.jmix.flowui.action.SecuredBaseAction
addEnabledRule, isEnabledByRule, isPermitted, refreshState, removeEnabledRuleMethods inherited from class io.jmix.flowui.action.ObservableBaseAction
getUiObservationSupportMethods inherited from class io.jmix.flowui.kit.action.BaseAction
addActionPerformedListener, isApplicable, self, setEnabled, setEnabledInternal, setVisible, setVisibleInternal, withDescription, withEnabled, withHandler, withIcon, withShortcutCombination, withText, withVariant, withVisibleMethods inherited from class io.jmix.flowui.kit.action.AbstractAction
addPropertyChangeListener, firePropertyChange, getDescription, getEventBus, getIcon, getIconComponent, getId, getShortcutCombination, getText, getVariant, hasListener, isEnabled, isVisible, setDescription, setIcon, setIconComponent, setShortcutCombination, setText, setVariantMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.jmix.flowui.kit.action.Action
addPropertyChangeListener, getDescription, getIcon, getIconComponent, getId, getText, getVariant, isEnabled, isVisible, refreshState, setDescription, setEnabled, setIcon, setIconComponent, setText, setVariant, setVisibleMethods inherited from interface io.jmix.flowui.action.ExecutableAction
executeMethods inherited from interface io.jmix.flowui.kit.component.HasShortcutCombination
getShortcutCombination, setShortcutCombination
-
Field Details
-
target
-
-
Constructor Details
-
AiChatAction
Creates the action with the given id.- Parameters:
id- the action id
-
-
Method Details
-
initAction
protected void initAction()Hook for subclasses to set defaults (icon, text, variant). Empty by default. -
getTarget
- Specified by:
getTargetin interfaceTargetAction<A extends AiChatAction<A,E, C>>
-
setTarget
- Specified by:
setTargetin interfaceTargetAction<A extends AiChatAction<A,E, C>>
-
setTargetInternal
-
actionPerform
public void actionPerform(com.vaadin.flow.component.Component component) Description copied from interface:ActionExecutes action logic.- Specified by:
actionPerformin interfaceAction- Overrides:
actionPerformin classObservableBaseAction<A extends AiChatAction<A,E, C>> - Parameters:
component-Componentthat triggered this action
-
withTarget
Sets the chat this action operates on and returns this action, for fluent configuration.- Parameters:
target- the chat to target, ornullto clear- Returns:
- this action
-
checkTarget
protected void checkTarget()
-