In VisualAge, you draw connections between beans to define their interaction. This involves using the mouse to select a feature of the source bean and connect it to the feature of the target bean. The type of feature at the source--property or event--and the type of feature at the target--property, method, or code--determines the type of connection. For example, if the source is an event and the target is a method, the connection is an event-to-method.
If you decide to change the connection behavior of the bean, you can edit or reorder the existing connections without redrawing them.
Note: | You can also perform connections within the Beans List window. |
To connect two features, follow these steps. The term source refers to the where the connection begins and the term target refers to where the connection ends.
In most cases, a cascade menu appears that displays the names of the most commonly used (or preferred) features. If additional features exist that are appropriate for the connection type, Connectable Features also appears on the menu. Selecting Connectable Features opens a connection window with an expanded list of features, sorted alphabetically and by feature type.
The menu or window closes without completing the connection.
When you complete the connection, a colored connection line appears. The color indicates the connection type, based on the features you selected as end points.
You make connections within the beans list in the same manner as in the Visual Composition Editor. You cannot, however, start a connection on the Visual Composition Editor and complete it in the beans list or vice versa. You may want to draw connections on the beans list instead of the Visual Composition Editor if you use a layout that allows for a bean to completely cover another bean.
Note: | If you are using an unbound property in a property-to-property connection, open properties on the connection and select an event to associate with the property. When the event is triggered, the properties values align. |
The source for a code connection must be either an event or a bound property (a property that fires an event when its value changes). Connect to a code as follows:
The connection window closes and VisualAge draws a green connection arrow from the source bean to a moveable text box on the free-form surface. If the connection arrow is dashed, you must supply values for the input parameters of the code.
You can also create a code connection by selecting a source event and targeting an Event-to-Code Connection on the free-form surface.
An exception is any user, logic, or system error detected by a function that does not deal with the error itself but passes the error on to a handling routine, called an exception handler. In VisualAge, you can catch exceptions by connecting exception events to either methods or code.
An exception is a feature of a connection, not a bean. It appears as exceptionOccurred on the connection's connection menu.
You can also pass the return value from the target of a connection. This return value displays as the normalResult event of the connection. You can connect the normalResult event to a feature of the same bean or another bean. For example, you can connect the exceptionOccurred to a method that brings up a prompter with an error message.
Connections sometimes require parameters, or input arguments. If a connection requires parameters that have not been specified explicitly or by default, it appears as a dashed arrow, indicating that it is incomplete. When you have made all the necessary parameter connections, the connection line becomes solid, indicating that the connection is complete.
You can create parameter from method and parameter from code connections. When the primary connection calls for a value parameter, it calls the method or code, which passes the return value as the parameter.
When connections need parameters with constant input values, provide these values through the properties window of the incomplete connection, as follows:
In most connections other than event-to-code, data is not passed by default from the source of a connection to the target. However, you can set VisualAge so that it always passes the available event data. In that case, the initial connection line may not appear dashed.
To set the connection to always pass event data, follow these steps:
Note: | The source of the connection determines the event data that is passed. |
The event-to-code dialog defaults the Pass event data check box to false only if either of the following is not true:
Connection properties enable you to change a connection without redrawing it. Through the properties window, you can do the following:
To open properties for a connection from either the free-form surface or the Beans List window, move the mouse pointer over the connection and do one of the following:
Parameter Connections
Connections
Code Connections
Reordering Connections
Selecting and Deselecting Connections
Deleting Connections
Showing and Hiding Connections
Changing the Source and Target of Connections
Beans List
Pass Event Data
Event-to-Code Connection Window