Enabling Custom Edit Support for Your Bean

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:

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.

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 package.


Related concepts
Object Serialization in VisualAge

Related procedures
Adding Property Features

Related references
BeanInfo Page