The VisualAge Composition Editor, shown in Figure 8, is used to build VisualAge visual and non-visual parts. A visual part has a visual representation at runtime. It can include other visual parts, such as windows, labels, text parts (text entry fields), and push buttons.
Figure 8. Composition Editor on Smalltalk
It can also include non-visual parts--parts that don't have visual representations at runtime. A set of VAGen non-visual parts are available to be used with the Composition Editor. As you build your user interface, the Composition Editor enables you to visually define connections that control how that interface communicates with other parts.
Figure 9. Composition Editor on Java
The Composition Editor provides you with the following:
You can specify the user interface characteristics and logic flow visually by doing the following:
Refer to the online help for VisualAge for Java or the VisualAge for Smalltalk User's Guide for more information on designing visual parts.
For hands-on practice building visual parts, complete the steps outlined in Chapter 17, "Building a visual part using VisualAge for Java" or in Chapter 18, "Building a visual part using VisualAge Generator Developer on Smalltalk".
The VAGen Script Wizard (shown in Figure 10) is an extension provided by VisualAge Generator to augment the capabilities of the Composition Editor. It enables you to quickly and easily compose simple scripts that get or set property values, or invoke methods in your parts. These scripts use the syntax of an object-oriented language (shipped as part of your development environment) without requiring you to master a new programming language. These scripts can be invoked from VAGen functions and give you access to non-VisualAge Generator parts, like graphical user interface objects or Enterprise JavaBeans (EJBs), during execution of your 4GL logic. Using the wizard can help reduce the number of static connections you make between objects on the free-form surface. It simplifies maintenance and can improve the performance of your visually composed clients.
Before you compose a script, lay out your parts visually and save the part or bean. To display the wizard, if you are using VisualAge Generator on Java, select the Members tab, followed by the Members menu, and then VAGen Script Wizard. If you are using VisualAge Generator on Smalltalk, select the Script Editor icon, followed by the VAGen Script Wizard icon.
Methods developed with the VAGen Script Wizard are called VAGen scripts or object scripts and are associated with the instance of the class (the GUI client) in which you develop them. You can access these scripts by including the reserved word EZESCRPT in a VAGen function and specifying the literal script name or a data item that contains the script name. Scripts invoked this way cannot require arguments. EZESCRPT cannot be used to pass arguments to your scripts, but you can share information between your GUI client and your 4GL parts by storing data in a record placed on the free-form surface of the GUI client where you are developing the script.
The VAGen Script Wizard steps you through the process of naming a script, declaring local variables, choosing patterns (including get properties/attributes, set properties/attributes, invoke method/send message, and perform action), and selecting objects to get data from and pass data to. For example, if a condition specified in your VAGen function is not met by input received from a GUI client, you can indicate which field is in error by using a VAGen Script to change the color of that field.
Figure 10. VAGen Script Wizard
The VAGen Script Wizard has five areas on each window that provide you with information or allow you to enter data and make selections:
You can also use the Back button to sequentially remove changes that you added, change a step, and then use the Next button to add your selections back in.