JFormDesigner 5.0.4 Annotations

com.jformdesigner.annotations
Annotation Type BeanInfo


@Target(value=TYPE)
@Retention(value=RUNTIME)
public @interface BeanInfo

This annotation can be used to specify additional information for constructing a BeanInfo class and its BeanDescriptor.

JFormDesigner first uses Introspector.getBeanInfo(Class) to construct a BeanInfo and then applies changes specified in annotations to copies of the BeanInfo, BeanDescriptor and PropertyDescriptors.

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 { ... }
 

Since:
5.0

Optional Element Summary
 BeanInfo.Attribute[] attributes
          Specifies additional named attributes for the BeanDescriptor.
 BeanInfo.Category[] categories
          Specifies categories for grouping properties in the JFormDesigner Properties view.
 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.
 Class<? extends Customizer> customizer
          Specifies the bean's customizer.
 String description
          Description of the JavaBean.
 String icon
          Resource name of a 16x16 color icon of the JavaBean.
 boolean isContainer
          Specifies whether a component is a container or not.
 String[] persistenceConstructorProperties
          Specifies the property names for a DefaultPersistenceDelegate(String[]) used to persist an instance of the annotated class.
 Class<? extends PersistenceDelegate> persistenceDelegate
          Specifies the persistence delegate used to persist an instance of the annotated class.
 PropertyDesc[] properties
          Specifies property descriptors.
 

description

public abstract String description
Description of the JavaBean.

Used in the JFormDesigner Palette to display descriptions of beans in tooltips.

Default:
""

icon

public abstract 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

public abstract Class<? extends Customizer> customizer
Specifies the bean's customizer. A customizer provides a complete GUI for customizing a target JavaBean. A customizer must implement Customizer and inherit from Component so it can be instantiated inside an dialog.

Default:
java.beans.Customizer.class

isContainer

public abstract boolean isContainer
Specifies whether a component is a container or not. A container can have child components and a layout manager.

Default:
false

containerDelegate

public abstract 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 a Container.

Default:
""

properties

public abstract PropertyDesc[] properties
Specifies property descriptors. See PropertyDesc for 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

public abstract BeanInfo.Category[] categories
Specifies categories for grouping properties in the JFormDesigner Properties view. See BeanInfo.Category for details.

Default:
{}

persistenceConstructorProperties

public abstract String[] persistenceConstructorProperties
Specifies the property names for a DefaultPersistenceDelegate(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; }
 }
 

See Also:
http://www.formdev.com/jformdesigner/doc/java-beans/#persistenceDelegate2
Default:
{}

persistenceDelegate

public abstract 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. If persistenceConstructorProperties() is specified, then this attribute is ignored.

Used by JFormDesigner to encode/decode the property value to XML.

See Also:
http://www.formdev.com/jformdesigner/doc/java-beans/#persistenceDelegate2
Default:
java.beans.PersistenceDelegate.class

attributes

public abstract BeanInfo.Attribute[] attributes
Specifies additional named attributes for the BeanDescriptor. Invokes FeatureDescriptor.setValue(String, Object). See BeanInfo.Attribute for details.

See Also:
http://www.formdev.com/jformdesigner/doc/java-beans/#beandesc_attrs
Default:
{}

JFormDesigner 5.0.4 Annotations

Copyright (C) 2004-2012 FormDev Software GmbH. All rights reserved.