Class DefaultBeanInfo
java.lang.Object
java.beans.SimpleBeanInfo
com.inductiveautomation.vision.api.designer.beans.DefaultBeanInfo
- All Implemented Interfaces:
BeanInfo
- Direct Known Subclasses:
CommonBeanInfo
,FPMIAppBeanInfo
,FPMIWindowBeanInfo
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
FieldsModifier and TypeFieldDescriptionprotected Class
static final int
This flag marks a property as "Bound".static final String
This key is used on a PropertyDescriptor to give it a category.static final int
Not used.static final String
This key is used on a PropertyDescriptor to give an explicit order to properties.static final int
Use this flag to mark a property as expert so that it shows up under the "Expert" and "All" filters.static final int
Use this flag to mark a property that won't be available in the Designer, but will be serialized.protected LoggerEx
static final int
static final String
static final int
Use this flag to mark a property that shouldn't ever be the target of a binding.static final String
static final int
This marks a property as not compatible with the automatic translation system.static final int
Use this flag to mark the property as a preferred property - these are the properties that show up under the "Basic" filter.static final int
Deprecated.Misspelled.static final String
static final int
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
ConstructorsConstructorDescriptionDefaultBeanInfo
(Class c, CustomizerDescriptor... customizerDescriptor) Create a new BeanInfo for teh given class that will use the provided customizers (if any). -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addBoundProp
(String name, String display, String desc, String category) Adds a property that has theBOUND_MASK
flag.protected void
addBoundProp
(String name, String display, String desc, String category, int flags) Adds a property that has theBOUND_MASK
flag, and potentially other flags.protected void
addEnumProp
(String name, String display, String desc, String category, int[] values, String[] names) Adds an "enum property".protected void
addEnumProp
(String name, String display, String desc, String category, int[] values, String[] names, int flags) protected void
addEnumProp
(String name, String display, String desc, String category, Class<? extends Enum> enumClass) Adds an property based upon enum constants.protected void
addEnumProp
(String name, String display, String desc, String category, Class<? extends Enum> enumClass, int flags) protected void
addEventSet
(Class sourceClass, String eventSetName, Class listenerType, Class eventObjectType, 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 void
addEventSet
(Class sourceClass, String eventSetName, Class listenerType, Class eventObjectType, String[] listenerMethodNames, String addListenerMethodName, String removeListenerMethodName, String getListenerMethodName) Overload ofaddEventSet(Class, String, Class, String[])
that has explicit arguments for the event object type and listener names.protected void
addEventSet
(Class sourceClass, String eventSetName, Class listenerType, String listenerMethodName) This overload ofaddEventSet(Class, String, Class, String[])
is used for events that have a single listener method.protected void
addEventSet
(Class sourceClass, String eventSetName, Class listenerType, String[] listenerMethodNames) Adds an "event set" that this bean supports.protected void
addMethod
(MethodDescriptor method) (Bean methods are not used in Ignition)protected void
(Bean methods are not used in Ignition)protected void
(Bean methods are not used in Ignition)protected void
addProp
(PropertyDescriptor prop) Adds the property, appending it to the display order (seeDISPLAY_ORDER_KEY
).protected void
Adds a property to the bean.protected void
Adds a property to the bean.protected void
Adds a property to the bean.protected void
addProp
(String name, String display, String desc, String category, int flags, Class<? extends SwingEditorSupport> customEditor) Adds a property that has a custom editor.protected void
addTransientProp
(String name, String display, String desc, int flags) protected void
addTransientProp
(String name, String display, String desc, String category, int flags) protected void
addTransientProp
(String name, String display, String desc, String category, int flags, Class<? extends SwingEditorSupport> editor) protected PropertyDescriptor
createProp
(String name, String display, String desc, String category) Creates an instance of PropertyDescriptor.protected PropertyDescriptor
createProp
(String name, String display, String desc, String category, int flags) Creates an instance of PropertyDescriptor with flags.protected PropertyDescriptor
createProp
(String name, String display, String desc, String category, int flags, Class<? extends SwingEditorSupport> customEditor) Creates an instanceof a PropertyDescriptor with a custom editor class.protected PropertyDescriptor
findProperty
(String name) Looks up a property by name.final VisionBeanDescriptor
getIcon
(int kind) protected String
protected String
protected String
getIconResource
(int kind) final MethodDescriptor[]
final PropertyDescriptor[]
protected void
initDesc()
Implement this function to initialize the BeanDescriptor.protected void
This is called by the constructor, meant to be overridden by subclasses.protected void
This is called by the constructor, meant to be overridden by subclasses.protected void
This is called by the constructor, meant to be overridden by subclasses.protected void
removeProp
(String name) Removes the property with the given name from this bean info.protected void
Sets the background property (seesetBackgroundProperty(String)
protected void
setBackgroundProperty
(String propName) Sets the background property, used by the eyedropper tool to know what property to set to alter the background.protected void
setFlags
(PropertyDescriptor prop, int flags) Apply the given flags to the property descriptor.protected void
protected void
Sets the foreground property, seesetForegroundProperty(String)
protected void
setForegroundProperty
(String propName) Sets the foreground property, used by the eyedropper tool to know what property to set to alter the foreground.toString()
Methods inherited from class java.beans.SimpleBeanInfo
getAdditionalBeanInfo, getDefaultEventIndex, getDefaultPropertyIndex, loadImage
-
Field Details
-
TRANSIENT_KEY
- See Also:
-
NOT_BINDABLE_KEY
- See Also:
-
NOT_TRANSLATABLE_KEY
- See Also:
-
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:
-
CATEGORY_KEY
This key is used on a PropertyDescriptor to give it a category. The value must be a String.- See Also:
-
NO_MASK
public static final int NO_MASK- See Also:
-
BOUND_MASK
public static final int BOUND_MASKThis 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:
-
CONSTRAINED_MASK
public static final int CONSTRAINED_MASKNot used.- See Also:
-
EXPERT_MASK
public static final int EXPERT_MASKUse this flag to mark a property as expert so that it shows up under the "Expert" and "All" filters.- See Also:
-
HIDDEN_MASK
public static final int HIDDEN_MASKUse this flag to mark a property that won't be available in the Designer, but will be serialized.- See Also:
-
PREFERRED_MASK
public static final int PREFERRED_MASKUse this flag to mark the property as a preferred property - these are the properties that show up under the "Basic" filter.- See Also:
-
PREFFERED_MASK
Deprecated.Misspelled. UsePREFERRED_MASK
- See Also:
-
NOT_TRANSLATABLE_MASK
public static final int NOT_TRANSLATABLE_MASKThis marks a property as not compatible with the automatic translation system.- See Also:
-
TRANSIENT_MASK
public static final int TRANSIENT_MASKUse this flag to mark a property as transient (so it will not be serialized). Equivalent to using theTransient
attribute on the getter and/or setter.- See Also:
-
NOT_BINDABLE_MASK
public static final int NOT_BINDABLE_MASKUse this flag to mark a property that shouldn't ever be the target of a binding.- See Also:
-
beanClass
-
log
-
-
Constructor Details
-
DefaultBeanInfo
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 Details
-
addMethod
protected void addMethod(String name, Class arg, String displayName) throws SecurityException, NoSuchMethodException (Bean methods are not used in Ignition) -
addMethod
protected void addMethod(String name, Class[] args, String displayName) throws SecurityException, NoSuchMethodException (Bean methods are not used in Ignition) -
addMethod
(Bean methods are not used in Ignition) -
createProp
protected PropertyDescriptor createProp(String name, String display, String desc, String category) throws 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:
IntrospectionException
-
createProp
protected PropertyDescriptor createProp(String name, String display, String desc, String category, int flags) throws IntrospectionException Creates an instance of PropertyDescriptor with flags.- Throws:
IntrospectionException
-
createProp
protected PropertyDescriptor createProp(String name, String display, String desc, String category, int flags, Class<? extends SwingEditorSupport> customEditor) throws IntrospectionException Creates an instanceof a PropertyDescriptor with a custom editor class.- Parameters:
customEditor
- The class for the editor for this property.- Throws:
IntrospectionException
-
setFlags
-
setFlags
Apply the given flags to the property descriptor. The following flags are available: -
addBoundProp
protected void addBoundProp(String name, String display, String desc, String category) throws IntrospectionException Adds a property that has theBOUND_MASK
flag.- Throws:
IntrospectionException
-
addBoundProp
protected void addBoundProp(String name, String display, String desc, String category, int flags) throws IntrospectionException Adds a property that has theBOUND_MASK
flag, and potentially other flags.- Throws:
IntrospectionException
-
addProp
protected void addProp(String name, String display, String desc, String category, int flags, Class<? extends SwingEditorSupport> customEditor) throws IntrospectionException Adds a property that has a custom editor.- Throws:
IntrospectionException
-
addProp
protected void addProp(String name, String display, String desc, String category) throws IntrospectionException Adds a property to the bean.- Throws:
IntrospectionException
-
addProp
protected void addProp(String name, String display, String desc, int flags) throws IntrospectionException Adds a property to the bean.- Throws:
IntrospectionException
-
addProp
protected void addProp(String name, String display, String desc, String category, int flags) throws IntrospectionException Adds a property to the bean.- Throws:
IntrospectionException
-
addTransientProp
protected void addTransientProp(String name, String display, String desc, int flags) throws IntrospectionException - Throws:
IntrospectionException
-
addTransientProp
protected void addTransientProp(String name, String display, String desc, String category, int flags) throws IntrospectionException - Throws:
IntrospectionException
-
addTransientProp
protected void addTransientProp(String name, String display, String desc, String category, int flags, Class<? extends SwingEditorSupport> editor) throws IntrospectionException - Throws:
IntrospectionException
-
addProp
Adds the property, appending it to the display order (seeDISPLAY_ORDER_KEY
). This display order will also be used for the order of serialization by default inDescriptorComparator
even if theHIDDEN_MASK
is applied -
removeProp
Removes the property with the given name from this bean info. If the property isn't found, nothing happens. -
findProperty
Looks up a property by name.- Returns:
- The PropertyDescriptor if the property is found, otherwise null
-
setForegroundProperty
Sets the foreground property, used by the eyedropper tool to know what property to set to alter the foreground. -
setForegroundProperty
Sets the foreground property, seesetForegroundProperty(String)
-
setBackgroundProperty
Sets the background property, used by the eyedropper tool to know what property to set to alter the background. -
setBackgroundProperty
Sets the background property (seesetBackgroundProperty(String)
-
addEnumProp
protected void addEnumProp(String name, String display, String desc, String category, int[] values, String[] names) throws 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:
IntrospectionException
-
addEnumProp
protected void addEnumProp(String name, String display, String desc, String category, int[] values, String[] names, int flags) throws IntrospectionException - Throws:
IntrospectionException
-
addEnumProp
protected void addEnumProp(String name, String display, String desc, String category, Class<? extends Enum> enumClass) throws 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:
IntrospectionException
-
addEnumProp
protected void addEnumProp(String name, String display, String desc, String category, Class<? extends Enum> enumClass, int flags) throws IntrospectionException - Throws:
IntrospectionException
-
addEventSet
protected void addEventSet(Class sourceClass, String eventSetName, Class listenerType, String listenerMethodName) throws IntrospectionException This overload ofaddEventSet(Class, String, Class, String[])
is used for events that have a single listener method.- Throws:
IntrospectionException
-
addEventSet
protected void addEventSet(Class sourceClass, String eventSetName, Class listenerType, String[] listenerMethodNames) throws 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:
IntrospectionException
-
addEventSet
protected void addEventSet(Class sourceClass, String eventSetName, Class listenerType, Class eventObjectType, String[] listenerMethodNames) throws IntrospectionException This overload ofaddEventSet(Class, String, Class, String[])
is for when the event object type cannot be derived from the event set name.- Throws:
IntrospectionException
-
addEventSet
protected void addEventSet(Class sourceClass, String eventSetName, Class listenerType, Class eventObjectType, String[] listenerMethodNames, String addListenerMethodName, String removeListenerMethodName, String getListenerMethodName) throws IntrospectionException Overload ofaddEventSet(Class, String, Class, String[])
that has explicit arguments for the event object type and listener names.- Throws:
IntrospectionException
-
initProperties
This is called by the constructor, meant to be overridden by subclasses.- Throws:
IntrospectionException
-
initMethods
This is called by the constructor, meant to be overridden by subclasses. -
initEventSets
This is called by the constructor, meant to be overridden by subclasses.- Throws:
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
- Specified by:
getBeanDescriptor
in interfaceBeanInfo
- Overrides:
getBeanDescriptor
in classSimpleBeanInfo
-
getMethodDescriptors
- Specified by:
getMethodDescriptors
in interfaceBeanInfo
- Overrides:
getMethodDescriptors
in classSimpleBeanInfo
-
getPropertyDescriptors
- Specified by:
getPropertyDescriptors
in interfaceBeanInfo
- Overrides:
getPropertyDescriptors
in classSimpleBeanInfo
-
getEventSetDescriptors
- Specified by:
getEventSetDescriptors
in interfaceBeanInfo
- Overrides:
getEventSetDescriptors
in classSimpleBeanInfo
-
getIcon
- Specified by:
getIcon
in interfaceBeanInfo
- Overrides:
getIcon
in classSimpleBeanInfo
-
getIconResource
-
getIconPath
-
getIconPrefix
-
toString
-