Defining an Interface

To add a new interface to the current schema

  1. Select the Add command from the Interfaces menu.

    The Define Interface dialog, shown in the following example, is then displayed.

  2. In the Name text box, specify the name of the interface that you want to define. The name must be unique within the schema to which it is being added.

  3. If you want the interface to extend any existing interface that exists in the current schema or superschema, select one or more interfaces that you want to extend from the list displayed in the Extends list box. As no interface is extended by default, the < none > value is selected by default.

    As an interface can extend multiple other interfaces, you can select multiple interfaces in the Extends list, if required, by using the Ctrl key and clicking each interface that you want to extend.

  4. If you want to enter free-format descriptive text for the interface, select the Text sheet. The Define Interface dialog Text sheet is then displayed.

  5. In the editor pane, enter the descriptive text for your interface.

    You can also enter supplementary text, which is for display only, by selecting the Text command from the Interfaces menu. The Text command accesses a freestanding window rather than a separate sheet of the Define Interface dialog. For more details about entering interface text by using the freestanding editor window, see "Using the Free-Standing Editor Window to Define Text", in Chapter 3. See also "Specifying Text for a Schema Element", in Chapter 3.

    The editor determines the behavior of the text editor window. Text is not automatically wrapped to fit the current window size. When you want text to start in the next line, press Ctrl+Enter. (If you want text to wrap in text and source windows, see "Maintaining Editor Options", in Chapter 2.)

  6. Click the OK button. Alternatively, click the Cancel button to abandon your class selections or the Next button to define another interface.

The specified interface is then displayed in the Interface Browser and the descriptive text, if any, is displayed at the end of the interface details in the integrated Interface Browser editor pane when the interface is selected in the Interface List. It is also printed beneath the interface name when the interface is printed (by selecting the Print Selected command from the File menu) and the Text check box in the Print dialog is checked.

You can now add constants and methods to an Interface in the same manner that a constant or method is added to a class or primitive type. For details, see "Defining Class, Primitive Type, and Interface Constants" and "Adding Jade Methods to Classes, Primitive Types, or Interfaces", in Chapter 4. See also "Adding Interface Methods", later in this chapter. For details about defining and using interface constants, see "Adding a Class, Primitive Type, or Interface Constant" and "Using Class, Primitive Type, or Interface Constants in Your Methods", in Chapter 3.