Class DefaultBeanInfo
- java.lang.Object
-
- java.beans.SimpleBeanInfo
-
- com.inductiveautomation.vision.api.designer.beans.DefaultBeanInfo
-
- All Implemented Interfaces:
java.beans.BeanInfo
- Direct Known Subclasses:
CommonBeanInfo,FPMIAppBeanInfo,FPMIWindowBeanInfo
public class DefaultBeanInfo extends java.beans.SimpleBeanInfoA 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 ofCommonBeanInfo.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.ClassbeanClassstatic intBOUND_MASKThis flag marks a property as "Bound".static java.lang.StringCATEGORY_KEYThis key is used on a PropertyDescriptor to give it a category.static intCONSTRAINED_MASKNot used.static java.lang.StringDISPLAY_ORDER_KEYThis key is used on a PropertyDescriptor to give an explicit order to properties.static intEXPERT_MASKUse this flag to mark a property as expert so that it shows up under the "Expert" and "All" filters.static intHIDDEN_MASKUse this flag to mark a property that won't be available in the Designer, but will be serialized.protected LoggerExlogstatic intNO_MASKstatic java.lang.StringNOT_BINDABLE_KEYstatic intNOT_BINDABLE_MASKUse this flag to mark a property that shouldn't ever be the target of a binding.static java.lang.StringNOT_TRANSLATABLE_KEYstatic intNOT_TRANSLATABLE_MASKThis marks a property as not compatible with the automatic translation system.static intPREFERRED_MASKUse this flag to mark the property as a preferred property - these are the properties that show up under the "Basic" filter.static intPREFFERED_MASKDeprecated.Misspelled.static java.lang.StringTRANSIENT_KEYstatic intTRANSIENT_MASKUse this flag to mark a property as transient (so it will not be serialized).
-
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 voidaddBoundProp(java.lang.String name, java.lang.String display, java.lang.String desc, java.lang.String category)Adds a property that has theBOUND_MASKflag.protected voidaddBoundProp(java.lang.String name, java.lang.String display, java.lang.String desc, java.lang.String category, int flags)Adds a property that has theBOUND_MASKflag, and potentially other flags.protected voidaddEnumProp(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 voidaddEnumProp(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 voidaddEnumProp(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 voidaddEnumProp(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 voidaddEventSet(java.lang.Class sourceClass, java.lang.String eventSetName, java.lang.Class listenerType, java.lang.Class eventObjectType, java.lang.String[] listenerMethodNames)This overload ofaddEventSet(Class, String, Class, String[])is for when the event object type cannot be derived from the event set name.protected voidaddEventSet(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 ofaddEventSet(Class, String, Class, String[])that has explicit arguments for the event object type and listener names.protected voidaddEventSet(java.lang.Class sourceClass, java.lang.String eventSetName, java.lang.Class listenerType, java.lang.String listenerMethodName)This overload ofaddEventSet(Class, String, Class, String[])is used for events that have a single listener method.protected voidaddEventSet(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 voidaddMethod(java.beans.MethodDescriptor method)(Bean methods are not used in Ignition)protected voidaddMethod(java.lang.String name, java.lang.Class[] args, java.lang.String displayName)(Bean methods are not used in Ignition)protected voidaddMethod(java.lang.String name, java.lang.Class arg, java.lang.String displayName)(Bean methods are not used in Ignition)protected voidaddProp(java.beans.PropertyDescriptor prop)protected voidaddProp(java.lang.String name, java.lang.String display, java.lang.String desc, int flags)Adds a property to the bean.protected voidaddProp(java.lang.String name, java.lang.String display, java.lang.String desc, java.lang.String category)Adds a property to the bean.protected voidaddProp(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 voidaddProp(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 voidaddTransientProp(java.lang.String name, java.lang.String display, java.lang.String desc, int flags)protected voidaddTransientProp(java.lang.String name, java.lang.String display, java.lang.String desc, java.lang.String category, int flags)protected voidaddTransientProp(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.PropertyDescriptorcreateProp(java.lang.String name, java.lang.String display, java.lang.String desc, java.lang.String category)Creates an instance of PropertyDescriptor.protected java.beans.PropertyDescriptorcreateProp(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.PropertyDescriptorcreateProp(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.PropertyDescriptorfindProperty(java.lang.String name)Looks up a property by name.VisionBeanDescriptorgetBeanDescriptor()java.beans.EventSetDescriptor[]getEventSetDescriptors()java.awt.ImagegetIcon(int kind)protected java.lang.StringgetIconPath()protected java.lang.StringgetIconPrefix()protected java.lang.StringgetIconResource(int kind)java.beans.MethodDescriptor[]getMethodDescriptors()java.beans.PropertyDescriptor[]getPropertyDescriptors()protected voidinitDesc()Implement this function to initialize the BeanDescriptor.protected voidinitEventSets()This is called by the constructor, meant to be overridden by subclasses.protected voidinitMethods()This is called by the constructor, meant to be overridden by subclasses.protected voidinitProperties()This is called by the constructor, meant to be overridden by subclasses.protected voidremoveProp(java.lang.String name)Removes the property with the given name from this bean info.protected voidsetBackgroundProperty(java.beans.PropertyDescriptor prop)Sets the background property (seesetBackgroundProperty(String)protected voidsetBackgroundProperty(java.lang.String propName)Sets the background property, used by the eyedropper tool to know what property to set to alter the background.protected voidsetFlags(java.beans.PropertyDescriptor prop, int flags)Apply the given flags to the property descriptor.protected voidsetFlags(java.lang.String propName, int flags)protected voidsetForegroundProperty(java.beans.PropertyDescriptor prop)Sets the foreground property, seesetForegroundProperty(String)protected voidsetForegroundProperty(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.StringtoString()
-
-
-
Field Detail
-
TRANSIENT_KEY
public static final java.lang.String TRANSIENT_KEY
- See Also:
- Constant Field Values
-
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. TheaddProp(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
-
NO_MASK
public static final int NO_MASK
- 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
-
CONSTRAINED_MASK
public static final int CONSTRAINED_MASK
Not used.- 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
-
PREFFERED_MASK
@Deprecated public static final int PREFFERED_MASK
Deprecated.Misspelled. UsePREFERRED_MASK- 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 theTransientattribute 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
-
log
protected LoggerEx log
-
-
Constructor Detail
-
DefaultBeanInfo
public DefaultBeanInfo(java.lang.Class c, CustomizerDescriptor... customizerDescriptor)Create a new BeanInfo for teh given class that will use the provided customizers (if any). This constructor will call the following protected methods which are assumed to have been overridden:
-
-
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.SecurityExceptionjava.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.SecurityExceptionjava.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.IntrospectionExceptionCreates 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.IntrospectionExceptionCreates 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.IntrospectionExceptionCreates 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)
-
setFlags
protected void setFlags(java.beans.PropertyDescriptor prop, int flags)Apply the given flags to the property descriptor. The following flags are available:
-
addBoundProp
protected void addBoundProp(java.lang.String name, java.lang.String display, java.lang.String desc, java.lang.String category) throws java.beans.IntrospectionExceptionAdds a property that has theBOUND_MASKflag.- 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.IntrospectionExceptionAdds a property that has theBOUND_MASKflag, 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.IntrospectionExceptionAdds 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.IntrospectionExceptionAdds 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.IntrospectionExceptionAdds 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.IntrospectionExceptionAdds 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, seesetForegroundProperty(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 (seesetBackgroundProperty(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.IntrospectionExceptionAdds 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.IntrospectionExceptionAdds 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.IntrospectionExceptionThis overload ofaddEventSet(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.IntrospectionExceptionAdds 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.IntrospectionExceptionThis overload ofaddEventSet(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.IntrospectionExceptionOverload ofaddEventSet(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.IntrospectionExceptionThis 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.NoSuchMethodExceptionThis is called by the constructor, meant to be overridden by subclasses.- Throws:
java.lang.SecurityExceptionjava.lang.NoSuchMethodException
-
initEventSets
protected void initEventSets() throws java.beans.IntrospectionExceptionThis 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. UsegetBeanDescriptor()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:
getBeanDescriptorin interfacejava.beans.BeanInfo- Overrides:
getBeanDescriptorin classjava.beans.SimpleBeanInfo
-
getMethodDescriptors
public final java.beans.MethodDescriptor[] getMethodDescriptors()
- Specified by:
getMethodDescriptorsin interfacejava.beans.BeanInfo- Overrides:
getMethodDescriptorsin classjava.beans.SimpleBeanInfo
-
getPropertyDescriptors
public final java.beans.PropertyDescriptor[] getPropertyDescriptors()
- Specified by:
getPropertyDescriptorsin interfacejava.beans.BeanInfo- Overrides:
getPropertyDescriptorsin classjava.beans.SimpleBeanInfo
-
getEventSetDescriptors
public java.beans.EventSetDescriptor[] getEventSetDescriptors()
- Specified by:
getEventSetDescriptorsin interfacejava.beans.BeanInfo- Overrides:
getEventSetDescriptorsin classjava.beans.SimpleBeanInfo
-
getIcon
public java.awt.Image getIcon(int kind)
- Specified by:
getIconin interfacejava.beans.BeanInfo- Overrides:
getIconin classjava.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:
toStringin classjava.lang.Object
-
-