In the Visual Composition Editor, morphing enables you to change the class or type of a component without significantly reworking property or connection settings. This capability can be very helpful in tasks like the following:
However, you cannot change the superclass of a composite through morphing.
If renaming or moving a class has introduced a referencing error into a composite, VisualAge alerts you when you attempt to open the composite. If you know that a class has been moved or renamed and you already have the composite open, you can select Resolve Class References from the Bean menu. In either situation, VisualAge searches the repository for a like-named class and presents the first candidate it finds. You can choose to proceed with the candidate VisualAge suggests, ignore the problem for now, or specify an alternative class.
In situations other than breakage, you change the class or type of a component by selecting Morph Into from the bean's pop-up menu. In this case, you must specify the name of the replacement class or bean type.
Common property settings and connection endpoints are preserved in the new component. To determine feature commonality, VisualAge compares both name and type; both must match. For example, suppose you change a component from java.awt.TextField to com.sun.java.swing.JTextField. The background color for the original TextField happens to be gray. The gray setting is propagated into the new JTextField.
Conversely, VisualAge discards property settings that cannot be used in the new class. This includes torn-off properties but does NOT include promoted properties. You must delete obsoleted promotions manually from the BeanInfo page of the class browser.
Connection endpoints are handled similarly. Connections to features that are no longer valid in the new class remain until code is regenerated for the composite. To delete such connections instead, select Delete invalid connections before you select OK to start the morphing process. Because components vary in their use of like-named features, make sure that the updated composite behaves as you expect it to.