Natural for Ajax Tools

#### Search Results

Search

# Natural for Ajax Tools

When Natural for Ajax is installed, you can work with Natural for Ajax Tools which allows you to use the Natural for Ajax functionality directly from within Natural Studio. Using Natural for Ajax Tools, you can design web pages for rich internet applications, import adapters for these pages into a Natural library, generate programs that display these pages and test these programs in an internal browser.

For application modernization, it is possible to extract information from Natural maps. The resulting files can then be used by another tool which converts the output to Natural for Ajax page layouts.

This document covers the following topics:

- Before You Start

- Elements of Natural for Ajax Tools

- Configuring the Servers

- Configuring Libraries and Projects

- Opening the Application Designer Development Workplace

- Importing the Generated Adapters

- Generating the Main Program from an Adapter

- Executing the Main Program in the Browser

- Displaying the URL of a Natural Program or of the Application Designer Development Workplace

- Using the Map Extractor

For further information, see the Natural for Ajax documentation which is available separately. The most up-to-date Natural for Ajax documentation is always available at http://documentation.softwareag.com/.

## Before You Start

Before Natural for Ajax Tools can be used, you have to proceed as described in the following topics:

- Prerequisites

- Activating Natural for Ajax Tools

### Prerequisites

When you activate a plug-in, Natural Studio starts a second Natural session using the parameter file `NATPARM`. If your Natural session uses a parameter file other than `NATPARM`, you must be aware of the fact that the `FNAT` (especially the libraries `SYSPLNJX` and `SYSLIBS`) and other Natural parameters (such as the `WORK` parameter) may be different in the Natural plug-in session (which uses `NATPARM`) and in your Natural session (which uses another parameter file). This may lead to unpredictable errors. Therefore, it is recommended that you also use the parameter file `NATPARM` for your Natural session. See also the information on the Natural parameter file in the section Plug-Ins under Natural Security of the Natural Security documentation.

### Activating Natural for Ajax Tools

Natural for Ajax Tools has to be activated in the Plug-In Manager. For detailed information on the activation procedure, see Plug-in Manager in the documentation Using Natural Studio.

## Elements of Natural for Ajax Tools

When Natural for Ajax Tools has been activated in the Plug-in Manager, additional elements are available in the Natural Studio window:

- Toolbar

- Context Menu

### Toolbar

An additional toolbar is shown. The buttons in this toolbar represent the following menu commands:

| Import Adapters
| Create Main Program
| Show URL
| Execute in Browser
| Open Application Designer

Note
The display of this toolbar can be switched on and off by choosing Customize from the Tools menu.

### Context Menu

When the current context (that is, the selected object) allows it, the context menu provides the following additional cascading menu: Natural for Ajax. Depending on the context, the cascading menu contains different commands:

> Library Level

>   When a library is currently selected, the following commands are available in the cascading menu:

>   - Import Adapters

>   - Open Application Designer

> Natural Object Level

>   When a program is currently selected, the following commands are available in the cascading menu:

>   - Show URL

>   - Execute in Browser

>   When an adapter is currently selected, the following command is available in the cascading menu:

>   Create Main Program

>   When a map is currently selected, the following command is available in the cascading menu:

>   Extract Map

## Configuring the Servers

In order to develop Natural for Ajax applications, a Natural Development Server (NDV, optional), an application server with Natural for Ajax and a Web I/O Interface server (NWO) are required.

When Natural for Ajax Tools has been activated in the Plug-in Manager, you first have to configure the relationship between the Natural development servers and the corresponding application servers and Web I/O Interface servers. This is done in the configuration file ConfigNJXPLG.dat that resides as a resource in the library `SYSPLNJX`.

Each entry in the configuration data consists of:

- Natural Development Server host name.

- Natural Development Server port number (optional).

- Application server host name.

- Application server port number.

- Application server path name.

- Web I/O Interface server host name.

- Web I/O Interface server port number.

See the contents of the file ConfigNJXPLG.dat for additional information.

This file already contains the configuration that is necessary for working in the local environment. After you have defined a configuration line for a new remote development environment, you must make sure that the file sessions.xml on the corresponding application server (see Configuring the Client in the Natural Web I/O Interface documentation) contains a session definition with the same name.

Example:

Your ConfigNJXPLG.dat file contains the following line:

    MYNDV,2700,MYAPPS,8080,\\MYAPPS\JBOSS\#LIB\nat,MYNWO,2900

In this case, the sessions.xml file of the application server running on "MYAPPS:8080" must contain the following session definition:

    <sessions>
      <session id="MYNDV">
         <natural_program>script-name</natural_program>
         <user id="" pwd=""/>
      </session>
    </sessions>

