Before you define a method, you must select the class or primitive type to which the method is to be added.
To add a method to a class or primitive type
In the Class List of the Class Browser or the Primitive Types list of the Primitive Types Browser, click on the class for which the method is to be added.
Select the New JADE Method command from the Methods menu.
The JADE Method Definition dialog, shown in the following image, is then displayed.
Check the Reimplement Superclass Method check box if you want to reimplement an existing method in a superclass. This check box is displayed only when you access the dialog from the Class Browser.
You can reimplement a method only if it is not final in the superclass. For details, see "final Option" under "Controlling the Use of Elements in Other Schemas", in Chapter 1. A drop‑down list containing all superclass methods that are not final is then displayed.
The combo box displaying the list of superclass method names is a Style_DropDown (0) type so that you can enter text. The first entry of <enter method name filter> displayed in the combo box drop‑down list is a prompt. It is disabled and cannot be selected.
When you enter text in the Name combo box, only those entries that have the entered text (which is case‑insensitive) somewhere in the entries in the drop‑down list are displayed. (Those that do not contain the specified text are hidden.) As a result, the more text you enter, the shorter the list of possible methods, as shown in the following image.
Select the method in the parent class that you want to reimplement in the current class. A message box then advises you that you are about to reimplement a superclass method, and prompts you to click the Yes button if you want to continue. The parent class and the method that you selected for reimplementation are then displayed in the Name text box.
Specify the name of your new method in the Name text box if you do not want to reimplement an existing method in the parent class. (For details about reimplementing a method, see step 10, later in this process.)
Check the Updating check box if the method can modify properties in the object to which it is sent.
If you do not specify that the method is updating, the method does not modify the receiver object (that is, the object that is executing the method). Any instructions that attempt to update properties of the receiver or any calls to updating methods in the receiver are marked as errors at compile time.
Check the Abstract check box if the selected class is abstract and the method is to be implemented in all concrete subclasses. An
Check the Protected check box if you want the
By default, your methods are not protected; that is, they are displayed in the Methods List of the Class Browser or Primitive Types Browser with the public access icon to the left.
Check the Subschema Hidden check box if you want to specify that the method is available only in the local schema; that is, it is not available for use in any subschemas. For details, see "subschemaHidden Option" under "Controlling the Use of Elements in Other Schemas", in Chapter 1.
Check the Type Method check box if you want the
Type methods provide a way of calling a method declared on a type (class, primitive, or interface) without having to have an instance of the type. For more details, see "
If you are defining a method for a subclass of the
For details about Web services methods, see "
In the Final Settings group box, select one of the following option buttons for the appropriate final setting, if required.
Final, if you want to specify that the method cannot be reimplemented in a subclass. The
Subschema Final, if you want to specify that the method can be extended or reimplemented in its local schema but not in a subschema. The
Subschema Copy Final (displayed only when you access the dialog from the Class Browser), if you want to specify that the method cannot be reimplemented in a subschema copy class. For details and an example, see "subschemaCopyFinal Option" under "Controlling the Use of Elements in Other Schemas", in Chapter 1.
In the Execution Location group box, select the Server or Client option button if you want the
Click the Enter Text button if you want to specify or maintain descriptive text for the JADE method as part of the definition or maintenance of the method. For details, see "Specifying Text for a Schema Element", in Chapter 3.
You can also specify descriptive text for the JADE method at any time, by selecting the Text command from the Methods menu. For details, see "Using the Free-Standing Editor Window to Define Text", in Chapter 3.
Click the OK button or the Next button.
If the schema is versioned and a method with the specified name added in one schema context (for example, the current version) exists in the other context (for example, the latest version), a message box advises you that the method exists in the other context and that the methods in both contexts will be linked. If linking, you have the option of copying the existing source from the corresponding method in the other context or of starting with an empty method template.
Click the:
Cancel button, to abort creation of the method in the context to which you added it.
Yes button, to create the method, copying the method source from the other context.
No button, to create the method without copying the existing method source from the other context.
A method template is then displayed in the editor pane of the Class or Primitive Types Browser.
If a method template has been defined for all new methods in your JADE development database or for your own JADE methods, the defined method template is displayed in the editor pane. For details, see "Maintaining Text Templates", in Chapter 2.
Modify the template by adding JADE code to perform the required operations, and then compile it. (For more details, see "Compiling Methods", later in this section, and "
If you are unsure of the syntax of a JADE instruction, specify the instruction in the appropriate place in your method and then press Ctrl+S. The syntax for that instruction is then displayed in the method, to enable you to specify the appropriate values. For example, if you specify
foreach identifier in (collection | expression to expression [step expression]) [reversed] [where expression] do [ : label] optionalStatementList; endforeach [label];
Alternatively, to obtain online help for a JADE-supplied class, method, property, primitive type, instruction, or method option on which the caret is positioned in the editor pane, press F1. The online help topic for that element is then displayed. (See also "Using Bubble Help in the Editor Pane", later in this section and "Displaying Bubble Help in Browser Lists" under "Using the Class, Primitive Types, or Interface Browser", in Chapter 3.)
For details about creating a mapping method for a property selected in the Properties List of a hierarchy browser, see "Adding a Method Mapping for a Property", later in this chapter.
To define a JADE event method
In the Properties list of the Class Browser window, click on the form or control for which the event method is to be defined. A list of valid events for the selected control is then displayed.
Click on the required event in the Event list.
A template for that method is then displayed in the editor pane of the Class Browser.
The following image shows an example of an event method.
Modify the template by adding JADE code to perform the required operations, and then compile it. (For more details, see "Compiling Methods", later in this subsection and to "
Event methods are valid only for forms or controls. For controls, the concatenation of the property name and method name cannot exceed 100 characters. When this maximum length is exceeded, the event method is not displayed and a warning is displayed on the status line.
If a method template has been defined for all new methods in your JADE development database or for your own JADE methods, the defined method template is displayed in the editor pane. For details, see "Maintaining Text Templates", in Chapter 2.