Annotation Type PropertyDesc
-
@Target(METHOD) @Retention(RUNTIME) public @interface PropertyDesc
This annotation can be used to specify additional information for constructing aPropertyDescriptor.JFormDesigner first uses
Introspector.getBeanInfo(Class)to constructPropertyDescriptors and then applies changes specified in annotations to copies of thePropertyDescriptors.This annotation may be used in a
BeanInfoannotation (seeBeanInfo.properties()) or may be attached to property getter or setter methods. If the getter method of a property is annotated, then the setter method of the same property is not checked for this annotation.Important: This annotation requires that the
BeanInfoannotation is specified for the bean class. Otherwise this annotation is ignored when specified at methods.Example for attaching this annotation to a property getter method:
@PropertyDesc(displayName="magnitude (in %)", preferred=true) public int getMagnitude() { return magnitude; }Example for specifying this annotation in aBeanInfoannotation:@BeanInfo( properties={ @PropertyDesc(name="magnitude", displayName="magnitude (in %)", preferred=true) } ) public class MyBean extends JCompoment { ... }
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description BeanInfo.Attribute[]attributesSpecifies additional named attributes for thePropertyDescriptor.StringcategoryName of the category in which the property should be displayed.StringdescriptionDescription of the property.StringdisplayNameDisplay name of the property.PropertyDesc.Enum[]enumValuesSpecifies a list of valid property values.booleanexpertSpecifies whether the property is intended for expert users.PropertyDesc.ExtraPersistenceDelegate[]extraPersistenceDelegatesSpecifies extra persistence delegates used to persist referenced classes.booleanhiddenSpecifies whether the property should be hidden.Class<?>[]importsSpecifies one or more classes for which import statements should be generated by the Java code generator.StringnameThe programmatic name of the property.String[]persistenceConstructorPropertiesSpecifies the property names for aDefaultPersistenceDelegate(String[])used to persist an instance of the property value.Class<? extends PersistenceDelegate>persistenceDelegateSpecifies the persistence delegate used to persist an instance of the property value.booleanpreferredSpecifies whether the property is important.Class<? extends PropertyEditor>propertyEditorCustom property editor that should be used for editing the property.
-
-
-
Element Detail
-
name
String name
The programmatic name of the property. This attribute is only used/required when specifying properties withBeanInfo.properties()at class level. If you specify this annotation at a property getter method, then this attribute is ignored.- Default:
- ""
-
-
-
displayName
String displayName
Display name of the property. If not specified, the programmatic name will be used.Used in the JFormDesigner Properties view to display the property name in the "Name" column.
- Default:
- ""
-
-
-
description
String description
Description of the property. If not specified, the display name will be used.Used in the JFormDesigner Properties view to display a description of the property in a tooltip.
- Default:
- ""
-
-
-
category
String category
Name of the category in which the property should be displayed.Used in the JFormDesigner Properties view to display the property in that category.
- Default:
- ""
-
-
-
hidden
boolean hidden
Specifies whether the property should be hidden.Used in the JFormDesigner Properties view to hide the property.
- Default:
- false
-
-
-
propertyEditor
Class<? extends PropertyEditor> propertyEditor
Custom property editor that should be used for editing the property.Used in the JFormDesigner Properties view for property editing.
- Default:
- java.beans.PropertyEditor.class
-
-
-
enumValues
PropertyDesc.Enum[] enumValues
Specifies a list of valid property values. SeePropertyDesc.Enumfor details.Used in the JFormDesigner Properties view to display a combobox for property editing.
Note: JFormDesigner supports Java 5 enumeration types, which do not need this kind of configuration.
- Default:
- {}
-
-
-
imports
Class<?>[] imports
Specifies one or more classes for which import statements should be generated by the Java code generator. This is useful if you don't use full qualified class names inPropertyDesc.Enum.code()(seeenumValues()) orPropertyEditor.getJavaInitializationString().- Default:
- {}
-
-
-
persistenceConstructorProperties
String[] persistenceConstructorProperties
Specifies the property names for aDefaultPersistenceDelegate(String[])used to persist an instance of the property value. The property value class must have a constructor that accepts the given properties. Only necessary for bean value classes that are not JavaBeans.Used by JFormDesigner to encode/decode the property value to XML.
- Default:
- {}
-
-
-
persistenceDelegate
Class<? extends PersistenceDelegate> persistenceDelegate
Specifies the persistence delegate used to persist an instance of the property value. Only necessary for bean value 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
-
-
-
extraPersistenceDelegates
PropertyDesc.ExtraPersistenceDelegate[] extraPersistenceDelegates
Specifies extra persistence delegates used to persist referenced classes. Use the attributepersistenceDelegate()to specify a persistence delegate for the property value. Use this attribute to specify persistence delegates for classes that are referenced by the property value.Used by JFormDesigner to encode/decode the property value to XML.
- Default:
- {}
-
-
-
attributes
BeanInfo.Attribute[] attributes
Specifies additional named attributes for thePropertyDescriptor. InvokesFeatureDescriptor.setValue(String, Object). SeeBeanInfo.Attributefor details.- Default:
- {}
-
-