+ All Categories
Home > Documents > Building Oracle Forms Applications Using Oracle9i … · Controlling Layout ... difference between...

Building Oracle Forms Applications Using Oracle9i … · Controlling Layout ... difference between...

Date post: 18-May-2018
Category:
Upload: lyphuc
View: 248 times
Download: 4 times
Share this document with a friend
16
Building Oracle Forms Applications Using Oracle9i Designer or Oracle Designer 6i An Oracle White Paper August 2002
Transcript

Building Oracle Forms Applications Using Oracle9i Designer or Oracle Designer 6i An Oracle White Paper August 2002

Building Oracle Forms Applications Using Oracle9i Designer or Oracle Designer 6i

Executive Overview.......................................................................................... 3 Introduction ....................................................................................................... 3 Modules and Module Components ................................................................ 3

Including Items ............................................................................................. 3 Adding Lists of Values................................................................................. 4

Controlling Layout ............................................................................................ 5 Tabbed Canvases .......................................................................................... 6 Side by Side Blocks....................................................................................... 6 Multi-Region Blocks..................................................................................... 7 Fine Tuning Your Layout Using Relative Tab Stops .............................. 9 Adding Navigator Style Forms (Tree control)........................................ 10 Using Java Pluggable Components and Items of Type Bean Area ..... 11

Influencing Generation .................................................................................. 12 Using Generator Preferences .................................................................... 12 Using an Object Library to Implement a Style Guide........................... 12 Incorporating User Defined Application Logic ..................................... 13

Using Alternative Datasources ...................................................................... 14 Running a Form Using the Web Previewer ................................................ 15 Conclusion........................................................................................................ 15

Building Oracle Forms Applications Using Oracle9i Designer or Oracle Designer 6i Page 2

EXECUTIVE OVERVIEW Oracle Designer provides graphical design, generation, and reverse engineering facilities to visually model business processes and automatically generate Web-based applications. This paper shows you how to use Designer to model and generate an Oracle Forms application. It illustrates how to create and customize Oracle Designer modules and components and shows you how to link them to various Oracle datasources within a multi-tier architecture

INTRODUCTION Oracle9i Designer is a part of Oracle9i Developer Suite (9iDS). The major difference between this version of Oracle Designer and Oracle Designer 6i is the ability to support client-server application generation. Oracle9i Designer generates Oracle9i Forms Developer applications. Oracle9i Forms Developer does not support client-server applications and hence neither does Oracle9i Designer. If you want to generate client-server forms applications, stay with Oracle Designer 6i. All bug fixes made in Oracle9i Designer will be included in Oracle Designer 6i. The techniques described in this paper apply equally to both versions of Designer.

MODULES AND MODULE COMPONENTS An Oracle Forms application can be made up of many modules. These are predominately form modules but might also include menu and library modules. Form modules are made up of module components. Each of these module components consists of table usages, base table and lookup table usages, that you can link using foreign key links or lookup links. A form module should contain at least one module component and can have many. You could use a form module that has no module components as a launch window for calling other forms.

You use Oracle Designer’s Design Editor to model and develop your modules. A module can be developed graphically using its Data and Display diagrams. Use the Data viewer to edit the data usages of module components that make up a module. Use the Display viewer to edit the display characteristics (window and canvas placement etc.) of those data usages and any non-data items (such as buttons).

Including Items A bound item records the use of a database column by a generated application. Create each bound item in the context of a module component table usage and specify how the column is used by a generated application.

A bound item is always directly mapped to a single database column. They are displayed on the Data view of a diagram as shown in Figure 1. They are shown on Display view only if they are to be displayed on generated applications.

An unbound item definition records the use of an item by a generated application. The item is referred to as unbound because its value cannot be derived from a single column on a table. For example, totals and summary fields can be

Building Oracle Forms Applications Using Oracle9i Designer or Oracle Designer 6i Page 3

implemented using unbound items. Each unbound item is recorded in the context of a module component definition.

Figure 1. A Typical Oracle9i Designer Data Module Diagram

