Interface ReplyRenderer

All Known Implementing Classes:
ComponentPropsReplyRenderer, EventScriptReplyRenderer, InstanceWizardReplyRenderer, NamedQueryReplyRenderer, QueryBrowserReplyRenderer, UdtEditorReplyRenderer

public interface ReplyRenderer
Renders one model reply into a Swing view with optional apply actions. One renderer is held per assist session and called on each incoming reply.

Both methods run on the EDT and may construct fresh Swing components on every call; the panel installs the returned ReplyView into the conversation column. The host picks which method to call based on the discriminator in the structured reply the harness produced: informational replies route to renderStatement(String), apply-able replies route to renderSuggestion(String, String).

The panel hosts the returned component inside a single scrolling conversation column. Renderers should not wrap their content in an outer JScrollPane — the panel provides outer scrolling, and a nested scroll pane competes with it and forces the reply to a fixed height. Inner scroll panes around a single bounded widget (a fixed-size preview, a JTable of changes) are fine: they sit inside the bubble and don't interact with the conversation column's scrollbar.

  • Method Details

    • renderStatement

      ReplyView renderStatement(String description)
      Render an informational reply with no apply-able actions. The returned ReplyView is expected to carry an empty actions list — the panel will read it as a STATEMENT card.
      Parameters:
      description - prose explanation from the model, supporting markdown.
    • renderSuggestion

      ReplyView renderSuggestion(String description, String value)
      Render an apply-able suggestion. The value is the literal content the user can write back to the host editor; description is the prose framing. The returned view typically carries one or more apply buttons (Insert, Replace, …).
      Parameters:
      description - prose explanation from the model, supporting markdown.
      value - the literal content the apply buttons hand back to the host editor.
    • getSuggestionFailure

      default @Nullable String getSuggestionFailure(String value)
      Check an apply-able payload before anything renders it. A renderer that rejects a payload here gets the model asked again while the turn is still open, instead of the user reading a rejection card for a reply nothing tried to fix.

      Unlike the render methods this runs on the sending thread, not the EDT, so an implementation must inspect only value — no Swing state, no editor snapshot.

      Parameters:
      value - the payload renderSuggestion(String, String) would receive.
      Returns:
      null when the payload is usable. Otherwise what to tell the model, phrased for it to act on: what was wrong and what to send instead.