Class BindUtilities


  • public class BindUtilities
    extends java.lang.Object
    Contains various static functions used to create bindings
    • Constructor Detail

      • BindUtilities

        public BindUtilities()
    • Method Detail

      • 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.
      • 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 property
        onlyBindable - 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