Adding Lists of Values Oracle Designer 6i introduced the LOV component and simplified the process of LOV generation by separating LOV and lookup table usage functionality as it existed in earlier versions of the product. The LOV component controls the definition and generation of the LOV and record group in the form and the lookup table usage is used simply to define items included or displayed in the form block. Figure 2 shows an LOV component (Departments_LOV) and its use on the DEP_NO item.

This enables you to:

• Define multiple LOVs for the same block and also define different LOVs for query and data entry linked to the same FK item.

Building Oracle Forms Applications Using Oracle9i Designer or Oracle Designer 6i Page 4

• Generate LOVs that are not associated to any item in the form. You can use application logic to link an LOV to an item at runtime. This means you can define multiple LOVs for an item and then switch the LOV according to some context.

• Reuse the same LOV definition in multiple blocks and multiple forms.

Figure 2. Adding Lists of Values to Module Diagrams

CONTROLLING LAYOUT In the Design Editor, you can view a module using the display view, providing a means to define and manipulate the items that provide the user interface elements of the application.

The display view allows the manipulation of user interface information such as prompts and also the manipulation of windows, canvases, action items for navigation between windows, canvases and modules and item groups for logical grouping of display items in bound areas of the display.

In Figure 3 the display view is shown, displaying two windows, each containing a canvas. In the second window, the canvas shows two tabbed canvases.

Building Oracle Forms Applications Using Oracle9i Designer or Oracle Designer 6i Page 5

Figure 3. Windows, Canvases and Tabbed Canvases on a Module Diagram

Tabbed Canvases Using a tab canvas you can group and display a large amount of related information on a single, dynamic canvas object. Like stacked canvases, tab canvases are displayed on top of a content canvas, partly obscuring it. A tab canvas is made up of one or more tab pages. Tab pages each display a subset of the information displayed on the entire tab canvas.

A tab canvas can have many tab pages, and must have at least one. Think of tab pages as the folders in a filing system. Each individual tab page (folder) has a labeled tab that developers and end users click to access the page. You click the labeled tab to display the page at the front of the tab canvas, thereby obscuring any other page(s). Each tab page occupies an equal amount of space on the tab canvas, roughly equal to the size of the canvas itself. This layering of related canvas sections enables you to display more information on a single canvas.

Side by Side Blocks In earlier versions of Oracle Designer there was no declarative way of defining a layout with blocks laid out side by side. By default, Form Generator places the

Building Oracle Forms Applications Using Oracle9i Designer or Oracle Designer 6i Page 6

second and subsequent blocks on the same canvas below the previous blocks on that canvas. In order to achieve side by side layout you needed to generate each of the blocks on a separate stacked canvas and then write application logic to display the canvases in the correct place. Since Oracle Designer 6i you have been able to position a Module Component next to another. Use the module component placement property ‘Right of’ and a property ‘Right of Component’ which specifies the name of the module component that this one is to the right of.

Module Component

Placement Property

Right of Component

Dept New Content

Emp Right of Dept

Acc Right of Dept

Window 1

Employee Detailsxxxxxxx xx xx

xxx

xxxxx

xxx xxxxxxx

Accountsxxxxxx xx

xxx

xxxxxxx

List of Departmentsxxxx xxxxx xxxxx xxx

Figure 4. Side by Side Blocks in Oracle Forms

With this feature you can layout any number of blocks horizontally across any canvas. In Figure 4 the example shows a layout where the Employee and Accounts block are both to the right of the Departments block.

Multi-Region Blocks It has been a long-standing restriction that the Oracle Form generator can only generate a block in a single window. In a more recent version of Oracle Designer we introduced the ability to split a block over more than one canvas using stacked item groups. Until Oracle Designer 6i there was a rule that each Module Component in a module resulted in a separate block in the generated form. We changed this to allow two or more module components, based on the same table usage, to be linked to indicate that they should result in a single block in the form. In Figure 5, there are two module components linked by a ‘module sub component link’. This allows each module component to have different layout options. You can place each module component in different windows or canvases, and have different preference settings etc. One example of how you might use this is to have

