Define event features to represent the occurrence of any events in your
bean that you want other beans to be aware of.
You can add an event feature in the BeanInfo page based on either an
existing event set or a new event set that you define. An event
set consists of an event listener interface with associated event object
and multicaster classes. The multicaster enables multiple listeners for
an event.
Add an event feature based on an existing event set in the BeanInfo page as
follows:
- From the tool bar, select
New Event Set Feature. If you prefer, you can select
New Event Set Feature from the Features menu.
Either selection opens the SmartGuide - New Event Set Feature
window.
- In the SmartGuide - New Event Set Feature window, do the
following:
- Specify the event name in the Event name field.
- Select an event listener in the Event listener list.
- Select Next to open the SmartGuide - Bean Information
window.
- In the SmartGuide - Bean Information window, do the following:
- If you want a name other than the actual feature name to be displayed for
the event in the Visual Composition Editor, specify the name in the
Display name field. This name appears when the event is
listed in connection menus, the Promote Features window, and other
windows.
- If you want a description other than the feature name to be displayed for
the event in the Visual Composition Editor, specify the description in the
Short description field. This description appears in certain
windows, such as connection windows and the Promote Features window, when the
event is selected.
- If you do not want the event to appear in development windows unless the
user chooses to display expert features, select the expert check
box.
- If you do not want the event to be exposed to the bean consumer, select
the hidden check box.
- Select Finish to add the method. VisualAge generates the
following:
- A public method for the feature in the bean class
- Bean information code that describes the feature in the BeanInfo class for
the bean
Add an event feature based on a new event set in the BeanInfo page as
follows:
- Select New Listener Interface from the Features menu
to open the SmartGuide - New Event Listener window.
- In the SmartGuide - New Event Listener window, do the
following:
- Specify the event name in the Event name field.
- Specify the event listener name in the Event listener
field. A default name is produced based on the name you specify in the
Event name field.
- Specify the event object name in the Event object field.
A default name is produced based on the name you specify in the Event
name field.
- Specify the event multicaster name in the Event Multicaster
field. A default name is produced based on the name you specify in the
Event name field.
- Select Next to open the SmartGuide - Event Listener
Methods window.
- In the SmartGuide - Event Listener Methods window, do the
following:
- For each method that you want to add to the listener, specify the method
in the Method name field. Then, select the Add
button. These listener methods respond to the event. You must
add code that responds to the event in each method.
- Select Next to open the SmartGuide - Bean Information
window.
- In the SmartGuide - Bean Information window, do the following:
- If you want a name other than the actual feature name to be displayed for
the event in the Visual Composition Editor, specify the name in the
Display name field. This name appears when the event is
listed in connection menus, the Promote Features window, and other
windows.
- If you want a description other than the feature name to be displayed for
the event in the Visual Composition Editor, specify the description in the
Short description field. This description appears in certain
windows, such as connection windows and the Promote Features window, when the
event is selected.
- If you do not want the event to appear in development windows unless the
user chooses to display expert features, select the expert check
box.
- If you do not want the event to be exposed to the bean consumer, select
the hidden check box.
- Select Finish to add the method. VisualAge generates the
following:
- A public method for the feature in the bean class
- Bean information code that describes the feature in the BeanInfo class for
the bean
You can modify BeanInfo for the event in the Information pane of
the BeanInfo page. If you want the event to appear as a preferred
feature in the connection menu of the bean, set the feature's
Preferred property to true.
Feature naming guidelines
Generated code
Defining bean interfaces for visual composition
Creating and modifying a BeanInfo class
Specifying expert features
Specifying hidden features
New Event Set Feature SmartGuide
New Event Listener SmartGuide
Event Listener Methods SmartGuide
Bean Information SmartGuide
Features pane--BeanInfo page
