Generating an Ajax Page for Generated Subprograms

This section describes how to generate an Ajax page that takes advantage of the capabilities of a subprogram generated by an Object-Browse-Subp wizard (Object-Browse-N1 or Object-Browse-Subp) or an Object-Maint-Subp wizard (Object-Maint-N1 or Object-Maint-Subp). The following files are generated:

  • page layout (.xml extension)

  • adapter (.NS8 extension)

  • main program (.NSP extension)

This section covers the following topics:


Generate an Ajax Page for an Object-Browse Subprogram

This section describes how to generate an Ajax page for an Object-Browse subprogram. The following topics are covered:

Access the Wizard

The section describes how to access the Ajax Object-Browse Page wizard. Before accessing the wizard, the following conditions must be met:

  • The wizard must be started from a project that has been enabled for Ajax Developer.

  • A user interface component must be available locally.

Note:
For more information about the generated files and general Ajax architecture, refer to the Natural for Ajax documentation.

Start of instruction setTo access the Ajax Object-Browse Page wizard

  1. Open the context menu in the Navigator view for a subprogram that was generated by either the Object-Browse-N1 or Object-Browse-Subp generator.

  2. Select Code Generation > New Ajax Object-Browse Page.

    For example:

    graphics/context-menu-for-ajax-object-browse-wizard.png

    The Specify Source and Target Details panel is displayed. For example:

    graphics/specify-source-and-target-details-ajax-browse-wizard.png

Specify Source and Target Details

Start of instruction setTo specify source and target details

  1. Define the following parameters:

    Parameter Description
    Object-Browse subprogram Name of the Object-Browse-generated subprogram for which you are creating the page. To change the name of the subprogram, either type the name of a new subprogram in Object-Browse subprogram or select Browse to display the available subprograms for selection.
    User interface component Name of the user interface component for the page. Either type the name of an existing component in User interface component or select Browse to display the available components for selection.
    Page layout Name of the page layout file to be generated. This name must follow standard xml naming conventions (do not include the .xml extension).

    Tip:
    Avoid using spaces in the page name as it may cause problems during generation.

    Adapter Name of the adapter file to be generated. This name must follow standard Natural naming conventions (do not include the .NS8 extension).
    Main program Name of the main program file to be generated. This name must follow standard Natural naming conventions (do not include the .NSP extension).
  2. Select Finish.

    The page is generated using all fields in the PDA, as well as all default column headings and search keys.

    Or:
    Select Next.

    The Configure Column Details panel is displayed. For example:

    graphics/configure-column-details-ajax-object-browse-wizard.png

    Note:
    Array fields are not currently supported.

Configure Column Details

This panel allows you to select which fields are generated for the page and what column headings will be displayed. The Key and Field Name columns show parameters that are read-only. "Yes" in Key indicates that the corresponding field is used as a search key on the generated page; Field Name displays the fully qualified name of each field in the PDA.

Start of instruction setTo configure column details

  1. Define the following parameters:

    Parameter Description Required/Optional/Conditional
    Generate Indicates whether the corresponding field is generated or not. To exclude a field, deselect Generate for that field. A minimum of one field must be selected. Optional
    Heading Heading displayed on the generated page for the corresponding field. You can change this heading as desired. Optional
  2. Select Finish.

    The page is generated using the selected fields, column headings and search keys. The generated main program (.NSP extension) file is displayed in the editor. For example:

    graphics/ajax-object-browse-wizard-nsp-file-in-editor.png

    The available user exits are displayed in the Outline view. For example:

    graphics/ajax-object-browse-wizard-user-exits.png

    For every event in the page layout file, a BEFORE-EVENT and AFTER-EVENT user exit is generated (for example, "BEFORE-EVENT-nat:nat:page.end" above). When you add an event to the page layout file, a BEFORE-EVENT and AFTER-EVENT user exit is also generated. Code within these exits is preserved during regeneration.

    The generated adapter (.NS8 extension) and page layout (.xml extension) files are also displayed in the editor. For example:

    graphics/ajax-object-browse-wizard-ns8-file-in-editor.png

    The following example shows the generated page layout file displayed in the Layout tab.

    graphics/ajax-object-browse-wizard-xml-file-in-editor.png

    Note:
    For more information about these files, refer to the Natural for Ajax documentation.

    Select the XML tab to display the generated xml file. For example:

    graphics/ajax-object-browse-wizard-xml-file-in-editor-xml-tab.png

    The generated files are displayed in the Navigator view. For example:

    graphics/ajax-object-browse-wizard-files-in-navigator.png

  3. Open the context menu in the Navigator view for the generated main program and adapter files.

  4. Select NaturalONE > Update.

