java.lang.Object
com.inductiveautomation.ignition.client.jsonedit.DocumentModel
Direct Known Subclasses:
ComponentPropsDocumentModel, ReadOnlyDocumentModel

public class DocumentModel extends Object
Model that represents a json document, but held in memory as so to be editable by the JSON editor.
  • Field Details

  • Constructor Details

    • DocumentModel

      public DocumentModel(String json)
    • DocumentModel

      public DocumentModel(com.inductiveautomation.ignition.common.gson.JsonElement rootElement)
    • DocumentModel

      public DocumentModel(DocumentElement rootElement)
    • DocumentModel

      public DocumentModel(DocumentNode root)
    • DocumentModel

      public DocumentModel(DocumentNode root, @Nullable JsonSchema schema)
  • Method Details

    • getRoot

      public DocumentNode getRoot()
    • getAsJsonTree

      public com.inductiveautomation.ignition.common.gson.JsonElement getAsJsonTree()
    • toJson

      public com.inductiveautomation.ignition.common.gson.JsonElement toJson(DocumentNode node)
    • encodeValueAsJson

      protected com.inductiveautomation.ignition.common.gson.JsonElement encodeValueAsJson(DocumentNode node)
    • getSchema

      @Nullable public JsonSchema getSchema()
    • onNodeChanged

      protected void onNodeChanged(PropertyChangeEvent event)
      DocumentNodes feed ALL property change events up to the model
    • isKeyEditable

      public boolean isKeyEditable(DocumentNode node)
    • isValueEditable

      public boolean isValueEditable(DocumentNode node)
    • addNodeChangeListener

      public void addNodeChangeListener(NodeChangeListener listener)
    • removeNodeChangeListener

      public boolean removeNodeChangeListener(NodeChangeListener listener)
    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener listener)
    • removePropertyChangeListener

      public void removePropertyChangeListener(PropertyChangeListener listener)
    • addPropertyChangeListener

      public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
    • removePropertyChangeListener

      public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
    • addValidator

      public void addValidator(DocumentValidator validator)
    • getValidationResults

      public ValidationResults getValidationResults()
    • dfs

      public void dfs(Consumer<DocumentNode> visitor)
      Depth first tree traversal of the document.
    • fromGson

      public static DocumentNode fromGson(com.inductiveautomation.ignition.common.gson.JsonElement element)
      Creates a DocumentNode hierarchy from a GSON json tree. All value nodes get the AUTO type.
    • fromDocument

      public static DocumentNode fromDocument(DocumentElement element)
    • initValidators

      protected void initValidators()
      Override to customize JSON "validator" strategy. Default behavior adds a schema validator, if a schema exists, and warns about duplicate or bad quality keys.