Class DocumentNode
- java.lang.Object
-
- com.inductiveautomation.ignition.client.jsonedit.DocumentNode
-
public class DocumentNode extends java.lang.Object
Created by carlg on 5/15/2017.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.beans.PropertyChangeSupport
change
This slightly modified property change support object also forwards each event upwards directly to the model, which is what triggers the model to know when to run the validation routine.
-
Constructor Summary
Constructors Constructor Description DocumentNode(DocumentNode copy)
DocumentNode(NodeType type)
-
Method Summary
All 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
appendChild(DocumentNode newNode)
Adds a new child to this node.java.util.Optional<DocumentNode>
findChild(java.lang.Object key)
java.util.Optional<DocumentNode>
findNode(JsonPath path)
java.util.Optional<JsonSchema>
findSchema()
Finds the schema object for this node, if anyint
getChildCount()
java.util.Iterator<DocumentNode>
getChildren()
java.lang.Object
getDirtyKey()
java.lang.String
getDirtyKeyAsString()
JsonPath
getDirtyPath()
Returns the path of a key that has yet to be committed.java.lang.Object
getKey()
int
getKeyAsIndex()
java.lang.String
getKeyAsString()
DocumentModel
getModel()
DocumentNode
getParent()
JsonPath
getPath()
QualityCode
getQuality()
NodeType
getType()
java.util.Collection<ValidationResults.ValidationError>
getValidationErrors()
java.lang.Object
getValue()
int
indexOf(DocumentNode childNode)
void
insertChild(int index, DocumentNode newNode)
Inserts a child an a specific location.boolean
isArray()
boolean
isEquivalent(DocumentNode other)
boolean
isNull()
boolean
isObject()
boolean
isObjectOrArray()
boolean
isRoot()
boolean
isVisible()
void
removeChild(DocumentNode node)
void
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
void
removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
void
reorderBySchema(JsonPath path, JsonSchema schema)
Re-order this node's children, if it is an object with child nodes, according to the schemavoid
replaceChildren(java.util.List<DocumentNode> newChildArray)
void
replaceChildren(java.util.Map<java.lang.String,DocumentNode> newChildMap)
void
repositionNode(DocumentNode child, int newIndex)
void
setChild(int index, DocumentNode newNode)
Overwrites the child node at the given index with this node.void
setDirtyKey(java.lang.Object newDirtyKey)
void
setKey(java.lang.Object newKey)
void
setQuality(QualityCode quality)
void
setType(NodeType type)
void
setType(NodeType type, boolean retainChildren)
Sets the type, with an option to discard any children.void
setValidationErrors(java.util.Collection<ValidationResults.ValidationError> validationErrors)
void
setValue(java.lang.Object value)
void
setValueDocument(DocumentElement element)
void
setValueJson(com.inductiveautomation.ignition.common.gson.JsonElement element)
Sets the value, element is expected to be json null or primitive.void
setVisible(boolean visible)
com.inductiveautomation.ignition.common.gson.JsonElement
toJson()
java.lang.String
toString()
-
-
-
Constructor Detail
-
DocumentNode
public DocumentNode(NodeType type)
-
DocumentNode
public DocumentNode(DocumentNode copy)
-
-
Method Detail
-
isEquivalent
public boolean isEquivalent(DocumentNode other)
-
getModel
public DocumentModel getModel()
-
findSchema
public java.util.Optional<JsonSchema> findSchema()
Finds the schema object for this node, if any
-
findChild
public java.util.Optional<DocumentNode> findChild(java.lang.Object key)
-
findNode
public java.util.Optional<DocumentNode> findNode(JsonPath path)
-
setType
public void setType(NodeType type)
-
setType
public void setType(NodeType type, boolean retainChildren)
Sets the type, with an option to discard any children.
-
getPath
public JsonPath getPath()
-
getDirtyPath
public JsonPath getDirtyPath()
Returns the path of a key that has yet to be committed. Useful only with value node types.
-
setVisible
public void setVisible(boolean visible)
-
isVisible
public boolean isVisible()
-
toJson
public com.inductiveautomation.ignition.common.gson.JsonElement toJson()
-
isRoot
public boolean isRoot()
-
getType
public NodeType getType()
-
getKey
public java.lang.Object getKey()
-
getKeyAsString
public java.lang.String getKeyAsString()
-
getKeyAsIndex
public int getKeyAsIndex()
-
setKey
public void setKey(java.lang.Object newKey)
-
getDirtyKey
public java.lang.Object getDirtyKey()
-
getDirtyKeyAsString
public java.lang.String getDirtyKeyAsString()
-
setDirtyKey
public void setDirtyKey(java.lang.Object newDirtyKey)
-
getValue
public java.lang.Object getValue()
-
setValue
public void setValue(java.lang.Object value)
-
getQuality
public QualityCode getQuality()
-
setQuality
public void setQuality(QualityCode quality)
-
isNull
public boolean isNull()
-
isObjectOrArray
public boolean isObjectOrArray()
-
isObject
public boolean isObject()
-
isArray
public boolean isArray()
-
getParent
public DocumentNode getParent()
-
getChildCount
public int getChildCount()
-
getChildren
public java.util.Iterator<DocumentNode> getChildren()
-
appendChild
public void appendChild(DocumentNode newNode)
Adds a new child to this node. The node type must be Object or Array. Arrays will automatically set the key of the new node.
-
insertChild
public void insertChild(int index, DocumentNode newNode)
Inserts a child an a specific location. If this is an array, the index key will be set automatically. Will throw anIllegalArgumentException
if given a bogus index.
-
setChild
public void setChild(int index, DocumentNode newNode)
Overwrites the child node at the given index with this node.
-
indexOf
public int indexOf(DocumentNode childNode)
- Returns:
- the index of the given child, or -1 if the child is not present
-
repositionNode
public void repositionNode(DocumentNode child, int newIndex)
-
removeChild
public void removeChild(DocumentNode node)
-
replaceChildren
public void replaceChildren(java.util.Map<java.lang.String,DocumentNode> newChildMap)
-
replaceChildren
public void replaceChildren(java.util.List<DocumentNode> newChildArray)
-
reorderBySchema
public void reorderBySchema(@Nonnull JsonPath path, @Nonnull JsonSchema schema)
Re-order this node's children, if it is an object with child nodes, according to the schema- Parameters:
path
- Path to this node relative to the given schmea
-
setValueJson
public void setValueJson(@Nonnull com.inductiveautomation.ignition.common.gson.JsonElement element)
Sets the value, element is expected to be json null or primitive.
-
setValueDocument
public void setValueDocument(DocumentElement element)
-
getValidationErrors
public java.util.Collection<ValidationResults.ValidationError> getValidationErrors()
-
setValidationErrors
public void setValidationErrors(java.util.Collection<ValidationResults.ValidationError> validationErrors)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
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)
-
-