The bean interface defines the property, event, and method features of your bean. These features can be used in visual composition when your bean is added to another bean. A BeanInfo class describes the bean and features that you add to the bean. Other features are inherited from the superclass of your bean unless you choose not to inherit features.
You can define a bean interface in the following ways:
When you create a new bean, it does not initially have a BeanInfo class. VisualAge creates a BeanInfo class when you add or promote the first feature that is not inherited, or when you explicitly direct VisualAge to create a BeanInfo class. You can create a BeanInfo class in the BeanInfo page.
Promotion of Bean Features
Default Promoted Feature Names
Feature Naming Guidelines
How Classes and Beans Are Related
Bean Design for Visual Composition
Generated Code
Defining Bean Interfaces for Visual Composition
When you create a composite bean, you might want some features of beans that are embedded within it to appear in the interface of the composite bean. For example, suppose you create a composite bean named ButtonSet containing a set of buttons that you want to reuse. When you add the ButtonSet composite bean to another composite, you want to be able to connect to each of the buttons.
To add features of embedded beans to the interface of a composite bean, you must promote them to the composite's interface. To add an entire embedded bean as a property of the composite bean, promote the this property of the embedded bean.
When you promote a feature of an embedded bean, VisualAge generates code that describes the promoted feature in the BeanInfo class for the composite bean. After the feature is promoted, you can manage the feature in the BeanInfo page the same as you manage features that you add there.
When you add a bean with promoted features to another bean, you can use the promoted features the same as you use other features of the bean. If you add a bean that has an embedded bean as a property, you can tear off the property as a Variable. Then, you can access the features of the embedded bean referenced by the Variable.
Bean Interfaces and BeanInfo
Default Promoted Feature Names
Tearing Off Properties
Promoting Features of Embedded Beans
When you promote a feature of an embedded bean in the Promote Features window, you can use a default feature name produced by VisualAge. If you do not want to use the default feature name, you can change the name.
The default feature name is a combination of the name of the embedded bean and the name of the feature you are promoting. This identifies the bean that implements the feature, which is helpful if the composite bean contains more than one bean with the same feature. Then, when you connect to the feature, you can tell which embedded bean it belongs to.
For example, if you promote the enabled property for a bean named YesButton, the default composite bean feature name is yesButtonEnabled).
Bean Interfaces and BeanInfo
Promotion of Bean Features
Promoting Features of Embedded Beans
When you add or promote a feature, use these naming guidelines:
Bean Interfaces and BeanInfo
Adding Property Features
Adding Method Features
Adding Event Features
Promoting Features of Embedded Beans