The Bean Extender technology provides sample that explain how to write a scripting client. These applications can be used to create and deploy forms that have scriptable beans embedded in them. These applications are FormBuilder and FormRunner. The FormBuilder application allows you to iteratively develop and test forms. The FormRunner application allows you to run a deployed FormBuilder form, but you cannot edit its components.
When you are satisfied with a form created using the FormBuilder application, you can deploy it for subsequent running by the FormRunner application.
Any scripting language can be used to script the beans that are embedded in a FormBuilder form. However, the Bean Extender technology currently supports only the Java and NetRexx languages. To use one of these scripting languages, click on the Edit Script menu and click on the appropriate scripting language from the submenu.
Objects that are embedded in a form for scripting are called scriptable Java beans. The tool that allows script editing and script execution is the Scripting Integrated Development Environment (IDE). It contains a user interface that displays a list of the scriptable beans in a form. A user can select one of the beans for scripting and write script code.
The FormBuilder and FormRunner applications do not depend on a specific scripting language used by the IDE to edit scripts. The IDE is entirely dependent upon the scripting language used to script beans. In order to understand how to use the Scripting IDE refer to "The Scripting IDE".
It is assumed that you have at least one scripting language (for example Java) available on your system. The configuration details and diagrams in this document are based on Java implementation on Microsoft Windows 95 and Windows NT systems.
To start the FormBuilder application type:
java com.ibm.beans.samples.script.form.FormBuilder -d jarDirName
where jarDirName is the directory where JAR files for various beans are stored. If a jarDirname is not specified, the FormBuilder application tries to find a jars subdirectory in the working directory. For these sample applications, the JAR files in the directory specified by the -d flag must be in the CLASSPATH environment statement for proper instantiation of beans.
When FormBuilder is started, it is displayed with the BeanPalette as shown in the following figure.
The BeanPalette contains a list of names and icons of beans that can be embedded in a form, if available. To embed a bean, click on a bean name in the BeanPalette and then click on a location in the form where you want to embed the bean. When you click inside the form, the bean name in the BeanPalette is no longer highlighted. The following figure shows a sample form created in this manner. The JAR files used in this form, juggler.jar and buttons.jar, must be in the CLASSPATH environment statement for proper instantiation of juggler and buttons.
To edit script code, click on the Edit Script menu item on the Edit menu, then click on either Java or NetRexx as the scripting language. The Scripting user interface is displayed that allows you to enter script code. For additional information on creating and editing scripts, see "The Scripting IDE".
To run a script, click on the Deploy and Run menu item in the Edit menu. This starts the FormRunner application with the form that is being designed. You can continue to edit the script code when the FormRunner runs a snapshot of the Form. Only one FormRunner can be started at a time.
To debug a debugging-enabled script, you need to start the FormBuilder application using the java_g command, instead of the java command, with the -debug option set. See "Deploying a Form" for more details. When you click on Deploy and debug, the debugger is launched automatically, and the script is stopped at the beginning of the initialize method. See "The Scripting Debugger" for information on using the scripting debugger. If the script is embedded in another script, it cannot be debugged when you try to run the outer-level script. When the script is debug-enabled, the saved scripting .ser file does not include the generated Java class. The Java class is stored in a separate file.
When your form is designed and the script code is written and tested, the form can be saved for final deployment. To save it, click on the Deploy menu item in the File menu. A file dialog is displayed that prompts you for the name of the file where the deployed form is stored.
To deploy a form, start the FormRunner application by entering one of the following commands:
The following parameters are optional.
filename | The filename of the deployed form. If the filename is not entered on the command line, a file dialog is displayed as soon as the FormRunner application starts. |
-auto | A flag that designates whether to start immediately.
|
-autodebug | A flag that designates whether to start debugging.
|
The following figure shows the FormRunner user interface when the -auto or -autodebug flag is not set.