building oracle forms applications using designer 6i · 2 introduction oracle designer provides...

15
Building Oracle Forms Applications Using Designer 6i An Oracle Technical White Paper October 2000

Upload: doannguyet

Post on 25-Mar-2019

261 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Building Oracle Forms Applications Using Designer 6i · 2 INTRODUCTION Oracle Designer provides graphical design, generation, and reverse engineering facilities to visually ... An

Building Oracle Forms Applications UsingDesigner 6iAn Oracle Technical White PaperOctober 2000

Page 2: Building Oracle Forms Applications Using Designer 6i · 2 INTRODUCTION Oracle Designer provides graphical design, generation, and reverse engineering facilities to visually ... An

Building Oracle Forms Applications Using Designer 6iOctober 2000

2

INTRODUCTION

Oracle Designer provides graphical design, generation, and reverse engineering facilities to visuallymodel business processes and automatically generate Web-based applications. This paper shows youhow to use Oracle Designer to model, generate and manage a Web-based Oracle Forms 6iapplication that accesses an Oracle8i database. It illustrates how to create and customize OracleDesigner modules and components and shows you how to link them to various Oracle datasourceswithin a multi-tier architecture.

The paper looks at completing the application by implementing complex user-driven functionalityand detailed layout specifications using Oracle Forms 6i controls. It shows you how to implement anenterprise style guide using Oracle Designer, with Oracle Developer object libraries.

MODULES AND MODULE COMPONENTS

Modules are made up of module components. Each of these module components consists of tableusages, 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 aform module that has no module components as a launch window for calling other forms.

Figure 1. A Typical Oracle Designer 6i Module Diagram

Page 3: Building Oracle Forms Applications Using Designer 6i · 2 INTRODUCTION Oracle Designer provides graphical design, generation, and reverse engineering facilities to visually ... An

Building Oracle Forms Applications Using Designer 6iOctober 2000

3

Including Items

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

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

An unbound item definition records the use of an item by a generated application. The item isreferred to as unbound because its value cannot be derived from a single column on a table. Forexample, totals and summary fields can be implemented using unbound items. Each unbound item isrecorded in the context of a module component definition.

Adding Lists of Values

In Oracle Designer 6i an LOV component simplifies the process of LOV generation by separatingLOV and lookup table usage functionality as it existed in earlier versions of the product. The LOVcomponent controls the definition and generation of the LOV and record group in the form and thelookup table usage is now used simply to define items included or displayed in the form block.

This enables you to:

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

• Generate LOVs that are not associated to any item in the form. You can use application logic tolink an LOV to an item at runtime. This means you can define multiple LOVs for an item and thenswitch 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

Page 4: Building Oracle Forms Applications Using Designer 6i · 2 INTRODUCTION Oracle Designer provides graphical design, generation, and reverse engineering facilities to visually ... An

Building Oracle Forms Applications Using Designer 6iOctober 2000

4

USING ALTERNATIVE DATASOURCES

By default each module component you create has a table as a datasource and data target. If amodule component has a single base table and many lookup table usages, the generated blockrequires a further roundtrip to the server for each record retrieved, in order to populate any lookupitems. 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 isto base a block on a procedure stored on the server and to pass a PL/SQL table of records betweenthe 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 Builderfunctionality. Network traffic is reduced because the processing normally done by Form Builderusing 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 baseblocks by generating the Server API. The Server API consists of the Table API (TAPI) and theModule 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 queryoperations 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 thisTAPI. Using a TAPI helps to protect the integrity of the data.

CONTROLLING LAYOUT

In the Design Editor, you can view a module using the display view, providing a means to define andmanipulate 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 themanipulation of windows, canvases, action items for navigation between windows, canvases andmodules 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 thesecond window, the canvas shows two tabbed canvases.

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 asubset of the information displayed on the entire tab canvas.

Page 5: Building Oracle Forms Applications Using Designer 6i · 2 INTRODUCTION Oracle Designer provides graphical design, generation, and reverse engineering facilities to visually ... An

Building Oracle Forms Applications Using Designer 6iOctober 2000

5

A tab canvas can have many tab pages, and must have at least one. Think of tab pages as the foldersin a filing system. Each individual tab page (folder) has a labeled tab that developers and end usersclick 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 tabcanvas, roughly equal to the size of the canvas itself. This layering of related canvas sections enablesyou to display more information on a single canvas.

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

Side by Side Blocks