At this point, you can:

Generate an Ajax Page for an Object-Maint Subprogram

This section describes how to generate an Ajax page for an object-maintenance subprogram. The following topics are covered:

Access the Wizard

The section describes how to access the Ajax Object-Maint Page wizard. Before accessing the wizard, the following conditions must be met:

  • The wizard must be started from a project that has been enabled for Ajax Developer.

  • A user interface component must be available locally.

Note:
For more information about the generated files and general Ajax architecture, refer to the Natural for Ajax documentation.

Start of instruction setTo access the Ajax Object-Maint Page wizard

  1. Open the context menu for a subprogram that was generated by either the Object-Maint-N1 or Object-Maint-Subp generator.

  2. Select Code Generation > New Ajax Object-Maint Page.

    The Specify Source and Target Details panel is displayed. For example:

    graphics/specify-source-and-target-details-ajax-maint-wizard.png

Specify Source and Target Details

Start of instruction setTo specify source and target details

  1. Define the following parameters:

    Parameter Description Required/Optional/Conditional
    Object-Maint subprogram Name of the Object-Maint-Subp-generated subprogram for which you are creating the page. To change the name of the subprogram, either type the name of a new subprogram in Object-Maint subprogram or select Browse to display the available subprograms for selection. Required
    User interface component Name of the user interface component for the page. Either type the name of an existing component in User interface component or select Browse to display the available components for selection. Required
    Page layout Name of the page layout file to be generated. This name must follow standard xml naming conventions (do not include the .xml extension).

    Tip:
    Avoid using spaces in the page name as it may cause problems during generation.

    Required
    Adapter Name of the adapter file to be generated. This name must follow standard Natural naming conventions (do not include the .NS8 extension). Required
    Main program Name of the main program file to be generated. This name must follow standard Natural naming conventions (do not include the .NSP extension). Required
  2. Select Finish.

    The page is generated using all fields in the PDA, as well as all default field labels.

    Or:
    Select Next.

    The Configure Field Details panel is displayed. For example:

    graphics/configure-field-details-ajax-object-maint-wizard.png

    Note:
    Array fields are not currently supported.

Configure Field Details

This panel allows you to select which fields are generated for the page and what labels will be displayed. The Field Name column displays the fully qualified name of each field in the PDA; these parameters are read-only.

Start of instruction setTo configure field details

  1. Define the following parameters:

    Parameter Description Required/Optional/Conditional
    Generate Indicates whether the corresponding field is generated or not. To exclude a field, deselect Generate for that field. A minimum of one field must be selected. Optional
    Label Label displayed on the generated page for the corresponding field. You can change this label as desired. Optional
  2. Select Finish.

    The page is generated using the selected fields, column headings and search keys. The generated main program (.NSP extension) file is displayed in the editor. For example:

    graphics/ajax-object-maint-wizard-nsp-file-in-editor.png

    The available user exits are displayed in the Outline view. For example:

    graphics/ajax-object-maint-wizard-user-exits.png

    For every event in the page layout file, a BEFORE-EVENT and AFTER-EVENT user exit is generated (for example, "BEFORE-EVENT-nat:nat:page.end" above). When you add an event to the page layout file, a BEFORE-EVENT and AFTER-EVENT user exit is also generated. Code within these exits is preserved during regeneration.

    The generated adapter (.NS8 extension) and page layout (.xml extension) files are also displayed in the editor. For example:

    graphics/ajax-object-maint-wizard-ns8-file-in-editor.png

    The following example shows the generated page layout file in the Layout tab.

    graphics/ajax-object-maint-wizard-xml-file-in-editor.png

    Note:
    For more information about these files, refer to the Natural for Ajax documentation.

    Select the XML tab to display the generated xml file. For example:

    graphics/ajax-object-maint-wizard-xml-file-in-editor-xml-tab.png

    The generated files are displayed in the Navigator view. For example:

    graphics/ajax-object-maint-wizard-xml-file-in-navigator-view.png

  3. Open the context menu in the Navigator view for the generated main program and adapter files.

  4. Select NaturalONE > Update.

At this point, you can:

Generate an Ajax Main Program from an Adapter File

There are two ways to create an Ajax main program:

  • Using standard Natural for Ajax functionality.

  • Using the Ajax Main Program wizard and an existing adapter file (.NS8 extension). This wizard creates a main program that is similar to the standard one, except it includes support for user exits (for protected code) and regeneration when the Ajax UI changes (which allows the fields on a page to be updated without overwriting the user interface logic).

