Oracle Forms : Reusable Components

Preview:

Citation preview

Sharing Objects and Code

http://ebiztechnics.blogspot.com

Objectives

• Describe the various methods for reusing objects and code• Inherit properties from property classes• Group related objects for reuse• Reuse objects from an object library• Reuse PL/SQL code

http://ebiztechnics.blogspot.com

Sharing & Reusing Code

• Increases productivity• Decreases maintenance• Increases modularity• Maintains standards

http://ebiztechnics.blogspot.com

Property Classes

Canvas

properties

Window

propertiesItem

properties

Alert

properties

LOV

properties

http://ebiztechnics.blogspot.com

Inherit Properties

• Set the Subclass Information property.• Convert an inherited property to a variant property.• Convert a variant property to an inherited property.

Inherited Property

Variant Property

http://ebiztechnics.blogspot.com

Object Group

• Is a logical container• Enables you to:

– Group related objects– Copy multiple objects in one operation

http://ebiztechnics.blogspot.com

Using Object Groups

• Blocks include:– Items– Item-level triggers– Block-level triggers– Relations

• Object groups cannot include other object groups• Deleting:

– An object group does not affect the objects– An object affects the object group

http://ebiztechnics.blogspot.com

Subclassing

Ability to make exactcopy of object

Ability to add to object

Abilityto alterproperties

A/C No:

Branch:

Balance:

A/C Type:

Open Date:

A/C No:

Branch:

Balance:

A/C No:

Branch:

Balance:

A/C No:

Branch:

Balance:

http://ebiztechnics.blogspot.com

Copying Objects

Ability to make exactcopy of object

A/C No:

Branch:

Balance:

A/C No:

Branch:

Balance:

http://ebiztechnics.blogspot.com

Inheriting Changes

Ability to Inherit changes

Ability to Inherit changes

Ability to Inherit changes

A/C No:

Branch:

Balance:

A/C Type:

Open Date:

A/C No:

Branch:

Balance:

A/C No:

Branch:

Balance:

A/C No:

Branch:

Balance:

Make changesTo Parent

http://ebiztechnics.blogspot.com

An Object Library

• Is a convenient container of objects for reuse• Simplifies reuse in complex environments• Supports corporate, project, and personal standards• Simplifies the sharing of reusable components• Appear in the Navigator if they are open• Are used with a simple tabbed interface• Are saved to .olb file or to database

http://ebiztechnics.blogspot.com

Advantages of Object Library

• Simplifies the sharing and reuse of objects• Provides control and enforcement of standards• Eliminates the need to maintain multiple referenced forms

http://ebiztechnics.blogspot.com

Smart Class

• Is an object in an object library that is frequently used as a class

• Can be applied easily and rapidly to existing objects

• Can be defined in many object libraries

You can have many Smart Classes of a given object type.

Note: Green check indicatessmart class

http://ebiztechnics.blogspot.com

Working with Smart Classes

1. Select an object in theLayout Editor or Navigator.

2. Click Right Mouse Button, From the pop-up menu,select Smart Classes.

3. Select a class from the list.

http://ebiztechnics.blogspot.com

Reusing PL/SQL

• Triggers:– Copy and paste text– Copy and paste within a module– Copy to or subclass from another module– Move to an object library

• PL/SQL program units:– Copy and paste text– Copy and paste within a module– Copy to or subclass in another module– Create a library module– Move to an object library

http://ebiztechnics.blogspot.com

PL/SQL Libraries

Procedures

Functions

Packages

PL/SQLLibrary

.pll or DatabaseForm Module

Menu ModuleReport ModuleGraphics Module

http://ebiztechnics.blogspot.com

Writing Code for Libraries

• A library is a separate module, holding procedures, functions, and packages.

• Direct references to bind variables are not allowed.• Use subprogram parameters for passing bind variables.• Use functions, where appropriate,

to return values.

http://ebiztechnics.blogspot.com

Creating PL/SQL Library

http://ebiztechnics.blogspot.com

Attaching PL/SQL Library

http://ebiztechnics.blogspot.com

Calling Subprograms

procedure p1( );

...function...

pack1.p2 ( );

Attached Libraries

Database

P1

P2

Calls

http://ebiztechnics.blogspot.com

Summary

• Reasons to share objects and code:– Increased productivity– Increased modularity– Decreased maintenance– Maintaining standards

• Property Class• Object Group• Object Library• PL/SQL Library

http://ebiztechnics.blogspot.com

Recommended