How-To-Create a NPIB1.5 form. Example: Polar Plot, module02

For NPIB1.5 modules a split web page appears with the NPIB1.5 form in the lower frame and the upper frame appears with the "how-to-use" instructions. The lower frame is created by a java form builder. This web page describes how to create the NPIB1.5 form for the polar plot module02 as an example.

The NPIB1.5 form, shown below, appears in the lower frame.

We provide a NPIB1.5 form editor ("form.jar") that creates new NPIB1.5 (*.npib) files or edits existing NPIB1.5 (*.npib) files. This NPIB form editor is located in two places:

  1. /www/jwave/npib/form.jar_Archive/form.jar_1.5/form.jar
    (form.jar ver1.5 is archived in this directory)

  2. /www/jwave/applets98/form.jar (on spelunker)
    /home/"username"/npib1.5_form/form.jar (on your remote workstation)

    NOTE: We assume that server-users will have their own accounts
    on the server (i.e. spelunker), but NPIB1.5 files (*.npib) could also
    be created and edited on remote workstations and transfered onto the
    server (i.e. spelunker) using standard ftp. When creating NPIB1.5
    form files directly on the server (i.e. spelunker), ftp file transfer
    is eliminated, however when working from a remote workstation either
    ssh or setenv DISPLAY must be setup for viewing the "NPIB Creator"
    window at the remote workstation.

In this case the /www/jwave/applets98/form.jar is accessed by setting both the PATH and CLASSPATH to this directory. With these two paths set any NPIB1.5 file (*.npib) in any directory can be edited when you are logged on

echo $PATH --> ... /www/jwave/applets98: ....

echo $CLASSPATH --> ... /www/jwave/applets98/form.jar: ....

For this example we go to the directory /www/jwave/crcd/kriz/modules/module02 and edit the file polar.npib with the following command at the UNIX prompt.

   spelunker% form1.5 -e polar.npib

To create a new NPIB1.5 (*.npib) file at the UNIX prompt type...

   spelunker% form1.5 -e

You can give this file a name using the "Save" option when you leave the editor.

Two "Working Windows" should appear on your monitor**: (1) "NPIB Creator" and (2) "Output Editor". IF you are logged onto the server (i.e. spelunker) from a remote workstation and are using NPIB1.5 form.jar file on the server you must have setup the environmental DISPLAY variable to display X-windows back to your remote workstation**. But you can also install your own NPIB1.5 form.jar file in the ~/bin directory off of your home directory on your remote workstation, similar to how the NPIB1.5 form.jar file was setup on the ~/bin directory on the server (i.e. spelunker). Editing *.npib files from a remote workstation requires the user to transfer (*.npib) files from the remote workstation to the appropriate directory on the server (i.e. spelunker).

Information for working with the NPIB Creator "Working Window"

At the top of the NPIB Creator "Working Window" you can select from a number of pulldown menu options.

At the top of the NPIB Creator window under File, the choices are as expected New, Open, Save and Exit. Under Edit there is only one choice -- Remove which removes the last entry that was created form the items under Insert shown below.

Under Insert the choices are Text Field, Label, and Button. The majority of the time you will select a Text Field box with a Label above the box. A Button is used to select or initiate a task, for example the Submit button is used to create a file, in this case polar.dat, from the information on the NPIB1.5 form and then submit this file to the application for processing.

When and item is selected under Insert an Insert-window appears prompting you to enter a unique name for this item: Text-Field, Label, Button. This name will be used again in the Output Editor "Working Window".

After you have entered a unique name followed by OK, the item should appear in the the upper left corner of the NPIB Creator window. To move and reposition the button, label, or text-field items, simply select the item to be moved by holding down the left mouse button over the item on the NPIB Creator "Working Window" and drag (hold down mouse button while moving the mouse) the item by moving the mouse to the desired location. When you let go of the mouse button the item will appear in the new location. NOTE: you will not see the item "move" but rather the item will re-appear in the new position of the NPIB form near the location where the left mouse button was released. You may have to reposition the selected item a second time and "fine-tune" the the exact location. This is not intuative and takes some practice. In this way all of the items (Text Field, Label, Button) of a working NPIB form can be created and positioned as desired.

HELPFUL HINT: unless you have an excellent memory you may want to maintain a hand written sketch on a seperate piece of paper as you build your NPIB1.5 form where the "unique name" is written next to the item as you build the form. You will need to access some of these "unique names" again when building the file data format in the Output Editor "Working Window".

Next you will want to assign more information to your button, label or text-field. When a text field, label, or button is selected with the left mouse button a "Properties" window appears that requires you enter specific infomation for that item. For example the figures below show Property windows for each of the items: Text Field, Label, and Button.

Common to all these windows are constraints, foreground, background, and font. If the item is the last in a row you must specify this by changing the "Grid Width" constraint parameter from 1 to 0. Default for the "Grid Width" parameter is one "1".

Experiment with and change foreground, background, and font as needed.

Text Field Property Window options: selectionStart, text, columns, caretPosition, and selectionsEnd:

The Text Field properties window has the most options: selectionStart and selectionEnd define the beginning and end of the text-field displayed in the text entry window just below the sectionStart display window. The possiblilities here are too numerous to spell out in detail so the best way to learn about these options is to experiment and see how each of them effect the NPIB form format.

The editable: True/False button at the bottom can be selected so that the form user can not edit the displayed text if False is selected.

Label Property Window options: alignment

Options for the labels are the same as for Text Field except for the alignment option which left justifies the text if set to 0 and centers the text if set to 1.

Only the Label Property Window initially sets the name and text equal. Typically the Label_name and text have different entries. "Text" is what the users sees on the final NPIB form and "name" is the unique Label_name assigned at the time the item is created with Insert and is hidden except if viewed in this property window.

Button Property Window options: actionCommand

There is only one unique option for the Button Properties, that is the actionCommand. In our case there is only one button which is the submit button. The actionCommand only makes sense within the shell script. This feature has only been used for the submit button.

Information for working with the Output Editor "Working Window"

This "Working Window" describes how the data that is displayed in the NPIB form will be formatted in the file submitted to the shell script.

For comparison the resulting file polar.dat shown below corresponds to the syntax shown above.


At the top of the "Working Window" there are two entries: (1) the name of the shell script and (2) is any other parameter the shell script might need.

The next entry links the TextField_name as the return email address when shell script is completed.

The final entry is the window where the format is set with links to each of the textfield_names. The very first line in this window defines the filename where data is stored according to the format specified in the lines below. Here spaces are important if the program reading this file as data input requires accurate spacing which seperates the numbers associated with textfield_name. Notice that all numbers associated with textfield_names use the syntax, <link="textfield_name"\> . Recall that the textfield_names were assigned when the textfield was first created. This is why the HELPFUL HINT recommended that you keep a sketch of textfiled_names associated with the numbers in the boxes on the NPIB form. You can always verify the textfield_name associated with the texfield_item on the NPIB Creator "Working Window" but it is quicker if you use a sketch.

Direct Editing NPIB Files Using a Text Editor: It is possible to directly edit the syntax of the NPIB file because it is a text file and the syntax is simple enough to understand. We only recommend that in some instances this may be an option to consider when the forms are particularly large where you may want to copy and paste large blocks. In this case again the item_name is key to finding the portion to edit.

**NOTE: If you are logged onto the server (i.e. from a remote workstation make sure you either use ssh or setup xhost "server-name" and setenv DISPLAY "" so that X-Windows are sent back to your remote-workstation monitor. YOU MAY NEED TO REPOSITION THE WINDOWS USING ALT-F7
Contact: Dr Ron Kriz
Revised 10/2/00