Class DocumentModel
- java.lang.Object
- 
- com.inductiveautomation.ignition.client.jsonedit.DocumentModel
 
- 
- Direct Known Subclasses:
- ComponentPropsDocumentModel
 
 public class DocumentModel extends java.lang.ObjectModel that represents a json document, but held in memory as so to be editable by the JSON editor.
- 
- 
Field SummaryFields Modifier and Type Field Description protected java.beans.PropertyChangeSupportchangeprotected DocumentNoderootprotected JsonSchemaschemastatic java.lang.StringVALIDATION_RESULTS
 - 
Constructor SummaryConstructors 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 SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddNodeChangeListener(NodeChangeListener listener)voidaddPropertyChangeListener(java.beans.PropertyChangeListener listener)voidaddPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)voidaddValidator(DocumentValidator validator)voiddfs(java.util.function.Consumer<DocumentNode> visitor)Depth first tree traversal of the document.protected com.inductiveautomation.ignition.common.gson.JsonElementencodeValueAsJson(DocumentNode node)static DocumentNodefromDocument(DocumentElement element)static DocumentNodefromGson(com.inductiveautomation.ignition.common.gson.JsonElement element)Creates a DocumentNode hierarchy from a GSON json tree.com.inductiveautomation.ignition.common.gson.JsonElementgetAsJsonTree()DocumentNodegetRoot()JsonSchemagetSchema()ValidationResultsgetValidationResults()protected voidinitValidators()Override to customize JSON "validator" strategy.booleanisKeyEditable(DocumentNode node)booleanisValueEditable(DocumentNode node)protected voidonNodeChanged(java.beans.PropertyChangeEvent event)DocumentNodes feed ALL property change events up to the modelbooleanremoveNodeChangeListener(NodeChangeListener listener)voidremovePropertyChangeListener(java.beans.PropertyChangeListener listener)voidremovePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)com.inductiveautomation.ignition.common.gson.JsonElementtoJson(DocumentNode node)
 
- 
- 
- 
Field Detail- 
VALIDATION_RESULTSpublic static final java.lang.String VALIDATION_RESULTS - See Also:
- Constant Field Values
 
 - 
rootprotected DocumentNode root 
 - 
schemaprotected JsonSchema schema 
 - 
changeprotected final java.beans.PropertyChangeSupport change 
 
- 
 - 
Constructor Detail- 
DocumentModelpublic DocumentModel(java.lang.String json) 
 - 
DocumentModelpublic DocumentModel(com.inductiveautomation.ignition.common.gson.JsonElement rootElement) 
 - 
DocumentModelpublic DocumentModel(DocumentElement rootElement) 
 - 
DocumentModelpublic DocumentModel(DocumentNode root) 
 - 
DocumentModelpublic DocumentModel(DocumentNode root, @Nullable JsonSchema schema) 
 
- 
 - 
Method Detail- 
getRootpublic DocumentNode getRoot() 
 - 
getAsJsonTreepublic com.inductiveautomation.ignition.common.gson.JsonElement getAsJsonTree() 
 - 
toJsonpublic com.inductiveautomation.ignition.common.gson.JsonElement toJson(DocumentNode node) 
 - 
encodeValueAsJsonprotected com.inductiveautomation.ignition.common.gson.JsonElement encodeValueAsJson(DocumentNode node) 
 - 
getSchema@Nullable public JsonSchema getSchema() 
 - 
onNodeChangedprotected void onNodeChanged(java.beans.PropertyChangeEvent event) DocumentNodes feed ALL property change events up to the model
 - 
isKeyEditablepublic boolean isKeyEditable(DocumentNode node) 
 - 
isValueEditablepublic boolean isValueEditable(DocumentNode node) 
 - 
addNodeChangeListenerpublic void addNodeChangeListener(NodeChangeListener listener) 
 - 
removeNodeChangeListenerpublic boolean removeNodeChangeListener(NodeChangeListener listener) 
 - 
addPropertyChangeListenerpublic void addPropertyChangeListener(java.beans.PropertyChangeListener listener) 
 - 
removePropertyChangeListenerpublic void removePropertyChangeListener(java.beans.PropertyChangeListener listener) 
 - 
addPropertyChangeListenerpublic void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
 - 
removePropertyChangeListenerpublic void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
 - 
addValidatorpublic void addValidator(DocumentValidator validator) 
 - 
getValidationResultspublic ValidationResults getValidationResults() 
 - 
dfspublic void dfs(java.util.function.Consumer<DocumentNode> visitor) Depth first tree traversal of the document.
 - 
fromGsonpublic 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.
 - 
fromDocumentpublic static DocumentNode fromDocument(DocumentElement element) 
 - 
initValidatorsprotected 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.
 
- 
 
-