Building Oracle Forms Applications Using Oracle9i Designer or Oracle Designer 6i Page 7

a block where some items in the block display multiple rows as a select mechanism, and then have a second window that contains a single row detail for the highlighted row in the first window. By using multiple module components to define one generated block you can specify for each module component, where its items are to be laid out, i.e.:

• Different places on the same canvas

• Different canvases in the same window

• Different canvases in different windows

You generate a multi-region block by defining:

• A primary module component with one base table usage and (optionally) one or more lookup table usages

• One or more module sub components, each with a usage of the same base table as the primary module component, and (optionally) each with one or more lookup table usages.

Module SubComponent LinkModule SubComponent LinkModule SubComponent Link

Figure 5. Module Components Linked by a Module Sub Component Link

Form Generator creates a rectangular layout region for the primary module component and for each module sub component. Although they contain items based on columns from the same table, the different layout regions can display different numbers of rows. The data in different regions in a multi-region block is always synchronized (i.e. the regions all display data for the same current record).

You can create bound items based on the same columns as bound items in the primary module component (or any other module sub-component). Note that Form Generator will generate second and subsequent items as mirror items. Also note the standard source objects for these mirror items will be the same as for the first bound item (i.e. not CGSO$CONTEXT, which is the usual standard source object for mirror items.)

Building Oracle Forms Applications Using Oracle9i Designer or Oracle Designer 6i Page 8

In Figure 5, there are two module components linked by a ‘module sub component link’. The three cases in Figure 6 show the alternate layouts that can be generated from that module diagram of tabbed canvases, two different canvases in one window and different canvases in separate windows.

Window 1

Tab 1

Window 1

Window 2

Window 1

Figure 6. Alternative Oracle Form Layouts Resulting from the Module and Module Sub Component in Figure 5

Fine Tuning Your Layout Using Relative Tab Stops Since Oracle Designer 6i there has been a GUI layout editor for defining relative tab stops. The tool allows you to graphically create the layout you desire by defining tab stops and then dragging items and item groups to the tab stops. It allows you to get an accurate picture of the layout before generation occurs, thus speeding up development by reducing the number of iterations of generation to get the desired layout. It means you have better control over the vertical alignment of generated items, but without having to specify physical X and Y positions.

There are two item properties in the repository to name the relative tab stop for the start and end of an item or item group. If the user assigns relative tabs to items then the generator will vertically align items with the same named relative tab. This feature only makes sense for blocks displayed over more that one line. The relative tab for the end of an item is used in a similar way but allows the generator to override display lengths in the repository and mark the end of items align as well as the beginning. You can set the scope of tab stops for each module component (or sub-component) so that items and item groups are aligned only within the specific module component or across multiple components in a module. In Figure 7 there are a number of relative tab stops used and you can see how items can be aligned. Before Oracle Designer 6i it would have been very difficult to generate this layout and would probably required the use of hidden item groups.

Building Oracle Forms Applications Using Oracle9i Designer or Oracle Designer 6i Page 9

Figure 7. The Oracle Designer Relative Tab Stops Editor

Adding Navigator Style Forms (Tree control) The Tree control is increasingly becoming a major part of any UI design. You can mark the module’s ‘Layout Style’ as ‘Tree Control’ and create the desired module structure.

