Class BindUtilities
- java.lang.Object
-
- com.inductiveautomation.factorypmi.application.binding.util.BindUtilities
-
public class BindUtilities extends java.lang.Object
Contains various static functions used to create bindings
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CLOSE_DELIM
static java.lang.String
OPEN_DELIM
static java.lang.String
RELPATH_PARENT
static java.lang.String
RELPATH_SOURCE
-
Constructor Summary
Constructors Constructor Description BindUtilities()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static void
addAllInteractions(Expression e, java.util.List<InteractionDescriptor> list)
static void
connectBindings(BindingRoot window, TagManager manager, Expression expr, Adapter adapter, InteractionListener interactionListener)
Recursively goes through the given expression, connecting all BoundVariableExpressions up with PropertyListenerDescriptors.static QueryHolder
createQueryHolder(java.lang.String query, TagManager manager, BindingRoot selectedWindow, PropertyAdapter adapter, java.lang.String thisPath)
static QueryHolder
createQueryHolderForTagBinding(java.lang.String query, TagManager manager, TagPath localPath)
static BoundValueHolder
createValueHolder(java.lang.String expression, TagManager manager, BindingRoot selectedWindow, PropertyAdapter adapter, java.lang.String thisPath)
static TagPath
derelativezie(TagPath tagPath, TagPath parentPath)
Deprecated.static java.util.List<PropertyNode>
getAllProperties(java.lang.Object o)
static java.util.List<PropertyNode>
getBoundProperties(java.lang.Object o)
static java.lang.Object
getCurrentValue(PropertyNode property)
Deprecated.Use PropertyNode.getQValue().getValue() insteadstatic java.beans.FeatureDescriptor
getFeatureDescriptor(java.awt.Component parent, java.lang.String propName)
Returns the FeatureDescriptor for the given property name on the given component or null if the property is not found.static PropertyListenerDescriptor
getPLDForPath(BindingRoot selectedWindow, java.lang.String path)
Creates a new PropertyListenerDescriptor for the given path.static PropertyNode
getPropertyNode(java.awt.Component parent, java.beans.FeatureDescriptor fd)
Returns a PropertyNode (Dynamic or Static) for the given feature descriptor on the given componentstatic PropertyNode
getPropertyNode(java.awt.Component source, java.lang.String propName, boolean onlyBindable)
Finds the PropertyNode for the given component+name.static PropertyNode
getPropertyNodeForPath(BindingRoot window, java.lang.String path, boolean onlyBindable)
For the given path (with or without path delimiters { and }) in the given window, returns the PropertyNode.static PropertyNode
getPropertyNodeForRelativePath(javax.swing.JComponent relativeTo, java.lang.String path, boolean onlyBindable)
static java.lang.Class
getPropertyType(java.beans.FeatureDescriptor fd)
static QualifiedValue
getQValue(java.awt.Component component, java.beans.FeatureDescriptor property)
static boolean
isBound(java.lang.String s)
static boolean
isBound(javax.swing.JComponent component, java.lang.String propertyName)
Checks to see if the property of the given component is bound or not.static boolean
isDBBound(javax.swing.JComponent component, java.lang.String propertyName)
Checks to see if the property of the given component has a database binding.static boolean
isPath(java.lang.String s)
Returns true if the string seems to be a path (absolute OR relative).static boolean
isPropertyBindable(java.beans.FeatureDescriptor fd)
static boolean
isPropertyDefined(BindingRoot window, java.lang.String path)
static boolean
isRelativePath(java.lang.String s)
Matches something like "{$...}"static void
main(java.lang.String[] args)
static ExpressionParseContext
newBinder(BindingRoot selectedWindow, TagManager tagManager, TagPath localPath, FunctionFactory funcFactory)
static void
pullCurrentValues(PropertyAdapter adapter)
-
-
-
Field Detail
-
OPEN_DELIM
public static final java.lang.String OPEN_DELIM
- See Also:
- Constant Field Values
-
CLOSE_DELIM
public static final java.lang.String CLOSE_DELIM
- See Also:
- Constant Field Values
-
RELPATH_SOURCE
public static final java.lang.String RELPATH_SOURCE
- See Also:
- Constant Field Values
-
RELPATH_PARENT
public static final java.lang.String RELPATH_PARENT
- See Also:
- Constant Field Values
-
-
Method Detail
-
addAllInteractions
public static void addAllInteractions(Expression e, java.util.List<InteractionDescriptor> list)
-
getPropertyType
public static java.lang.Class getPropertyType(java.beans.FeatureDescriptor fd)
-
isBound
public static boolean isBound(javax.swing.JComponent component, java.lang.String propertyName)
Checks to see if the property of the given component is bound or not.
-
isBound
public static boolean isBound(java.lang.String s)
-
isDBBound
public static boolean isDBBound(@Nonnull javax.swing.JComponent component, @Nonnull java.lang.String propertyName)
Checks to see if the property of the given component has a database binding. Used by Edge to check if db binding should show for a component.
-
derelativezie
@Deprecated public static TagPath derelativezie(TagPath tagPath, TagPath parentPath) throws java.lang.RuntimeException
Deprecated.UseTagPathParser
derelativezie(TagPath, TagPath)
instead (this calls through to that).- Throws:
java.lang.RuntimeException
-
newBinder
public static ExpressionParseContext newBinder(BindingRoot selectedWindow, TagManager tagManager, TagPath localPath, FunctionFactory funcFactory)
-
getPLDForPath
public static PropertyListenerDescriptor getPLDForPath(BindingRoot selectedWindow, java.lang.String path) throws java.lang.Exception
Creates a new PropertyListenerDescriptor for the given path. Only the initial value, source component, and source property will be configured on the PLD- Throws:
java.lang.Exception
- if it can't pull the current value for the property.
-
connectBindings
public static void connectBindings(BindingRoot window, TagManager manager, Expression expr, Adapter adapter, InteractionListener interactionListener) throws java.lang.RuntimeException
Recursively goes through the given expression, connecting all BoundVariableExpressions up with PropertyListenerDescriptors. Multiple BVEs that share the same path will share one PLD, so that an expression isn't re-evaluated multiple times for one property change event from component.- Throws:
java.lang.RuntimeException
-
createQueryHolderForTagBinding
public static QueryHolder createQueryHolderForTagBinding(java.lang.String query, TagManager manager, TagPath localPath) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createQueryHolder
public static QueryHolder createQueryHolder(java.lang.String query, TagManager manager, BindingRoot selectedWindow, PropertyAdapter adapter, java.lang.String thisPath) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createValueHolder
public static BoundValueHolder createValueHolder(java.lang.String expression, TagManager manager, BindingRoot selectedWindow, PropertyAdapter adapter, java.lang.String thisPath) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getBoundProperties
public static java.util.List<PropertyNode> getBoundProperties(java.lang.Object o)
-
getAllProperties
public static java.util.List<PropertyNode> getAllProperties(java.lang.Object o)
-
isPropertyBindable
public static boolean isPropertyBindable(java.beans.FeatureDescriptor fd)
-
main
public static void main(java.lang.String[] args)
-
isPropertyDefined
public static boolean isPropertyDefined(BindingRoot window, java.lang.String path)
-
isPath
public static boolean isPath(java.lang.String s)
Returns true if the string seems to be a path (absolute OR relative). Simply checks if the string starts with { and ends with }
-
isRelativePath
public static boolean isRelativePath(java.lang.String s)
Matches something like "{$...}"
-
getPropertyNodeForPath
public static PropertyNode getPropertyNodeForPath(BindingRoot window, java.lang.String path, boolean onlyBindable) throws java.lang.RuntimeException
For the given path (with or without path delimiters { and }) in the given window, returns the PropertyNode.- Parameters:
window
- The window in which the path resides. Throws a RuntimeException if the path isn't valid.path
- The path to the propertyonlyBindable
- If true, only bindable properties will be considered- Throws:
java.lang.RuntimeException
-
getPropertyNodeForRelativePath
public static PropertyNode getPropertyNodeForRelativePath(javax.swing.JComponent relativeTo, java.lang.String path, boolean onlyBindable) throws java.lang.RuntimeException
- Throws:
java.lang.RuntimeException
-
getPropertyNode
public static PropertyNode getPropertyNode(java.awt.Component source, java.lang.String propName, boolean onlyBindable) throws java.lang.RuntimeException
Finds the PropertyNode for the given component+name. If the property doesn't exist, a RuntimeException is thrown.- Parameters:
source
- The component to look for the property on.propName
- The name of the property. Can be in the format "name:path.to.subprop" for UDT sub-properties.onlyBindable
- If true, only bindable properties will be accepted.- Throws:
java.lang.RuntimeException
-
getCurrentValue
@Deprecated public static java.lang.Object getCurrentValue(PropertyNode property) throws java.lang.Exception
Deprecated.Use PropertyNode.getQValue().getValue() instead- Throws:
java.lang.Exception
-
getQValue
public static QualifiedValue getQValue(java.awt.Component component, java.beans.FeatureDescriptor property) throws java.lang.Exception
- Throws:
java.lang.Exception
-
pullCurrentValues
public static void pullCurrentValues(PropertyAdapter adapter)
-
getFeatureDescriptor
public static java.beans.FeatureDescriptor getFeatureDescriptor(java.awt.Component parent, java.lang.String propName)
Returns the FeatureDescriptor for the given property name on the given component or null if the property is not found.
-
getPropertyNode
public static PropertyNode getPropertyNode(java.awt.Component parent, java.beans.FeatureDescriptor fd)
Returns a PropertyNode (Dynamic or Static) for the given feature descriptor on the given component
-
-