Class DocumentModel
- java.lang.Object
-
- com.inductiveautomation.ignition.client.jsonedit.DocumentModel
-
public class DocumentModel extends java.lang.Object
Model that represents a json document, but held in memory as so to be editable by the JSON editor.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.beans.PropertyChangeSupport
change
static DocumentValidator
DUPE_KEYS
static DocumentValidator
NODE_QUALITY
protected DocumentNode
root
protected JsonSchema
schema
static java.lang.String
VALIDATION_RESULTS
-
Constructor Summary
Constructors Constructor Description DocumentModel(DocumentNode root)
DocumentModel(DocumentNode root, JsonSchema schema)
DocumentModel(DocumentElement rootElement)
DocumentModel(com.inductiveautomation.ignition.common.gson.JsonElement rootElement)
DocumentModel(java.lang.String json)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
void
addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
void
addValidator(DocumentValidator validator)
void
dfs(java.util.function.Consumer<DocumentNode> visitor)
Depth first tree traversal of the document.static DocumentNode
fromDocument(DocumentElement element)
static DocumentNode
fromGson(com.inductiveautomation.ignition.common.gson.JsonElement element)
Creates a DocumentNode hierarchy from a GSON json tree.DocumentElement
getAsDocument()
com.inductiveautomation.ignition.common.gson.JsonElement
getAsJsonTree()
DocumentNode
getRoot()
JsonSchema
getSchema()
ValidationResults
getValidationResults()
protected void
onNodeChanged(java.beans.PropertyChangeEvent event)
DocumentNodes feed ALL property change events up to the modelvoid
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
void
removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
-
-
-
Field Detail
-
VALIDATION_RESULTS
public static final java.lang.String VALIDATION_RESULTS
- See Also:
- Constant Field Values
-
root
protected DocumentNode root
-
schema
protected JsonSchema schema
-
change
protected final java.beans.PropertyChangeSupport change
-
DUPE_KEYS
public static final DocumentValidator DUPE_KEYS
-
NODE_QUALITY
public static final DocumentValidator NODE_QUALITY
-
-
Constructor Detail
-
DocumentModel
public DocumentModel(java.lang.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 Detail
-
getRoot
public DocumentNode getRoot()
-
getAsJsonTree
public com.inductiveautomation.ignition.common.gson.JsonElement getAsJsonTree()
-
getAsDocument
public DocumentElement getAsDocument()
-
getSchema
@Nullable public JsonSchema getSchema()
-
onNodeChanged
protected void onNodeChanged(java.beans.PropertyChangeEvent event)
DocumentNodes feed ALL property change events up to the model
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
-
addPropertyChangeListener
public void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
-
removePropertyChangeListener
public void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
-
addValidator
public void addValidator(DocumentValidator validator)
-
getValidationResults
public ValidationResults getValidationResults()
-
dfs
public void dfs(java.util.function.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)
-
-