In earlier versions of Oracle Designer there was no declarative way of defining a layout with blockslaid out side by side. By default, Form Generator places the second and subsequent blocks on thesame canvas below the previous blocks on that canvas. In order to achieve side by side layout youneeded to generate each of the blocks on a separate stacked canvas and then write application logicto display the canvases in the correct place. In Oracle Designer 6i you can position a ModuleComponent next to another. To do this there is a value for the module component placementproperty ‘Right of’ and a property ‘Right of Component’ which specifies the name of the modulecomponent which this one is to the right of.

Page 6: Building Oracle Forms Applications Using Designer 6i · 2 INTRODUCTION Oracle Designer provides graphical design, generation, and reverse engineering facilities to visually ... An

Building Oracle Forms Applications Using Designer 6iOctober 2000

6

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

ModuleComponent

PlacementProperty

Right ofComponent

Dept New ContentEmp Right of DeptAcc 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

Multi-Region Blocks

It has been a long-standing restriction that the Oracle Form generator can only generate a block in asingle window. In a more recent version of Oracle Designer we introduced the ability to split a blockover more than one canvas using stacked item groups. Until Oracle Designer 6i there has been a rulethat each Module Component in a module results in a separate block in the generated form. We havechanged this to allow two or more module components, based on the same table usage, to be linkedto indicate that they should result in a single block in the form. This allows each module componentto have different layout options. You can place each module component in different windows orcanvases, and have different preference settings etc. One example of how you might use this is tohave a block where some items in the block display multiple rows as a select mechanism, and thenhave 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 eachmodule 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:

Page 7: Building Oracle Forms Applications Using Designer 6i · 2 INTRODUCTION Oracle Designer provides graphical design, generation, and reverse engineering facilities to visually ... An

Building Oracle Forms Applications Using Designer 6iOctober 2000

7

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

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

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

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

In Figure 5, there are two module components linked by a ‘module sub component link’. The threecases show the alternate layouts of tabbed canvases, two different canvases in one window anddifferent canvases in separate windows.

Module SubComponent LinkModule SubComponent LinkModule SubComponent Link

Window 1

Tab 1

Window 1

Window 1

Window 2

Figure 5. Alternative Oracle Form Layouts

FINE TUNING YOUR LAYOUT USING RELATIVE TAB STOPS

In Oracle Designer 6i, there is a GUI layout editor for defining the relative tab stops. The tool allowsyou to graphically create the layout you desire by defining tab stops and then dragging items to thetab stops. It allows you to get an accurate picture of the layout before generation occurs, thusspeeding up development by reducing the number of iterations of generation to get the desiredlayout. It means you have better control over the vertical alignment of generated items, but withouthaving to specify physical X and Y positions.

Oracle Designer 6i has two item properties in the repository to name the relative tab stop for thestart and end of an item. If the user assigns relative tabs to items then the generator will verticallyalign items with the same named relative tab. This feature only makes sense for blocks displayed overmore that one line and the alignment is restricted within a block. The relative tab for the end of an

Page 8: Building Oracle Forms Applications Using Designer 6i · 2 INTRODUCTION Oracle Designer provides graphical design, generation, and reverse engineering facilities to visually ... An

Building Oracle Forms Applications Using Designer 6iOctober 2000

8

item is used in a similar way but allows the generator to override display lengths in the repository andmark the end of items align as well as the beginning. This mechanism should significantly improvethe productivity of creating the desired layout.

Figure 6. The Oracle Designer 6i Relative Tab Stops Editor

In Figure 6 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 wouldprobably required the use of hidden item groups. This relative tab stop mechanism is also extendedto item groups and blocks so it is possible to align across these objects.

ADDING NAVIGATOR STYLE FORMS (TREE CONTROL)The Tree control is increasingly becoming a major part of any UI design; Oracle Forms has addednative support for this feature in Oracle Forms 6.0. In Oracle Designer 6i the developer will mark themodule’s ‘Layout Style’ as ‘Tree Control’ and create the desired module structure.

