Package com.jformdesigner.annotations
Annotation Type BeanInfo
-
@Target(TYPE) @Retention(RUNTIME) public @interface BeanInfo
This annotation can be used to specify additional information for constructing aBeanInfoclass and itsBeanDescriptor.JFormDesigner first uses
Introspector.getBeanInfo(Class)to construct aBeanInfoand then applies changes specified in annotations to copies of theBeanInfo,BeanDescriptorandPropertyDescriptors.Example:
@BeanInfo( description="My Bean", icon="MyBean.gif", properties={ @PropertyDesc(name="magnitude", displayName="magnitude (in %)", preferred=true) @PropertyDesc(name="enabled", expert=true) }, categories={ @Category(name="Sizes", properties={"preferredSize", "minimumSize", "maximumSize"}), @Category(name="Colors", properties={"background", "foreground"}), } ) public class MyBean extends JCompoment { ... }Example:@BeanInfo(isContainer=true,containerDelegate="getContentPane") public class MyPanel extends JPanel { ... }
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description BeanInfo.Attribute[]attributesSpecifies additional named attributes for theBeanDescriptor.BeanInfo.Category[]categoriesSpecifies categories for grouping properties in the JFormDesigner Properties view.StringcontainerDelegateIf components should be added to a descendant of a container, then it is possible to specify a method that returns the container for the children.Class<? extends Customizer>customizerSpecifies the bean's customizer.StringdescriptionDescription of the JavaBean.StringiconResource name of a 16x16 color icon of the JavaBean.booleanisContainerSpecifies whether a component is a container or not.String[]persistenceConstructorPropertiesSpecifies the property names for aDefaultPersistenceDelegate(String[])used to persist an instance of the annotated class.Class<? extends PersistenceDelegate>persistenceDelegateSpecifies the persistence delegate used to persist an instance of the annotated class.PropertyDesc[]propertiesSpecifies property descriptors.
-
-
-
Element Detail
-
description
String description
Description of the JavaBean.Used in the JFormDesigner Palette to display descriptions of beans in tooltips.
- Default:
- ""
-
-
-
icon
String icon
Resource name of a 16x16 color icon of the JavaBean. If the name starts with "/", it is an absolute resource name. Otherwise it is relative to the package of the JavaBean.JFormDesigner uses
beanClass.getResource(icon)to locate the icon file.- Default:
- ""
-
-
-
customizer
Class<? extends Customizer> customizer
Specifies the bean's customizer. A customizer provides a complete GUI for customizing a target JavaBean. A customizer must implementCustomizerand inherit fromComponentso it can be instantiated inside an dialog.- Default:
- java.beans.Customizer.class
-
-
-
containerDelegate
String containerDelegate
If components should be added to a descendant of a container, then it is possible to specify a method that returns the container for the children.JFrame.getContentPane()is an example for such a method. The value must be a String and specifies the name of a method that takes no parameters and returns aContainer.- Default:
- ""
-
-
-
properties
PropertyDesc[] properties
Specifies property descriptors. SeePropertyDescfor details. Example:@BeanInfo( properties={ @PropertyDesc(name="magnitude", displayName="magnitude (in %)", preferred=true), @PropertyDesc(name="enabled", expert=true) } ) public class MyBean extends JCompoment { ... }This attribute can be used to modify property descriptors of super classes without overriding property getter or setter methods.- Default:
- {}
-
-
-
categories
BeanInfo.Category[] categories
Specifies categories for grouping properties in the JFormDesigner Properties view. SeeBeanInfo.Categoryfor details.- Default:
- {}
-
-
-
persistenceConstructorProperties
String[] persistenceConstructorProperties
Specifies the property names for aDefaultPersistenceDelegate(String[])used to persist an instance of the annotated class. The annotated class must have a constructor that accepts the given properties. Only necessary for classes that are not JavaBeans.Used by JFormDesigner to encode/decode the property value to XML.
Example:
@BeanInfo(persistenceConstructorProperties={"value1", "value2"}) public class MyImmutablePropertyData { private final String value1; private final String value2; public MyImmutablePropertyData( String value1, String value2 ) { this.value1 = value1; this.value2 = value2; } public String getValue1() { return value1; } public String getValue2() { return value2; } }- Default:
- {}
-
-
-
persistenceDelegate
Class<? extends PersistenceDelegate> persistenceDelegate
Specifies the persistence delegate used to persist an instance of the annotated class. Only necessary for classes that are not JavaBeans. IfpersistenceConstructorProperties()is specified, then this attribute is ignored.Used by JFormDesigner to encode/decode the property value to XML.
- Default:
- java.beans.PersistenceDelegate.class
-
-
-
attributes
BeanInfo.Attribute[] attributes
Specifies additional named attributes for theBeanDescriptor. InvokesFeatureDescriptor.setValue(String, Object). SeeBeanInfo.Attributefor details.- Default:
- {}
-
-