Defining a Class, Primitive Type, or Interface Constant

The Define Constant dialog enables you to define your new constant for the selected class, primitive type, or interface.

To define a constant

  1. In the Name text box, specify the name of the constant that you want to define.

    The constant name starts with an initial capital letter; for example, ExampleConst. The name must be unique to the class, primitive type, or interface to which it is being added.

  2. In the Type combo box, select the required primitive type in the Type list or specify the first character or the first few characters of the primitive type in the text box, and then select the required primitive type from the Type list. The selected primitive type is then displayed in the Type text box.

    The type can be any primitive type to which you want to assign a constant value; for example, an integer value of 1 or a string value of "samples\sharedem".

  3. In the Definition editor pane, specify the definition of your constant. The definition can be a simple literal value or a more-complex expression. The following example shows the editor pane definition of a File subclass constant of primitive type String, named DefaultDirectory.

    "samples\sharedem"
  4. Check the Subschema Hidden check box if you want to specify that the class constant 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.

  5. Click the Enter Text button if you want to specify or maintain descriptive text for the class, primitive type, or interface constant as part of the definition or maintenance of the constant. For details, see "Specifying Text for a Schema Element", in Chapter 3.

    You can also specify descriptive text for the constant at any time, by selecting the Text command from the Constants menu. For details, see "Using the Free-Standing Editor Window to Define Text", in Chapter 3.

  6. Click the Search for Duplicates button if you want to determine if a constant with an identical definition value exists in any superschema, the current schema, or any superclass, or a global constant with the same definition exists in the current schema or any superschema.

    Jade can locate duplicate global constants only if you selected a type in the Type combo box. If the type of global constant is not specified, no duplicate definitions are found.

    If an existing definition value is located, a message box displays the name of the constant containing that definition and the class, primitive type, or interface, or global constant category and schema in which it is defined.

    This enables you to use an available existing constant without duplicating an identical definition in a constant category, class, primitive type, and interface in the same schema, for example.

  7. Click the OK button. Alternatively, click the Cancel button to abandon your selections or the Next button to define another constant.

The specified constant is then displayed in the Constant List of the Class Browser, Primitive Types Browser, or Interface Browser, with the values that you defined for the constant displayed in the editor pane. (A class, primitive type, or interface constant has public access and is displayed in the Constants List with the public icon to the left of the constant, by default.)

If a constant template has been defined for all new constants in your Jade development database or for your own class constants, the constant template is displayed below the class constant in the editor pane when you click the OK button on the Define Constant dialog. For details, see "Maintaining Text Templates", in Chapter 2.