Figure 8 shows the module design for the generated runtime form (shown in Figure 9 that includes the tree control. The Module Components ‘Departments’ and ‘Products’ are the top nodes in the tree control. The ‘Departments’ node has a child module component ‘Employees’, which in turn has a child component of ‘Addresses’. This defines the nodes and sub nodes of the tree control.

Each module component still defines the items and layout of the block displayed when the user double-clicks on a node in the tree or an instance of the data under that node. Therefore if the user double-clicks on an employee name it would display a window containing the Employee block with that employee’s record.

You can control the general look and feel of the tree control using preferences and standard object library objects. To implement more advanced processing within the tree control, such as drag and drop between nodes, you have to add your own application logic to the module definition.

Building Oracle Forms Applications Using Oracle9i Designer or Oracle Designer 6i Page 10

Figure 8. Module Design for Runtime Form with Navigator Style Tree Control

Figure 9. A Generated Navigator Style Tree Control Form

Using Java Pluggable Components and Items of Type Bean Area JavaBeans and Java Pluggable Components are self-contained program units that are written in Java and may conform to the JavaBean specification. For example, a

Building Oracle Forms Applications Using Oracle9i Designer or Oracle Designer 6i Page 11

JavaBean might implement a control such as a calculator or spreadsheet, or might display an animated image.

You can integrate JavaBeans with an Oracle Forms application to perform specialized functions that augment the application's capabilities. To integrate correctly with an Oracle Forms application, you must provide a Java container for the JavaBean. This container (sometimes also called a wrapper) must implement an Oracle Forms-defined interface, called the IView interface.

The aim of Java pluggable components is to allow the look and feel of Oracle Forms standard widgets to be customized. This is increasingly important when developing a UI for use on the web.

INFLUENCING GENERATION

Using Generator Preferences Generator preferences are parameters that you can use to control the appearance and behavior of generated applications. You could use them for prototyping purposes when module specifications are not fully defined.

In general, all modules within an application should have similar behavior and appearance. Sometimes, however, an individual module will have a requirement for a unique feature. For example, the standard for your application may be that all radio groups are arranged vertically, but, for a particular instance of a radio group in a generated application, you may want the radio buttons displayed horizontally.

You can set generator preferences at various levels, allowing global and local customization of applications that are to be generated from an application system. For example, you can set preferences at the highest level (application system) so that they are incorporated in all generated applications. In addition, they can be set at lower levels (modules, for example), so that you can customize specific modules.

You can place groups of preferences in generator preference sets and then apply these to all or part of an application system.

Using an Object Library to Implement a Style Guide When you generate forms using Form Generator, you can specify that Form Generator creates generated objects by either copying or subclassing from properties of source objects in an object library.

You will typically want generated objects to inherit their properties from source objects, although you can direct Form Generator to use preference settings, templates or repository information instead. But because source objects have all the properties of generated objects, using source objects enables you to set generated object properties that cannot be set by using preferences or repository information.

The Form Generator copies or subclasses properties from objects in object libraries into generated objects. An object library object contains all the properties of

Building Oracle Forms Applications Using Oracle9i Designer or Oracle Designer 6i Page 12

generated objects. By using an object library you can standardize and reuse objects across modules and applications, setting properties in Oracle Designer to incorporate a style

The Form Generator uses a standard source object when it is creating a particular type of generated object. All standard source objects are prefixed with CGSO$. The rest of the object’s name describes the generated item for which it can be the source. There is a predefined hierarchy of standard objects that the Form Generator uses to decide on the standard object for use in generation.

At generation the Form Generator analyzes each item in a module to determine the object library object from which to copy or subclass properties. If the Form Generator does not find the object it wants in the object library it searches for the parent of that object and uses that instead

Although you can copy or subclass objects it is recommended that you subclass. The two methods are similar, but a subclassed object maintains a link to its source object. This allows you to efficiently reuse objects and enforce standards. If you decide to change the standard for an object you can change it in the object library. All subclassed objects inherit the change when you next recompile the form. This alleviates the need to regenerate modules.

You can explicitly specify that the Form Generator uses an implementation source object, rather than a standard source object, when generating a particular item. There are two types of implementation source object: • A shipped implementation source object which provides default Oracle Forms functionality and has names prefixed with CGAI$ • A user-defined implementation source object which you can define and name yourself.

Incorporating User Defined Application Logic Within Oracle Designer developers can record application logic or ‘custom code’ within the Oracle Designer repository (Oracle Software Configuration Manager (SCM)), and have the generators embed that code within generated applications. This reduces the need for post-generation alterations to generated code and greatly improves the manageability and maintainability of systems developed using Oracle Designer.

Oracle SCM allows you to store and define application logic by holding the event model for each target language. For the Oracle Forms Generator this means that you can define logic at form, block and item level. The event points for Oracle Forms generation are the standard Oracle Forms triggers such as WHEN-VALIDATE-ITEM and PRE-INSERT etc.

You can also define ‘Named Routines’. Think of these as ‘Program Units’ in Oracle Forms and are typically procedures, functions and packages. For a form module you can define these at module, module component and item levels allowing them to be encapsulated with the object they support. Thus a reusable module component can encapsulate named routines that support its business logic and thus

Building Oracle Forms Applications Using Oracle9i Designer or Oracle Designer 6i Page 13

be automatically generated into any form that uses that module component. Another major benefit of named routines is that for Oracle Developer Forms and Reports, Oracle Designer allows modules of type ‘Library’ to be defined which are wholly made up of named routines. There is a generator that generates Oracle Developer libraries from these definitions. To complement this you will also be able to use the module structure diagram to specify the attachment of libraries to generated Forms.

USING ALTERNATIVE DATASOURCES By default each module component you create has a table as a datasource and data target. If a module component has a single base table and many lookup table usages, the generated block requires a further roundtrip to the server for each record retrieved, in order to populate any lookup items. A more efficient alternative is to base a block containing lookup items on a view or on a sub-query, that comprises columns from both the base table and the lookup table. A further alternative is to base a block on a procedure stored on the server and to pass a PL/SQL table of records between the block and the procedure. It is the procedure that queries and performs DML on the base table. When you specify a data source or data target that is not a table, you replace the default Form Builder functionality. Network traffic is reduced because the processing normally done by Form Builder using post-query and commit-time triggers is bundled into the API logic.

An Oracle Designer utility enables you to create suitable server-side procedures on which to base blocks by generating the Server API. The Server API consists of the Table API (TAPI) and the Module Component API (MAPI)

The TAPI provides the table with PL/SQL packages to:

• Perform the DML processing on the table.

• Provide data checking on the table.

• Allow for additional customized application logic to be added through event code segments.

The MAPI is a set of packages made up of procedures for the insert, update, delete, lock, and query operations used by views and procedures that:

• Are called from generated forms so that the data in queries can be sent using an array of records, and in DML can be received using a PL/SQL table of records.

• Allow for additional customized application logic to be added through event code segments.

Once a TAPI has been generated for a table, all future DML on the table will occur through this TAPI. Using a TAPI helps to protect the integrity of the data.

Building Oracle Forms Applications Using Oracle9i Designer or Oracle Designer 6i Page 14

RUNNING A FORM USING THE WEB PREVIEWER The Web Previewer enables you to run forms as though they are being deployed from a Web server. Use the Web Previewer as a tool to test your forms without having to actually deploy the forms on a server. This functionality is available from both Oracle9i Designer and Oracle Designer 6i. Of course, in Oracle Designer 6i you have the ability to run the form in client server mode too. The form Generator creates an HTML file containing runtime parameters to pass to the Web Previewer. You control these HTML parameters though a set of preferences.

CONCLUSION Oracle Designer provides graphical design and generation facilities to visually model and automatically generate Oracle Forms applications. You can create and customize Oracle Designer modules and components to generate complex, rich forms using various Oracle datasources. Through the use of preferences, object libraries and reusable components you can create develop and maintain design and generation standards for your Oracle Forms applications. Using the web previewer you can run and test your forms over a web browser without the need for a Forms Server. Using Oracle Designer 6i you can continue to generate client/server forms. Oracle Designer gives you a productive, iterative development environment for your Oracle Forms generation projects.

Building Oracle Forms Applications Using Oracle9i Designer or Oracle Designer 6i Page 15

Building Oracle Forms Applications Using Oracle9i Designer or Oracle Designer 6i 2002 Author: Susan Duncan Oracle Corporation World Headquarters 500 Oracle Parkway Redwood Shores, CA 94065 U.S.A. Worldwide Inquiries: Phone: +1.650.506.7000 Fax: +1.650.506.7200 www.oracle.com Oracle is a registered trademark of Oracle Corporation. Various product and service names referenced herein may be trademarks of Oracle Corporation. All other product and service names mentioned may be trademarks of their respective owners. Copyright © 2002 Oracle Corporation All rights reserved.


Recommended