The JavaBeans specification defines two ways for you to implement custom edit behavior for your bean: property editors and customizers. Check the most recent version of the spec for details; a summary of custom editors follows:
All properties must be serializable. Java uses serialization to share instance information.
You must explicitly assign a customizer for it to be used; this is not true for property editors. The JavaBeans specification provides the following alternatives for associating a property editor and property:
Assigning custom edit support to a bean property
In VisualAge, you can assign property editors and customizers from the BeanInfo page of the class browser, or you can hand-edit the BeanInfo class directly.
To assign a property editor when you define the property, enter the name of the class in the Property editor field on the second page of the New Property Feature SmartGuide. To assign a property editor at any other time, directly edit the Property editor field in the Property Feature Information pane of the BeanInfo page. In this case, the change does not take effect until you save the bean, either by closing the class browser and electing to save changes or by typing Ctrl+S.
To assign a customizer to a bean, directly edit the Customizer class field in theBean Information pane of the BeanInfo page. (Make sure you have no features selected; if a feature is selected, the Feature Information pane appears instead.) The change does not take effect until you save the bean, either by closing the class browser and electing to save changes or by typing Ctrl+S.
Registering custom edit support for all instances of a property type
You can register custom edit support globally through the use of a .properties file. Follow these steps:
com.sun.java.swing.Border=myorg.mypackage.MyBorderEditor
Both class specifications must be fully qualified. You cannot override the editor for java.lang.String.
To unregister the editor currently being used, simply specify the property type without a corresponding custom edit class, as follows:
java.awt.Color=
VisualAge scans the program\lib directory for the existence of this file every time a new Visual Composition Editor is opened. Consequently, any that are already open at the time you save the file will not be affected.
Testing custom edit support
To test a bean's customization, drop the bean on the free-form surface and double-click on it.
For more information on implementing property editors themselves, see Property editor examples, which discusses the com.ibm.ivj.examples.vc.propertyeditors sample package.
Object serialization in VisualAge
Adding property features
BeanInfo page