Class NamedQueryReplyRenderer
java.lang.Object
com.inductiveautomation.ignition.designer.db.namedquery.workspace.ai.NamedQueryReplyRenderer
- All Implemented Interfaces:
ReplyRenderer
Renders
NamedQueryAgent replies into a Swing view with an Apply button that writes the
suggestion back to the host panel. The harness delivers replies as ResponseEnvelope — a Statement envelope
(clarifying question or explanation) renders as prose only; a Suggestion envelope's value
field is the structured JSON payload this renderer parses:
{
"sql": "<proposed query>",
"parameterChanges": {
"remove": ["unusedParam"],
"add": [{ "name": "...", "kind": "Parameter", "dataType": "Int4" }]
}
}
Both top-level fields are optional. A Suggestion whose payload validates empty (no SQL, no mutations) renders without an Apply button.
Validation is local to this class: malformed JSON in value drops the whole payload
with a warning; individual malformed add entries inside a valid payload are listed under
a "Skipped" subsection so the user can spot what they need to do manually.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceWrite-back callbacks invoked when the user clicks Apply. -
Constructor Summary
ConstructorsConstructorDescriptionNamedQueryReplyRenderer(NamedQueryReplyRenderer.ApplyActions actions, Runnable closeAfterApply) -
Method Summary
Modifier and TypeMethodDescription@Nullable StringgetSuggestionFailure(String value) Check an apply-able payload before anything renders it.renderStatement(String description) Render an informational reply with no apply-able actions.renderSuggestion(String description, String value) Render an apply-able suggestion.
-
Constructor Details
-
NamedQueryReplyRenderer
public NamedQueryReplyRenderer(NamedQueryReplyRenderer.ApplyActions actions, Runnable closeAfterApply)
-
-
Method Details
-
renderStatement
Description copied from interface:ReplyRendererRender an informational reply with no apply-able actions. The returnedReplyViewis expected to carry an empty actions list — the panel will read it as aSTATEMENTcard.- Specified by:
renderStatementin interfaceReplyRenderer- Parameters:
description- prose explanation from the model, supporting markdown.
-
getSuggestionFailure
Description copied from interface:ReplyRendererCheck 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.- Specified by:
getSuggestionFailurein interfaceReplyRenderer- Parameters:
value- the payloadReplyRenderer.renderSuggestion(String, String)would receive.- Returns:
nullwhen the payload is usable. Otherwise what to tell the model, phrased for it to act on: what was wrong and what to send instead.
-
renderSuggestion
Description copied from interface:ReplyRendererRender an apply-able suggestion. Thevalueis the literal content the user can write back to the host editor;descriptionis the prose framing. The returned view typically carries one or more apply buttons (Insert, Replace, …).- Specified by:
renderSuggestionin interfaceReplyRenderer- Parameters:
description- prose explanation from the model, supporting markdown.value- the literal content the apply buttons hand back to the host editor.
-