Optionally, you can specify a user ID and password. This is useful with the Execute in Browser command. Then you do not have to enter a user ID and password every time you start a Natural for Ajax program in Natural Studio.

## Configuring Libraries and Projects

In general, a Natural for Ajax project consists of one or more Natural libraries with Natural objects that implement the server part, and one or more Application Designer projects that implement the user interface part.

The current version of Natural for Ajax Tools assumes that a Natural for Ajax project consists of one Natural library and one Application Designer project, where the name of the Application Designer project is identical to the name of the Natural library translated to lowercase letters.

## Opening the Application Designer Development Workplace

Using the Application Designer, you design the web pages for your rich internet applications. You can open the Application Designer development workplace directly from Natural Studio.

To open the Application Designer development workplace

1. Select the Natural library which belongs to your Application Designer project.

2. Invoke the context menu and choose Natural for Ajax > Open Application Designer.

   Or:
   When the Natural for Ajax Tools toolbar is shown, choose the following toolbar button.

   The Application Designer development workplace is invoked in a browser window. Now you can create an Application Designer project for your web pages, create pages, edit existing pages and create Natural adapters for pages.

   Important
   Name your Application Designer project like the corresponding Natural library (translated to lowercase letters).

   For further information, see Developing the User Interface in the Natural for Ajax documentation.

## Importing the Generated Adapters

A Natural adapter is generated when you save the layout for your Natural page in the Application Designer. You can import the generated adapters from the application server environment into the Natural library with the same name.

To import the generated adapters

1. Select the library into which you want to import the generated adapters.

2. Invoke the context menu and choose Natural for Ajax > Import Adapters.

   Or:
   When the Natural for Ajax Tools toolbar is shown, choose the following toolbar button.

   The generated adapters from the equally named Application Designer project are imported into the selected library.

   When an adapter already exists in the library, you are asked whether you want to replace it.

## Generating the Main Program from an Adapter

From an adapter, you can generate the Natural main program that calls the adapter and displays the page.

To generate the main program from an adapter

1. Select the adapter.

2. Invoke the context menu and choose Natural for Ajax > Create Main Program.

   Or:
   When the Natural for Ajax Tools toolbar is shown, choose the following toolbar button.

   The program is generated. Its source code is shown in a program editor window.

3. Stow the program with a name of your choice.

   For further information (for example, how to handle page events), see Developing the Application Code in the Natural for Ajax documentation.

## Executing the Main Program in the Browser

You can execute the Natural main program which has been generated from an adapter. A browser window is then invoked in Natural Studio and you can test your program.

To execute the main program

1. Select the main program.

2. Invoke the context menu and choose Natural for Ajax > Execute in Browser.

   Or:
   When the Natural for Ajax Tools toolbar is shown, choose the following toolbar button.

   The program is executed in a browser window.

## Displaying the URL of a Natural Program or of the Application Designer Development Workplace

If you want to start a Natural program or the Application Designer development workplace outside of Natural Studio, you can display the URL that is required for starting it.

To display the URL of a program

1. Select the program.

2. Invoke the context menu and choose Natural for Ajax > Show URL.

   Or:
   When the Natural for Ajax Tools toolbar is shown, choose the following toolbar button.

   A dialog box appears, containing the URL for the program.

   Using copy-and-paste, you can enter this URL in a browser which is supported by Application Designer (for example, Internet Explorer or Mozilla Firefox). Thus, you can execute your program directly in the browser (that is, not in the internal browser which is used in Natural Studio).

To display the URL of the Application Designer development workplace

1. Select any object except for a program, or select a library or system file.

2. Choose the following toolbar button from the Natural for Ajax Tools toolbar.

   A dialog box appears, containing the URL for the Application Designer development workplace.

   Using copy-and-paste, you can enter this URL in a browser which is supported by Application Designer (for example, Internet Explorer or Mozilla Firefox). Thus, you can invoke the Application Designer development workplace directly in the browser (that is, not in the internal browser which is used in Natural Studio).

## Using the Map Extractor

The Map Extractor is used in the process of converting a map-based application to a Natural for Ajax application. It creates map extract files which are intended as input for the Map Converter. For detailed information, see Application Modernization in the Natural for Ajax documentation.

To use the Map Extractor

1. Select one or more Natural maps.

2. Invoke the context menu and choose Natural for Ajax > Extract Map.

   The map extract files are created. The location of these files is shown in a dialog box.

### On this page

- Before You Start
- Elements of Natural for Ajax Tools
- Configuring the Servers
- Configuring Libraries and Projects
- Opening the Application Designer Development Workplace
- Importing the Generated Adapters
- Generating the Main Program from an Adapter
- Executing the Main Program in the Browser
- Displaying the URL of a Natural Program or of the Application Designer Development Workplace
- Using the Map Extractor