Understanding the IBM WebFacing Tool: A Guided Tour (IBM Illustrated Guide series)

In this section, I want you to highlight the Order number field on the first screen. To accomplish this, you add your own style class, and then you can apply it to any other similar field in your WebFaced application. The WebFacing styles are located in the styles directory, inside the WebFacing project. You will use the Appearance and Text Web setting to indicate that this field belongs to the new style class.

Adding a New Style Class

In the WebFacing perspective switch to the Navigator view and expand the wflabxx WebFacing project. Inside the project expand the Web Content and the styles directories. In directory styles you will see subdirectory apparea, which contains the apparea.css file.

You now need to invoke CODE Designer to apply the Web setting.

In the WebFacing Projects view, expand the WebFacing project and expand the DDS folder.

In CODE Designer,

In the WebFacing Projects view:

Your screen should look similar to Figure 17.19.

Figure 17.19: Order number formatted according to new style class definition

For any other field that you want to format similarly, you can just change its style class of this new class using Web settings.

Options for Values

For entry fields associated with the Values DDS keyword, the WebFaced UI creates radio buttons by default. You have seen these used in the Order Entry application for subfile option fields.

To make these radio buttons more usable, the WebFacing Tool provides options for the Values Web setting.

You can use the main order screen to try it out.

In the wflabxx WebFacing project, open the ORDENTD member with CODE Designer.

Your screen should look similar to Figure 17.21.

Figure 17.21: Radio button with text from Web settings

This adds the part to the order, and the radio button list displays when the cursor is moved on top of the option field. The Web settings text now replaces the number 2. To improve the appearance, you could also specify text for the 0 value.

Adding Graphics to the WebFaced User Interface

In this exercise, you add graphics to enhance your user interface. You have two choices for adding a graphic:

  1. Display a static picture that you specify at design time.

  2. Display a dynamic graphic and have your program supply the actual file name to display at run time.

Adding a Static Graphic to the User Interface

Let's first use a static picture, since that method is pretty straightforward. In the customer list, for example, you might want to add a picture to animate the screen a bit more. You previously hid the text 1=Select. Now you want to display a picture instead. You can do this very easily by selecting a .gif file from one of the Windows installation directories.

The picture file is in fact copied into the WebFacing project environment so that it is available during run time in the application server.

The picture is displayed on the customer selection list window, as shown in Figure 17.23.

Figure 17.23: Customer list with graphic

Adding Dynamic Graphics to the User Interface

Now you might want to add a dynamic picture and choose a file to display during run time. You can accomplish this for the parts subfile in the sample application. You will replace the part number in the parts list with a corresponding graphic. The graphic files names are the part numbers with the extension .gif; for example, the graphic for part number 000005 is stored in file 000005.gif.

All output fields in the record format are listed in the Choose a field list box.

Click the Insert field value push button. This will move the field name into the entry field File name. Since the part number is the name of the picture file, you just have to add the extension .gif to the File name and you are done.

The value that should be in the file name entry field is &{IID.value}.gif.

You need to copy the picture files to the WebFacing project directory structure in the workspace so that they can be found during run time. On the book's CD, the directory wf_book_pictures contains the picture files.

Your page should look like Figure 17.25.

Figure 17.25: Part list with pictures instead of part numbers

If the picture files cannot be found, the page will look like Figure 17.26.

Figure 17.26: List with picture files not found

I hope you can use this feature to enhance your WebFaced applications.

Категории