Class DocumentModel
java.lang.Object
com.inductiveautomation.ignition.client.jsonedit.DocumentModel
- Direct Known Subclasses:
ComponentPropsDocumentModel
,ReadOnlyDocumentModel
Model that represents a json document, but held in memory as so to be editable by the JSON editor.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final PropertyChangeSupport
protected DocumentNode
protected JsonSchema
static final String
-
Constructor Summary
ConstructorsConstructorDescriptionDocumentModel
(DocumentNode root) DocumentModel
(DocumentNode root, JsonSchema schema) DocumentModel
(DocumentElement rootElement) DocumentModel
(com.inductiveautomation.ignition.common.gson.JsonElement rootElement) DocumentModel
(String json) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addNodeChangeListener
(NodeChangeListener listener) void
void
addPropertyChangeListener
(String propertyName, PropertyChangeListener listener) void
addValidator
(DocumentValidator validator) void
dfs
(Consumer<DocumentNode> visitor) Depth first tree traversal of the document.protected com.inductiveautomation.ignition.common.gson.JsonElement
static DocumentNode
fromDocument
(DocumentElement element) static DocumentNode
fromGson
(com.inductiveautomation.ignition.common.gson.JsonElement element) Creates a DocumentNode hierarchy from a GSON json tree.com.inductiveautomation.ignition.common.gson.JsonElement
getRoot()
protected void
Override to customize JSON "validator" strategy.boolean
isKeyEditable
(DocumentNode node) boolean
isValueEditable
(DocumentNode node) protected void
onNodeChanged
(PropertyChangeEvent event) DocumentNodes feed ALL property change events up to the modelboolean
removeNodeChangeListener
(NodeChangeListener listener) void
void
removePropertyChangeListener
(String propertyName, PropertyChangeListener listener) com.inductiveautomation.ignition.common.gson.JsonElement
toJson
(DocumentNode node)
-
Field Details
-
VALIDATION_RESULTS
- See Also:
-
root
-
schema
-
change
-
-
Constructor Details
-
DocumentModel
-
DocumentModel
public DocumentModel(com.inductiveautomation.ignition.common.gson.JsonElement rootElement) -
DocumentModel
-
DocumentModel
-
DocumentModel
-
-
Method Details
-
getRoot
-
getAsJsonTree
public com.inductiveautomation.ignition.common.gson.JsonElement getAsJsonTree() -
toJson
-
encodeValueAsJson
protected com.inductiveautomation.ignition.common.gson.JsonElement encodeValueAsJson(DocumentNode node) -
getSchema
-
onNodeChanged
DocumentNodes feed ALL property change events up to the model -
isKeyEditable
-
isValueEditable
-
addNodeChangeListener
-
removeNodeChangeListener
-
addPropertyChangeListener
-
removePropertyChangeListener
-
addPropertyChangeListener
-
removePropertyChangeListener
-
addValidator
-
getValidationResults
-
dfs
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
-
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.
-