Figure 7 shows the module design for the generated runtime form (shown in Figure 8 that includesthe tree control. The Module Components ‘Departments’ and ‘Products’ are the top nodes in the treecontrol. The ‘Departments’ node has a child module component ‘Employees’, which in turn has achild 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 userdouble-clicks on a node in the tree or an instance of the data under that node. Therefore if the userdouble-clicks on an employee name it would display a window containing the Employee block withthat employee’s record.

Page 9: Building Oracle Forms Applications Using Designer 6i · 2 INTRODUCTION Oracle Designer provides graphical design, generation, and reverse engineering facilities to visually ... An

Building Oracle Forms Applications Using Designer 6iOctober 2000

9

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

Page 10: Building Oracle Forms Applications Using Designer 6i · 2 INTRODUCTION Oracle Designer provides graphical design, generation, and reverse engineering facilities to visually ... An

Building Oracle Forms Applications Using Designer 6iOctober 2000

10

Figure 8. A Generated Form Navigator with Style Tree Control

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

USING JAVA PLUGGABLE COMPONENTS AND ITEMS OF TYPE BEAN AREA

JavaBeans and Java Pluggable Components are self-contained program units that are written in Javaand may conform to the JavaBean specification. For example, a JavaBean might implement a controlsuch as a calculator or spreadsheet, or might display an animated image.

You can integrate JavaBeans with an Oracle Forms application to perform specialized functions thataugment the application's capabilities. To integrate correctly with an Oracle Forms application, youmust 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 standardwidgets 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 ofgenerated applications. You could use them for prototyping purposes when module specifications arenot 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. Forexample, 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 buttonsdisplayed horizontally.

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

You can place groups of preferences in generator preference sets and then apply these to all or partof 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 createsgenerated objects by either copying or subclassing from properties of source objects in an objectlibrary.

You will typically want generated objects to inherit their properties from source objects, although youcan direct Form Generator to use preference settings, templates or repository information instead.

Page 11: Building Oracle Forms Applications Using Designer 6i · 2 INTRODUCTION Oracle Designer provides graphical design, generation, and reverse engineering facilities to visually ... An

Building Oracle Forms Applications Using Designer 6iOctober 2000

11

But because source objects have all the properties of generated objects, using source objects enablesyou to set generated object properties that cannot be set by using preferences or repositoryinformation.

The Form Generator copies or subclasses properties from objects in object libraries into generatedobjects. An object library object contains all the properties of generated objects. By using an objectlibrary you can standardize and reuse objects across modules and applications, setting properties inOracle Designer to incorporate a style

The Form Generator uses a standard source object when it is creating a particular type of generatedobject. All standard source objects are prefixed with CGSO$. The rest of the object’s name describesthe generated item for which it can be the source. There is a predefined hierarchy of standard objectsthat 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 libraryobject from which to copy or subclass properties. If the Form Generator does not find the object itwants 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 methodsare similar, but a subclassed object maintains a link to its source object. This allows you to efficientlyreuse objects and enforce standards. If you decide to change the standard for an object you canchange it in the object library. All subclassed objects inherit the change when you next recompile theform. This alleviates the need to regenerate modules.

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

INCORPORATING USER DEFINED APPLICATION LOGIC

Within Oracle Designer developers can record application logic or ‘custom code’ within the OracleRepository, and have the generators embed that code within generated applications. This reduces theneed for post-generation alterations to generated code and greatly improves the manageability andmaintainability of systems developed using Oracle Designer.

The Oracle Repository allows you to store and define application logic by holding the event modelfor each target language. For the Oracle Forms Generator this means that you can define logic atform, block and item level. The event points for Oracle Forms generation are the standard OracleForms 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 aretypically 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 logicand thus be automatically generated into any form that uses that module component. Another majorbenefit of named routines is that for Oracle Developer Forms and Reports, Oracle Designer allowsmodules of type ‘Library’ to be defined which are wholly made up of named routines. There is agenerator that generates Oracle Developer libraries from these definitions. To complement this youwill also be able to use the module structure diagram to specify the attachment of libraries togenerated Forms.

Page 12: Building Oracle Forms Applications Using Designer 6i · 2 INTRODUCTION Oracle Designer provides graphical design, generation, and reverse engineering facilities to visually ... An

Building Oracle Forms Applications Using Designer 6iOctober 2000

12

RUNNING YOUR FORM ON THE WEB

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 aserver. The form Generator creates an HTML file containing runtime parameters to pass to the WebPreviewer. You can set a number of preferences to control the HTML file parameters. In Figure 9the form has been generated using an object library to provide a web look and feel.

Figure 9. A Form Generated for the Web Using an Object Libraryfor Look and Feel

MANAGING A COMPLEX APPLICATION USING ORACLE DESIGNER 6I

Repository Files and Folders

In Oracle Designer 6i the repository has been extended to hold and version any file type. This isuseful for generating forms as it allows any files that are needed by the generated form, which cannotbe currently held in Oracle Designer, to be stored. Examples are user-exits, icon files, Java classes,templates, etc. These files can also be included in configurations, thus allowing the storage andconfiguration management of both structured data and any other file types.

During Oracle Forms generation it is possible to check out templates and object libraries, etc. fromthe Oracle Repository to use them during generation rather than relying on them being on the filesystem. It is also possible to check in the generated form automatically into the repository instead ofplacing it on the file system.

Page 13: Building Oracle Forms Applications Using Designer 6i · 2 INTRODUCTION Oracle Designer provides graphical design, generation, and reverse engineering facilities to visually ... An

Building Oracle Forms Applications Using Designer 6iOctober 2000

13

Dependency Analysis

Another major repository change is extended support for detailed impact analysis. This allows you todetermine which tables and columns a form module uses. This type of dependency information willneed to be extracted for all types of design information held in the repository, so that you can answerthe two questions typically asked:

• Tell me all objects, files and definitions that use something, i.e. Tell me everything that uses aspecified column, or procedure, for example.

• Tell me all the objects, files and definitions that something uses, i.e. Tell me all the tables, columns,procedures that an Oracle Forms module uses, for example.

Oracle Designer 6i provides parsers that extract the dependency information from Oracle Forms,libraries, server side PL/SQL procedures and other file types. There is a UI that displays thedependency information in a way that makes it easy to see the effect of design changes and makes iteasier to manage those changes.

For an Oracle Form the types of dependencies that can be tracked are:

• Table, view, snapshot and column usages

• Attached libraries

• Subclassed object library objects

• Subclassed objects from other Oracle Forms

• Icon files referenced

• PLSQL procedures and functions called

• Menus files used

• Javabeans and Pluggable components used

In Figure 10 the Dependency Manager UI shows the dependencies for the Oracle Form file‘LOCATIONS_NAV.fmb’.

The file has been selected in the left-hand pane and the right hand pane shows the dependencies.This example shows the power of this tool as it not only shows the tables and columns used by theform, but also lists the icon file, libraries, sequences and PL/SQL procedures used. There are manyother dependencies that could be seen by scrolling in this window, such as explicit columns used,object library objects subclassed etc.

Moreover, this form also uses a number of PL/SQL subroutines and calls other library files that arenot currently available. These are listed as missing. Once again you can see how you could use thismechanism not only to determine the impact of changes you make to tables on the modules thatdepend on them, but also for release management.

This functionality will improve the ability of large enterprise development teams to efficientlymanage their application development and release environment, and to ensure higher qualitysoftware. It should be noted that even if you do not use the traditional Oracle Designer modelingand code generation, the dependency analysis architecture allows development teams use to equallyrealize the benefits of dependency analysis.

Page 14: Building Oracle Forms Applications Using Designer 6i · 2 INTRODUCTION Oracle Designer provides graphical design, generation, and reverse engineering facilities to visually ... An

Building Oracle Forms Applications Using Designer 6iOctober 2000

14

Figure 10. Impact Analysis Using the Dependency Manager

SUMMARY

Oracle Designer 6i offers a ‘fast track’ approach to designing and generating your Oracle Forms 6iApplications. Oracle Designer 6i gives you a powerful, flexible environment for designing thecontent and layout of your applications.

Functionality such as tabbed canvases, side by side blocks, multi-region blocks and navigator styletree controls enable you to produce a wide range of cutting edge forms designs. Rapidly creating webapplications is easy and efficient with the ability to run Oracle Forms on the web and add JavaBeansand Java Pluggable Components, for example, a calculator or spreadsheet.

Generator preferences control the appearance and behavior of the generated application, whileobject libraries enable you to implement a pre-defined style guide consistently across the application.

Oracle Designer 6i support for storing files and folders (in Oracle Repository) and analyzing theimpact of changes to Oracle Forms based on their dependencies provides a complete, productive andflexible environment for developing and managing your application.

Page 15: Building Oracle Forms Applications Using Designer 6i · 2 INTRODUCTION Oracle Designer provides graphical design, generation, and reverse engineering facilities to visually ... An

Oracle CorporationWorld Headquarters500 Oracle ParkwayRedwood Shores, CA 94065U.S.A.

Worldwide Inquiries:+1.650.506.7000Fax +1.650.506.7200http://www.oracle.com/

Copyright © Oracle Corporation 1999All Rights Reserved

This document is provided for informational purposes only, andthe information herein is subject to change without notice.Please report any errors herein to Oracle Corporation. OracleCorporation does not provide any warranties covering andspecifically disclaims any liability in connection with thisdocument.

Oracle is a registered trademark, and Oracle8i, PL/SQL, OracleDesigner 6i, and Oracle Repository are trademarks of OracleCorporation. All other company and product names mentionedare used for identification purposes only and may be trademarksof their respective owners.