Class BindUtilities
- java.lang.Object
-
- com.inductiveautomation.factorypmi.application.binding.util.BindUtilities
-
public class BindUtilities extends java.lang.ObjectContains various static functions used to create bindings
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCLOSE_DELIMstatic java.lang.StringOPEN_DELIMstatic java.lang.StringRELPATH_PARENTstatic java.lang.StringRELPATH_SOURCE
-
Constructor Summary
Constructors Constructor Description BindUtilities()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static voidaddAllInteractions(Expression e, java.util.List<InteractionDescriptor> list)static voidconnectBindings(BindingRoot window, TagManager manager, Expression expr, Adapter adapter, InteractionListener interactionListener)Recursively goes through the given expression, connecting all BoundVariableExpressions up with PropertyListenerDescriptors.static QueryHoldercreateQueryHolder(java.lang.String query, TagManager manager, BindingRoot selectedWindow, PropertyAdapter adapter, java.lang.String thisPath)static QueryHoldercreateQueryHolderForTagBinding(java.lang.String query, TagManager manager, TagPath localPath)static BoundValueHoldercreateValueHolder(java.lang.String expression, TagManager manager, BindingRoot selectedWindow, PropertyAdapter adapter, java.lang.String thisPath)static TagPathderelativezie(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.ObjectgetCurrentValue(PropertyNode property)Deprecated.Use PropertyNode.getQValue().getValue() insteadstatic java.beans.FeatureDescriptorgetFeatureDescriptor(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 PropertyListenerDescriptorgetPLDForPath(BindingRoot selectedWindow, java.lang.String path)Creates a new PropertyListenerDescriptor for the given path.static PropertyNodegetPropertyNode(java.awt.Component parent, java.beans.FeatureDescriptor fd)Returns a PropertyNode (Dynamic or Static) for the given feature descriptor on the given componentstatic PropertyNodegetPropertyNode(java.awt.Component source, java.lang.String propName, boolean onlyBindable)Finds the PropertyNode for the given component+name.static PropertyNodegetPropertyNodeForPath(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 PropertyNodegetPropertyNodeForRelativePath(javax.swing.JComponent relativeTo, java.lang.String path, boolean onlyBindable)static java.lang.ClassgetPropertyType(java.beans.FeatureDescriptor fd)static QualifiedValuegetQValue(java.awt.Component component, java.beans.FeatureDescriptor property)static booleanisBound(java.lang.String s)static booleanisBound(javax.swing.JComponent component, java.lang.String propertyName)Checks to see if the property of the given component is bound or not.static booleanisDBBound(javax.swing.JComponent component, java.lang.String propertyName)Checks to see if the property of the given component has a database binding.static booleanisPath(java.lang.String s)Returns true if the string seems to be a path (absolute OR relative).static booleanisPropertyBindable(java.beans.FeatureDescriptor fd)static booleanisPropertyDefined(BindingRoot window, java.lang.String path)static booleanisRelativePath(java.lang.String s)Matches something like "{$...}"static voidmain(java.lang.String[] args)static ExpressionParseContextnewBinder(BindingRoot selectedWindow, TagManager tagManager, TagPath localPath, FunctionFactory funcFactory)static voidpullCurrentValues(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.UseTagPathParserderelativezie(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
-
-