This section describes how to use the Ajax Main Program wizard to generate a main program from an adapter file, as well as how to regenerate the generated program.

Start of instruction setTo generate an Ajax main program from an adapter file

  1. Open the context menu for the adapter file in the Navigator view.

  2. Select Code Generation > Generate Ajax Main Program.

    The Specify Ajax Program Details panel is displayed. For example:

    graphics/specify-ajax-program-details.png

  3. Type the name of the main program in Name.

    Optionally, you can:

    Task Procedure
    Select a folder in which to generate the program. Type the name of the folder in Folder or select Browse to display a window listing the existing folders for selection. The folder must currently exist within the selected Ajax project.

    Note:
    This option allows you to generate modules into more complex library structures (for example, "Natural-Libraries/my library (MYLIB)/SRC"). When this option is not specified, the modules will be generated into the basic library folder (for example, "Natural-Libraries/MYLIB/SRC", "Natural-Libraries/MYLIB/Subprograms", etc.).

    Select a library in which to generate the program. Type the name of the library in Library or select Browse to display a window listing the existing libraries for selection. The library must currently exist.

    Note:
    The libraries listed for selection are based on the current project.

  4. Select Finish to generate the main program.

    The generated main program is displayed in the editor view. For example:

    graphics/new-ajax-main-program-in-editor.png

    The available user exits are displayed in the Outline view. For example:

    graphics/new-ajax-main-program-user-exits.png

    The generated program is also displayed in the Navigator view. For example:

    graphics/new-ajax-main-program-in-navigator.png

  5. Open the context menu for the generated main program in the Navigator view.

  6. Select NaturalONE > Update.

At this point, you can:

Regenerate the Ajax Main Program

This section describes how to regenerate the main program file (.NSP extension) that was generated using the Ajax Main Program wizard.

Start of instruction setTo regenerate the main program

  1. Open the context menu for the program in the Navigator view.

  2. Select Code Generation > Regenerate Using Wizard.

    The Specify Ajax Program Details panel is displayed. After selecting Finish, the main program is regenerated.

    Or:
    Select Code Generation > Regenerate.

    The main program is regenerated without displaying the wizard panel.

    Note:
    You can use standard selection techniques to select more than one file.

Test the Generated Main Program

Start of instruction setTo test the generated main program

  1. Open the context menu in the Navigator view for the generated main program file (.NSP extension).

  2. Select NaturalONE > Execute.

    The page is displayed in the editor. For example:

    graphics/ajax-object-browse-wizard-test-main-program.png

    By default, the generated page displays row data in a table, where each field in the object (row) PDA is a column. All search key fields are displayed at the top of the page.

  3. Select Search.

    The results of the search are displayed. For example:

    graphics/ajax-object-browse-wizard-test-main-program-results.png

Regenerate the Main Program

This section describes how to regenerate the main program file (.NSP extension).

Start of instruction setTo regenerate the main program

  1. Open the context menu for the main program in the Navigator view.

  2. Select Code Generation > Regenerate Using Wizard.

    For information, see Regenerate Using Wizard.

    Or:
    Select Code Generation > Regenerate.

    For information, see Regenerate.

Regenerate Using Wizard

Use this option when you want to make changes to the wizard parameters before regenerating the Ajax page.

Start of instruction setTo regenerate using the wizard panel(s)

  1. Select Code Generation > Regenerate Using Wizard.

    The first specification panel for the wizard is displayed. For example:

    graphics/ajax-object-browse-wizard-regenerate-main-program.png

  2. Edit the specifications as desired.

    If the page layout file (.xml extension) has changed since the previous generation, you can select Generate to regenerate the page layout file as well.

  3. Select Finish to regenerate the main program, adapter and, optionally, the page layout files.

  4. Open the context menu in the Navigator view for the regenerated main program and adapter files.

  5. Select NaturalONE > Update.

Regenerate

Use this option when the object-browse or object-maintenance subprogram has changed and you want to incorporate the changes in the Ajax page.

Start of instruction setTo regenerate without using the wizard panels

  1. Select Code Generation > Regenerate.

    Note:
    You can use standard selection techniques to select more than one file.

    The main program (.NSP) file is regenerated without displaying the wizard panels and the Generation Progress window is displayed. For example:

    graphics/ajax-object-browse-wizard-regeneration-progress.png

  2. Select Save to save the details.

  3. Open the context menu in the Navigator view for the regenerated file(s).

  4. Select NaturalONE > Update.