Class AiChatInputFragment

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.Composite<com.vaadin.flow.component.orderedlayout.VerticalLayout>
io.jmix.flowui.fragment.Fragment<com.vaadin.flow.component.orderedlayout.VerticalLayout>
io.jmix.aitoolsflowui.view.input.AiChatInputFragment
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasStyle, FacetOwner, FragmentOwner, Serializable

public class AiChatInputFragment extends Fragment<com.vaadin.flow.component.orderedlayout.VerticalLayout>
Reusable chat input ("composer"). Replaces the stock Vaadin MessageInput with a JmixTextArea + send JmixButton, so it can be embedded both in the timeline (AiChatFragment) and on the chat hub screen.

Submit gesture. Enter submits; Shift+Enter inserts a newline. The server-side submit fires only for a bare Enter (DOM keydown filter) and the newline insertion is suppressed client-side via preventDefault.

See Also:
  • Field Details

  • Constructor Details

    • AiChatInputFragment

      public AiChatInputFragment()
  • Method Details

    • setSubmitHandler

      public void setSubmitHandler(@Nullable Consumer<String> submitHandler)
      Sets the handler invoked with the trimmed, non-blank message text when the user submits. Passing null restores a no-op handler.
      Parameters:
      submitHandler - handler invoked with the submitted text, or null for a no-op
    • setPlaceholder

      public void setPlaceholder(@Nullable String placeholder)
      Sets the placeholder text of the input.
      Parameters:
      placeholder - placeholder text, or null for none
    • setInputEnabled

      public void setInputEnabled(boolean enabled)
      Enables/disables the input and the send button together.
      Parameters:
      enabled - true to enable the input and the send button
    • isInputEnabled

      public boolean isInputEnabled()
      Returns whether the input is enabled.
      Returns:
      true if the input is enabled
    • focus

      public void focus()
      Moves keyboard focus to the input. No-op if the input is disabled.
    • clear

      public void clear()
      Clears the input text.
    • getValue

      public String getValue()
      Returns the current input text.
      Returns:
      current text (empty string if nothing was entered)
    • onReady

      protected void onReady(Fragment.ReadyEvent event)
    • submit

      protected void submit()