Class TriggerConfigSupport<T>

java.lang.Object
com.inductiveautomation.ignition.designer.scripteditor.workspace.ai.TriggerConfigSupport<T>
Type Parameters:
T - the tab's typed trigger-config model.

@NullMarked public abstract class TriggerConfigSupport<T> extends Object
One event-script tab's trigger-configuration contract with the embedded assistant: the schema a proposal must satisfy, the configuration the panel holds right now, and the write-back and preview for a proposal the user accepts.

Build one in the tab's triggerConfigSupport() hook and never cache it: the assist popup is non-modal, so current() is read again on every submit. apply(T) and preview(T) are invoked on the EDT.

  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract void
    apply(T config)
    Writes a configuration the user accepted to the live panel, on the EDT.
    final void
    applyJson(com.inductiveautomation.ignition.common.gson.JsonObject config)
    Writes a proposed configuration to the live panel.
    protected abstract T
     
    final String
     
    protected String
    preview(T config)
    Renders a proposed configuration as Markdown rows for the reply card, on the EDT, using the same labels as the tab's settings panel.
    final String
    previewJson(com.inductiveautomation.ignition.common.gson.JsonObject config)
    Renders a proposed configuration for the reply card.
     
    final @Nullable ConfigProblems
    validate(com.inductiveautomation.ignition.common.gson.JsonObject config)
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TriggerConfigSupport

      protected TriggerConfigSupport(ConfigSchema<T> schema)
      Parameters:
      schema - the authoritative schema and deserialization for this tab's trigger config.
  • Method Details

    • schema

      public final ConfigSchema<T> schema()
      Returns:
      the authoritative schema and deserialization for this tab's trigger config.
    • current

      protected abstract T current()
      Returns:
      the configuration the panel holds right now — the live editor state, not the last-saved model.
    • apply

      protected abstract void apply(T config)
      Writes a configuration the user accepted to the live panel, on the EDT.
      Parameters:
      config - the accepted configuration.
    • preview

      protected String preview(T config)
      Renders a proposed configuration as Markdown rows for the reply card, on the EDT, using the same labels as the tab's settings panel.
      Parameters:
      config - the proposed configuration.
      Returns:
      the preview rows; blank — the default — falls back to a raw JSON view.
    • describeCurrent

      public final String describeCurrent()
      Returns:
      the panel's live configuration as canonical JSON, for showing the model what the script is configured with now. Not necessarily schema-valid — an editor can hold states the schema forbids in a proposal — so present it as current state rather than as an example.
    • validate

      public final @Nullable ConfigProblems validate(com.inductiveautomation.ignition.common.gson.JsonObject config)
      Parameters:
      config - a configuration the model proposed.
      Returns:
      every problem with config, or null when it is acceptable.
      See Also:
    • applyJson

      public final void applyJson(com.inductiveautomation.ignition.common.gson.JsonObject config) throws ConfigurationException
      Writes a proposed configuration to the live panel. Call only after validate(JsonObject) came back null.
      Parameters:
      config - the accepted configuration.
      Throws:
      ConfigurationException - if config cannot be parsed into the typed model.
    • previewJson

      public final String previewJson(com.inductiveautomation.ignition.common.gson.JsonObject config) throws ConfigurationException
      Renders a proposed configuration for the reply card. Call only after validate(JsonObject) came back null.
      Parameters:
      config - the proposed configuration.
      Returns:
      the preview rows as Markdown; blank when the tab has nothing to show.
      Throws:
      ConfigurationException - if config cannot be parsed into the typed model.