Class PropertyReference
- java.lang.Object
-
- com.inductiveautomation.ignition.common.lifecycle.AbstractLifecycle
-
- com.inductiveautomation.perspective.gateway.property.PropertyReference
-
- Direct Known Subclasses:
DesignerPropertyReference
public class PropertyReference extends AbstractLifecycle
A PropertyReference is a context-aware object that resolves properties between different components within the same parent
View
, or, more specifically, within eachView
's root containerComponent
.Property references are resolved with respect to the target
PerspectiveElement
(e.g., the one passed in to the constructor of this class), in order to identify a property that may provide values. In order to fully resolve a property reference and allow for the subscription of property changes, the views must first be fully initialized so that all child components have necessary models.These references are a String, and consist of two parts: a Path Prefix,followed by a valid Property Identifier.
There are 3 types of Path Prefix:
- Relative- a prefix following familiar linux path formats such as ./ and ../../
- Absolute- a prefix which resolve the location based from the root view, such as /aContainer/myComponent/
- Shortcut- a special prefix that allows convenient references to a component's own properties, its parent, or the root view. Does not allow path separators.
After the prefix comes the Property Identifier. A Property Identifier is the json-like path to a specific property on the target component. The property lives inside one of the component's
PropertyTree
s. A valid property identifier has three parts, demarcated by '.' in the form <name>.<scope>.<property_identifier>, with the following restrictions:-
Name
- begins with a letter or underscore, and may only contain letters, numbers and underscores
- may be a valid property shortcut such as this, parent, or view.
-
Scope
- specifies the category or scope of the target property by including one of the
valid scope types:
- props
- custom
- position
- meta
- specifies the category or scope of the target property by including one of the
valid scope types:
Given a full property reference path such as /aContainer/childComponent/button.meta.visible, the Property Identifier is button.meta.visible. Shortcut PropertyReferences are, as noted above, also valid identifiers. See
PropertyRef.IDENTIFIER
for examples of valid and invalid identifiers.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
PropertyReference.PropertyReferenceParseException
-
Constructor Summary
Constructors Constructor Description PropertyReference(PerspectiveElement target, java.lang.String referencePath, java.util.function.Consumer<PropertyTreeChangeEvent> subscriber, java.util.Set<Origin> acceptableOrigins)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JsonPath
getPropertyPath()
Returns the property path where the target property can be found in its property treePropertyTree
getPropertyTree()
Returns the property tree where the target property livesjava.lang.String
getRawPath()
View
getView()
boolean
isParsed()
boolean
isPropertySelfReference(PropertyKey targetProperty)
Returns a boolean that shows if the source and target are referencing the same propertyboolean
isResolved()
protected void
onShutdown()
protected void
onStartup()
java.util.Optional<QualifiedValue>
read()
java.util.Optional<QualifiedValue>
read(JsonPath path)
java.lang.String
toString()
-
Methods inherited from class com.inductiveautomation.ignition.common.lifecycle.AbstractLifecycle
isRunning, shutdown, startup
-
-
-
-
Constructor Detail
-
PropertyReference
public PropertyReference(PerspectiveElement target, java.lang.String referencePath, java.util.function.Consumer<PropertyTreeChangeEvent> subscriber, java.util.Set<Origin> acceptableOrigins)
-
-
Method Detail
-
isParsed
public boolean isParsed()
-
isResolved
public boolean isResolved()
- Returns:
- true if this is a properly resolved reference to an accessible value
-
getView
public View getView()
-
getPropertyTree
public PropertyTree getPropertyTree()
Returns the property tree where the target property lives
-
getPropertyPath
public JsonPath getPropertyPath()
Returns the property path where the target property can be found in its property tree
-
isPropertySelfReference
public boolean isPropertySelfReference(PropertyKey targetProperty)
Returns a boolean that shows if the source and target are referencing the same property
-
getRawPath
public java.lang.String getRawPath()
-
read
public java.util.Optional<QualifiedValue> read()
-
read
public java.util.Optional<QualifiedValue> read(JsonPath path)
-
onStartup
protected void onStartup()
- Specified by:
onStartup
in classAbstractLifecycle
-
onShutdown
protected void onShutdown()
- Specified by:
onShutdown
in classAbstractLifecycle
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-