Class DefaultBeanInfo

  • All Implemented Interfaces:
    java.beans.BeanInfo
    Direct Known Subclasses:
    CommonBeanInfo, FPMIAppBeanInfo, FPMIWindowBeanInfo

    public class DefaultBeanInfo
    extends java.beans.SimpleBeanInfo
    A BeanInfo is part of the JavaBean spec - it is a class that describes a visual bean. This BeanInfo is the root class for bean infos in the Vision system. Note: Most BeanInfos implementations will actually be a subclass of CommonBeanInfo.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.Class beanClass  
      static int BOUND_MASK
      This flag marks a property as "Bound".
      static java.lang.String CATEGORY_KEY
      This key is used on a PropertyDescriptor to give it a category.
      static int CONSTRAINED_MASK
      Not used.
      static java.lang.String DISPLAY_ORDER_KEY
      This key is used on a PropertyDescriptor to give an explicit order to properties.
      static int EXPERT_MASK
      Use this flag to mark a property as expert so that it shows up under the "Expert" and "All" filters.
      static int HIDDEN_MASK
      Use this flag to mark a property that won't be available in the Designer, but will be serialized.
      protected LoggerEx log  
      static int NO_MASK  
      static java.lang.String NOT_BINDABLE_KEY  
      static int NOT_BINDABLE_MASK
      Use this flag to mark a property that shouldn't ever be the target of a binding.
      static java.lang.String NOT_TRANSLATABLE_KEY  
      static int NOT_TRANSLATABLE_MASK
      This marks a property as not compatible with the automatic translation system.
      static int PREFERRED_MASK
      Use this flag to mark the property as a preferred property - these are the properties that show up under the "Basic" filter.
      static int PREFFERED_MASK
      Deprecated.
      Misspelled.
      static java.lang.String TRANSIENT_KEY  
      static int TRANSIENT_MASK
      Use this flag to mark a property as transient (so it will not be serialized).
      • Fields inherited from interface java.beans.BeanInfo

        ICON_COLOR_16x16, ICON_COLOR_32x32, ICON_MONO_16x16, ICON_MONO_32x32
    • Constructor Summary

      Constructors 
      Constructor Description
      DefaultBeanInfo​(java.lang.Class c, CustomizerDescriptor... customizerDescriptor)
      Create a new BeanInfo for teh given class that will use the provided customizers (if any).
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void addBoundProp​(java.lang.String name, java.lang.String display, java.lang.String desc, java.lang.String category)
      Adds a property that has the BOUND_MASK flag.
      protected void addBoundProp​(java.lang.String name, java.lang.String display, java.lang.String desc, java.lang.String category, int flags)
      Adds a property that has the BOUND_MASK flag, and potentially other flags.
      protected void addEnumProp​(java.lang.String name, java.lang.String display, java.lang.String desc, java.lang.String category, int[] values, java.lang.String[] names)
      Adds an "enum property".
      protected void addEnumProp​(java.lang.String name, java.lang.String display, java.lang.String desc, java.lang.String category, int[] values, java.lang.String[] names, int flags)  
      protected void addEnumProp​(java.lang.String name, java.lang.String display, java.lang.String desc, java.lang.String category, java.lang.Class<? extends java.lang.Enum> enumClass)
      Adds an property based upon enum constants.
      protected void addEnumProp​(java.lang.String name, java.lang.String display, java.lang.String desc, java.lang.String category, java.lang.Class<? extends java.lang.Enum> enumClass, int flags)  
      protected void addEventSet​(java.lang.Class sourceClass, java.lang.String eventSetName, java.lang.Class listenerType, java.lang.Class eventObjectType, java.lang.String[] listenerMethodNames)
      This overload of addEventSet(Class, String, Class, String[]) is for when the event object type cannot be derived from the event set name.
      protected void addEventSet​(java.lang.Class sourceClass, java.lang.String eventSetName, java.lang.Class listenerType, java.lang.Class eventObjectType, java.lang.String[] listenerMethodNames, java.lang.String addListenerMethodName, java.lang.String removeListenerMethodName, java.lang.String getListenerMethodName)
      Overload of addEventSet(Class, String, Class, String[]) that has explicit arguments for the event object type and listener names.
      protected void addEventSet​(java.lang.Class sourceClass, java.lang.String eventSetName, java.lang.Class listenerType, java.lang.String listenerMethodName)
      This overload of addEventSet(Class, String, Class, String[]) is used for events that have a single listener method.
      protected void addEventSet​(java.lang.Class sourceClass, java.lang.String eventSetName, java.lang.Class listenerType, java.lang.String[] listenerMethodNames)
      Adds an "event set" that this bean supports.
      protected void addMethod​(java.beans.MethodDescriptor method)
      (Bean methods are not used in Ignition)
      protected void addMethod​(java.lang.String name, java.lang.Class[] args, java.lang.String displayName)
      (Bean methods are not used in Ignition)
      protected void addMethod​(java.lang.String name, java.lang.Class arg, java.lang.String displayName)
      (Bean methods are not used in Ignition)
      protected void addProp​(java.beans.PropertyDescriptor prop)  
      protected void addProp​(java.lang.String name, java.lang.String display, java.lang.String desc, int flags)
      Adds a property to the bean.
      protected void addProp​(java.lang.String name, java.lang.String display, java.lang.String desc, java.lang.String category)
      Adds a property to the bean.
      protected void addProp​(java.lang.String name, java.lang.String display, java.lang.String desc, java.lang.String category, int flags)
      Adds a property to the bean.
      protected void addProp​(java.lang.String name, java.lang.String display, java.lang.String desc, java.lang.String category, int flags, java.lang.Class<? extends SwingEditorSupport> customEditor)
      Adds a property that has a custom editor.
      protected void addTransientProp​(java.lang.String name, java.lang.String display, java.lang.String desc, int flags)  
      protected void addTransientProp​(java.lang.String name, java.lang.String display, java.lang.String desc, java.lang.String category, int flags)  
      protected void addTransientProp​(java.lang.String name, java.lang.String display, java.lang.String desc, java.lang.String category, int flags, java.lang.Class<? extends SwingEditorSupport> editor)  
      protected java.beans.PropertyDescriptor createProp​(java.lang.String name, java.lang.String display, java.lang.String desc, java.lang.String category)
      Creates an instance of PropertyDescriptor.
      protected java.beans.PropertyDescriptor createProp​(java.lang.String name, java.lang.String display, java.lang.String desc, java.lang.String category, int flags)
      Creates an instance of PropertyDescriptor with flags.
      protected java.beans.PropertyDescriptor createProp​(java.lang.String name, java.lang.String display, java.lang.String desc, java.lang.String category, int flags, java.lang.Class<? extends SwingEditorSupport> customEditor)
      Creates an instanceof a PropertyDescriptor with a custom editor class.
      protected java.beans.PropertyDescriptor findProperty​(java.lang.String name)
      Looks up a property by name.
      VisionBeanDescriptor getBeanDescriptor()  
      java.beans.EventSetDescriptor[] getEventSetDescriptors()  
      java.awt.Image getIcon​(int kind)  
      protected java.lang.String getIconPath()  
      protected java.lang.String getIconPrefix()  
      protected java.lang.String getIconResource​(int kind)  
      java.beans.MethodDescriptor[] getMethodDescriptors()  
      java.beans.PropertyDescriptor[] getPropertyDescriptors()  
      protected void initDesc()
      Implement this function to initialize the BeanDescriptor.
      protected void initEventSets()
      This is called by the constructor, meant to be overridden by subclasses.
      protected void initMethods()
      This is called by the constructor, meant to be overridden by subclasses.
      protected void initProperties()
      This is called by the constructor, meant to be overridden by subclasses.
      protected void removeProp​(java.lang.String name)
      Removes the property with the given name from this bean info.
      protected void setBackgroundProperty​(java.beans.PropertyDescriptor prop)
      Sets the background property (see setBackgroundProperty(String)
      protected void setBackgroundProperty​(java.lang.String propName)
      Sets the background property, used by the eyedropper tool to know what property to set to alter the background.
      protected void setFlags​(java.beans.PropertyDescriptor prop, int flags)
      Apply the given flags to the property descriptor.
      protected void setFlags​(java.lang.String propName, int flags)  
      protected void setForegroundProperty​(java.beans.PropertyDescriptor prop)
      Sets the foreground property, see setForegroundProperty(String)
      protected void setForegroundProperty​(java.lang.String propName)
      Sets the foreground property, used by the eyedropper tool to know what property to set to alter the foreground.
      java.lang.String toString()  
      • Methods inherited from class java.beans.SimpleBeanInfo

        getAdditionalBeanInfo, getDefaultEventIndex, getDefaultPropertyIndex, loadImage
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • NOT_BINDABLE_KEY

        public static final java.lang.String NOT_BINDABLE_KEY
        See Also:
        Constant Field Values
      • NOT_TRANSLATABLE_KEY

        public static final java.lang.String NOT_TRANSLATABLE_KEY
        See Also:
        Constant Field Values
      • DISPLAY_ORDER_KEY

        public static final java.lang.String DISPLAY_ORDER_KEY
        This key is used on a PropertyDescriptor to give an explicit order to properties. The value must be an Integer. The addProp(PropertyDescriptor) method automatically adds a display order to the property.
        See Also:
        Constant Field Values
      • CATEGORY_KEY

        public static final java.lang.String CATEGORY_KEY
        This key is used on a PropertyDescriptor to give it a category. The value must be a String.
        See Also:
        Constant Field Values
      • BOUND_MASK

        public static final int BOUND_MASK
        This flag marks a property as "Bound". This means that the component will fire PropertyChangeEvents whenever this property changes. This makes the property available for other bindings via property bindings and expression bindings. It does not mean that the property can have bindings on it. That's true for all properties of supported types.
        See Also:
        Constant Field Values
      • EXPERT_MASK

        public static final int EXPERT_MASK
        Use this flag to mark a property as expert so that it shows up under the "Expert" and "All" filters.
        See Also:
        Constant Field Values
      • HIDDEN_MASK

        public static final int HIDDEN_MASK
        Use this flag to mark a property that won't be available in the Designer, but will be serialized.
        See Also:
        Constant Field Values
      • PREFERRED_MASK

        public static final int PREFERRED_MASK
        Use this flag to mark the property as a preferred property - these are the properties that show up under the "Basic" filter.
        See Also:
        Constant Field Values
      • NOT_TRANSLATABLE_MASK

        public static final int NOT_TRANSLATABLE_MASK
        This marks a property as not compatible with the automatic translation system.
        See Also:
        Constant Field Values
      • TRANSIENT_MASK

        public static final int TRANSIENT_MASK
        Use this flag to mark a property as transient (so it will not be serialized). Equivalent to using the Transient attribute on the getter and/or setter.
        See Also:
        Constant Field Values
      • NOT_BINDABLE_MASK

        public static final int NOT_BINDABLE_MASK
        Use this flag to mark a property that shouldn't ever be the target of a binding.
        See Also:
        Constant Field Values
      • beanClass

        protected java.lang.Class beanClass
    • Constructor Detail

    • Method Detail

      • addMethod

        protected void addMethod​(java.lang.String name,
                                 java.lang.Class arg,
                                 java.lang.String displayName)
                          throws java.lang.SecurityException,
                                 java.lang.NoSuchMethodException
        (Bean methods are not used in Ignition)
        Throws:
        java.lang.SecurityException
        java.lang.NoSuchMethodException
      • addMethod

        protected void addMethod​(java.lang.String name,
                                 java.lang.Class[] args,
                                 java.lang.String displayName)
                          throws java.lang.SecurityException,
                                 java.lang.NoSuchMethodException
        (Bean methods are not used in Ignition)
        Throws:
        java.lang.SecurityException
        java.lang.NoSuchMethodException
      • addMethod

        protected void addMethod​(java.beans.MethodDescriptor method)
        (Bean methods are not used in Ignition)
      • createProp

        protected java.beans.PropertyDescriptor createProp​(java.lang.String name,
                                                           java.lang.String display,
                                                           java.lang.String desc,
                                                           java.lang.String category)
                                                    throws java.beans.IntrospectionException
        Creates an instance of PropertyDescriptor.
        Parameters:
        name - The name of the property. Must match the getter/setter in the bean class.
        display - The display name of the Property.
        desc - A description of the property.
        category - The category for the property.
        Returns:
        A new PropertyDescriptor instance.
        Throws:
        java.beans.IntrospectionException
      • createProp

        protected java.beans.PropertyDescriptor createProp​(java.lang.String name,
                                                           java.lang.String display,
                                                           java.lang.String desc,
                                                           java.lang.String category,
                                                           int flags)
                                                    throws java.beans.IntrospectionException
        Creates an instance of PropertyDescriptor with flags.
        Throws:
        java.beans.IntrospectionException
      • createProp

        protected java.beans.PropertyDescriptor createProp​(java.lang.String name,
                                                           java.lang.String display,
                                                           java.lang.String desc,
                                                           java.lang.String category,
                                                           int flags,
                                                           java.lang.Class<? extends SwingEditorSupport> customEditor)
                                                    throws java.beans.IntrospectionException
        Creates an instanceof a PropertyDescriptor with a custom editor class.
        Parameters:
        customEditor - The class for the editor for this property.
        Throws:
        java.beans.IntrospectionException
      • setFlags

        protected void setFlags​(java.lang.String propName,
                                int flags)
      • addBoundProp

        protected void addBoundProp​(java.lang.String name,
                                    java.lang.String display,
                                    java.lang.String desc,
                                    java.lang.String category)
                             throws java.beans.IntrospectionException
        Adds a property that has the BOUND_MASK flag.
        Throws:
        java.beans.IntrospectionException
      • addBoundProp

        protected void addBoundProp​(java.lang.String name,
                                    java.lang.String display,
                                    java.lang.String desc,
                                    java.lang.String category,
                                    int flags)
                             throws java.beans.IntrospectionException
        Adds a property that has the BOUND_MASK flag, and potentially other flags.
        Throws:
        java.beans.IntrospectionException
      • addProp

        protected void addProp​(java.lang.String name,
                               java.lang.String display,
                               java.lang.String desc,
                               java.lang.String category,
                               int flags,
                               java.lang.Class<? extends SwingEditorSupport> customEditor)
                        throws java.beans.IntrospectionException
        Adds a property that has a custom editor.
        Throws:
        java.beans.IntrospectionException
      • addProp

        protected void addProp​(java.lang.String name,
                               java.lang.String display,
                               java.lang.String desc,
                               java.lang.String category)
                        throws java.beans.IntrospectionException
        Adds a property to the bean.
        Throws:
        java.beans.IntrospectionException
      • addProp

        protected void addProp​(java.lang.String name,
                               java.lang.String display,
                               java.lang.String desc,
                               int flags)
                        throws java.beans.IntrospectionException
        Adds a property to the bean.
        Throws:
        java.beans.IntrospectionException
      • addProp

        protected void addProp​(java.lang.String name,
                               java.lang.String display,
                               java.lang.String desc,
                               java.lang.String category,
                               int flags)
                        throws java.beans.IntrospectionException
        Adds a property to the bean.
        Throws:
        java.beans.IntrospectionException
      • addTransientProp

        protected void addTransientProp​(java.lang.String name,
                                        java.lang.String display,
                                        java.lang.String desc,
                                        int flags)
                                 throws java.beans.IntrospectionException
        Throws:
        java.beans.IntrospectionException
      • addTransientProp

        protected void addTransientProp​(java.lang.String name,
                                        java.lang.String display,
                                        java.lang.String desc,
                                        java.lang.String category,
                                        int flags)
                                 throws java.beans.IntrospectionException
        Throws:
        java.beans.IntrospectionException
      • addTransientProp

        protected void addTransientProp​(java.lang.String name,
                                        java.lang.String display,
                                        java.lang.String desc,
                                        java.lang.String category,
                                        int flags,
                                        java.lang.Class<? extends SwingEditorSupport> editor)
                                 throws java.beans.IntrospectionException
        Throws:
        java.beans.IntrospectionException
      • addProp

        protected void addProp​(java.beans.PropertyDescriptor prop)
      • removeProp

        protected void removeProp​(java.lang.String name)
        Removes the property with the given name from this bean info. If the property isn't found, nothing happens.
      • findProperty

        protected java.beans.PropertyDescriptor findProperty​(java.lang.String name)
        Looks up a property by name.
        Returns:
        The PropertyDescriptor if the property is found, otherwise null
      • setForegroundProperty

        protected void setForegroundProperty​(java.lang.String propName)
        Sets the foreground property, used by the eyedropper tool to know what property to set to alter the foreground.
      • setForegroundProperty

        protected void setForegroundProperty​(java.beans.PropertyDescriptor prop)
        Sets the foreground property, see setForegroundProperty(String)
      • setBackgroundProperty

        protected void setBackgroundProperty​(java.lang.String propName)
        Sets the background property, used by the eyedropper tool to know what property to set to alter the background.
      • setBackgroundProperty

        protected void setBackgroundProperty​(java.beans.PropertyDescriptor prop)
        Sets the background property (see setBackgroundProperty(String)
      • addEnumProp

        protected void addEnumProp​(java.lang.String name,
                                   java.lang.String display,
                                   java.lang.String desc,
                                   java.lang.String category,
                                   int[] values,
                                   java.lang.String[] names)
                            throws java.beans.IntrospectionException
        Adds an "enum property". This is an integer-typed property whose value should be one of a fixed set of named values. The values and names are added here, and will be presented as a pick-list in the Designer.
        Parameters:
        values - The list of acceptable values for this property.
        names - The names of the acceptable values, must match-up with the values in values
        Throws:
        java.beans.IntrospectionException
      • addEnumProp

        protected void addEnumProp​(java.lang.String name,
                                   java.lang.String display,
                                   java.lang.String desc,
                                   java.lang.String category,
                                   int[] values,
                                   java.lang.String[] names,
                                   int flags)
                            throws java.beans.IntrospectionException
        Throws:
        java.beans.IntrospectionException
      • addEnumProp

        protected void addEnumProp​(java.lang.String name,
                                   java.lang.String display,
                                   java.lang.String desc,
                                   java.lang.String category,
                                   java.lang.Class<? extends java.lang.Enum> enumClass)
                            throws java.beans.IntrospectionException
        Adds an property based upon enum constants. Note: this value must still be an integer, but the int values and display values for the acceptable values will be derived from the enum
        Throws:
        java.beans.IntrospectionException
      • addEnumProp

        protected void addEnumProp​(java.lang.String name,
                                   java.lang.String display,
                                   java.lang.String desc,
                                   java.lang.String category,
                                   java.lang.Class<? extends java.lang.Enum> enumClass,
                                   int flags)
                            throws java.beans.IntrospectionException
        Throws:
        java.beans.IntrospectionException
      • addEventSet

        protected void addEventSet​(java.lang.Class sourceClass,
                                   java.lang.String eventSetName,
                                   java.lang.Class listenerType,
                                   java.lang.String listenerMethodName)
                            throws java.beans.IntrospectionException
        This overload of addEventSet(Class, String, Class, String[]) is used for events that have a single listener method.
        Throws:
        java.beans.IntrospectionException
      • addEventSet

        protected void addEventSet​(java.lang.Class sourceClass,
                                   java.lang.String eventSetName,
                                   java.lang.Class listenerType,
                                   java.lang.String[] listenerMethodNames)
                            throws java.beans.IntrospectionException

        Adds an "event set" that this bean supports. An event set is a set of events that will be fired and the corresponding add/remove listener methods that must be present on the bean. By adding event sets, users will be able to respond to those events using scripting.

        For example, if a component wanted to advertise that it throws focus events, it would do this in it's BeanInfo's implementation of initEventSets():

         addEventSet(Component.class, "focus", 
         FocusListener.class, new String[] { "focusGained", "focusLost" });
         

        Parameters:
        sourceClass - The class where the add/remove listener functions are declared. Not necessarily your class, maybe Component or some other superclass.
        eventSetName - The name of the event, such that the add/remove listener names can be derived as "addEventSetNameListener" and "removeEventSetNameListener". (the first letter will be capitalized for you).
        listenerType - The type of the listener for this event (e.g. FocusListener)
        listenerMethodNames - The names of the methods called on the a listener (e.g. {"focusGained", "focusList"})
        Throws:
        java.beans.IntrospectionException
      • addEventSet

        protected void addEventSet​(java.lang.Class sourceClass,
                                   java.lang.String eventSetName,
                                   java.lang.Class listenerType,
                                   java.lang.Class eventObjectType,
                                   java.lang.String[] listenerMethodNames)
                            throws java.beans.IntrospectionException
        This overload of addEventSet(Class, String, Class, String[]) is for when the event object type cannot be derived from the event set name.
        Throws:
        java.beans.IntrospectionException
      • addEventSet

        protected void addEventSet​(java.lang.Class sourceClass,
                                   java.lang.String eventSetName,
                                   java.lang.Class listenerType,
                                   java.lang.Class eventObjectType,
                                   java.lang.String[] listenerMethodNames,
                                   java.lang.String addListenerMethodName,
                                   java.lang.String removeListenerMethodName,
                                   java.lang.String getListenerMethodName)
                            throws java.beans.IntrospectionException
        Overload of addEventSet(Class, String, Class, String[]) that has explicit arguments for the event object type and listener names.
        Throws:
        java.beans.IntrospectionException
      • initProperties

        protected void initProperties()
                               throws java.beans.IntrospectionException
        This is called by the constructor, meant to be overridden by subclasses.
        Throws:
        java.beans.IntrospectionException
      • initMethods

        protected void initMethods()
                            throws java.lang.SecurityException,
                                   java.lang.NoSuchMethodException
        This is called by the constructor, meant to be overridden by subclasses.
        Throws:
        java.lang.SecurityException
        java.lang.NoSuchMethodException
      • initEventSets

        protected void initEventSets()
                              throws java.beans.IntrospectionException
        This is called by the constructor, meant to be overridden by subclasses.
        Throws:
        java.beans.IntrospectionException
      • initDesc

        protected void initDesc()
        Implement this function to initialize the BeanDescriptor. Use getBeanDescriptor() to find the bean descriptor and set it's meta props to be appropriate values for this bean.
      • getBeanDescriptor

        public final VisionBeanDescriptor getBeanDescriptor()
        Specified by:
        getBeanDescriptor in interface java.beans.BeanInfo
        Overrides:
        getBeanDescriptor in class java.beans.SimpleBeanInfo
      • getMethodDescriptors

        public final java.beans.MethodDescriptor[] getMethodDescriptors()
        Specified by:
        getMethodDescriptors in interface java.beans.BeanInfo
        Overrides:
        getMethodDescriptors in class java.beans.SimpleBeanInfo
      • getPropertyDescriptors

        public final java.beans.PropertyDescriptor[] getPropertyDescriptors()
        Specified by:
        getPropertyDescriptors in interface java.beans.BeanInfo
        Overrides:
        getPropertyDescriptors in class java.beans.SimpleBeanInfo
      • getEventSetDescriptors

        public java.beans.EventSetDescriptor[] getEventSetDescriptors()
        Specified by:
        getEventSetDescriptors in interface java.beans.BeanInfo
        Overrides:
        getEventSetDescriptors in class java.beans.SimpleBeanInfo
      • getIcon

        public java.awt.Image getIcon​(int kind)
        Specified by:
        getIcon in interface java.beans.BeanInfo
        Overrides:
        getIcon in class java.beans.SimpleBeanInfo
      • getIconResource

        protected java.lang.String getIconResource​(int kind)
      • getIconPath

        protected java.lang.String getIconPath()
      • getIconPrefix

        protected java.lang.String getIconPrefix()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object