1 chapter 12: form builder objects and flexible code
TRANSCRIPT
![Page 1: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/1.jpg)
1
Enhanced Guide to Enhanced Guide to Oracle8iOracle8i
Chapter 12:Form Builder Objects and Flexible Code
![Page 2: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/2.jpg)
2
Object-Oriented Principles Object
Abstract representation of something in the real world
Class Group of objects with the same structure and
properties Class instance
Object that belongs to a specific class Inheritance
Specifies that when you create a new object, it inherits its structure and properties from its class
![Page 3: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/3.jpg)
3
Subclasses Classes that have similar
properties and structure of their parent class
Subclasses have specializations, which are properties that make them different than their parent class
![Page 4: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/4.jpg)
4
Form Builder Approaches For Creating Reusable Objects Property Classes Object Groups Object Libraries PL/SQL Libraries
![Page 5: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/5.jpg)
5
Property Classes Top-level Form
Builder objects that specify a collection of properties with specific values
Property classes can be associated with Form Builder objects to define object properties
![Page 6: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/6.jpg)
6
Creating a Property Class Approaches:
Create the property class based on an existing object
Explicitly create the property class object, and then define its properties and associated values
![Page 7: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/7.jpg)
7
Creating a Property Class Based on an Existing Object Create the object
and configure its properties as desired
In the object’s Property Palette, select the desired properties and then click the Property Class button on the toolbar to create the property class
![Page 8: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/8.jpg)
8
Creating a Property Class Explicitly Create the property class object in
the Object Navigator and open its Property Palette
To add a property, click the Add Property button
To remove a property, select the property and then click the Remove Property button
![Page 9: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/9.jpg)
9
Using Property Classes to Subclass Form Objects When you apply a property class to
a form object, the form object is subclassed to the property class
To subclass a form object, open the object’s Property Palette, and the the property class name in the Subclass Information dialog box
![Page 10: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/10.jpg)
10
Using the Subclass Information Dialog box Select whether
you are subclassing from an object or a property class
Select the property class name
![Page 11: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/11.jpg)
11
Object Groups Top-level form objects that contain groups of
objects that can be reused in different forms Examples of object types in object groups:
LOVs Data blocks Alerts
Object groups are created in a source from, and then subclassed into target forms
![Page 12: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/12.jpg)
12
Creating an Object Group Create a new
object group object in the form template
Rename the object group
![Page 13: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/13.jpg)
13
Adding Objects to an Object Group Create the
objects Drag and drop
the objects on the object group Object Group Children node
![Page 14: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/14.jpg)
14
Subclassing Object Groups in Target Forms Select the object group in the
source form Drag the object group to the
Object Groups node in the target form, drop the object group, and click the Subclass button
![Page 15: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/15.jpg)
15
Subclassing vs.Copying Objects When you subclass an object,
changes to original object are propagated to subclassed objects
When you copy an object, changes to original object do not affect subclassed objects
![Page 16: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/16.jpg)
16
Form With Objects Subclassed From Object Group
Subclassedobject groupSubclassed
objects
![Page 17: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/17.jpg)
17
Object Libraries Top-level Form
Builder objects that are independent of specific forms
Contain form objects that can be referenced in specific forms
![Page 18: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/18.jpg)
18
Creating an Object Library Create a new object library object
in Form Builder Save the object library file
File has an .olb extension Filename specifies object library
name
![Page 19: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/19.jpg)
19
Object Library Structure Consists of multiple library tabs
Tab pages that contain one or more similar object instances
![Page 20: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/20.jpg)
20
Creating and Configuring Tab Pages To create a new tab
page, select the Library Tabs node, and then click the Create button
Right-click the new tab page, and then click Property Palette to open the tab page Property Palette
Change the tab page Name and Label values
![Page 21: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/21.jpg)
21
Opening the Object Library Double-click the object library icon
to open the Object Library window
Library tabs
Object on tab page
![Page 22: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/22.jpg)
22
Adding Form Objects to Library Tab Pages
Create and configure the object in a source form
Open the source form Object Navigator and the Object Library window side-by-side Maximize the Object Navigator window Open the Object Library window, and then click
the Restore button so the Object Library appears in a window
Reposition the windows as necessary Drag and drop the object onto the Library
Tab page
![Page 23: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/23.jpg)
23
Window Configuration For Adding Objects
Object Navigator window
ObjectLibrary window
Objectto bestored inlibrary
![Page 24: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/24.jpg)
24
Using Object Library Objects in Forms Open the target form Object
Navigator and the Object Library window side-by-side
Drag and drop the object library object into the target form
Subclass the object into the target form
![Page 25: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/25.jpg)
25
SmartClasses Object library objects that are defined
as standard object types for an application
SmartClassed objects appear as selections on a pop-up menu when you create a new object and then right-click the object
Speeds up the process of using object libraries
![Page 26: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/26.jpg)
26
Creating a SmartClass Select the object in the object
library Click Object on the menu bar, and
then click SmartClass
Green checkindicates objectis a SmartClass
![Page 27: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/27.jpg)
27
Selecting a SmartClass
![Page 28: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/28.jpg)
28
PL/SQL Libraries Library of PL/SQL named program units
that can be used in forms Top-level Form Builder object that is not
associated with a specific form Specific program units can be attached
to forms Code is not part of form .fmb file Code is only loaded when program unit is
called
![Page 29: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/29.jpg)
29
Creating a PL/SQL Library in Form Builder Select the PL/SQL
Libraries node, and then click the Create button
Save the library in the file system Library name is
the same as the filename
File has a .pll extension
![Page 30: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/30.jpg)
30
Saving PL/SQL Library Files In general, PL/SQL library files
should be saved in the default PL/SQL library folder Path: Developer_Home\TOOLS\OPEN60
If you save a library file in a different location, that path and file must always be available when you open forms that reference the library
![Page 31: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/31.jpg)
31
Adding Program Units to PL/SQL Libraries Select the library Program Units
node, and then click the Create button
Select the named program unit type (procedure, function, package)
Type the program unit code in the PL/SQL Editor window
![Page 32: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/32.jpg)
32
Using PL/SQL Libraries in Forms Attach the library to the form Call the library program units from
form triggers
![Page 33: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/33.jpg)
33
Attaching a PL/SQL Library to a Form Select the form’s Attached Libraries
node, and then click the Create button Navigate to the library file and attach
the file If the library is saved in the default library
folder, click Yes to discard path information
If the library is not saved in the default library folder, click No to save path information
![Page 34: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/34.jpg)
34
Calling a Library Program Unit From a Form Trigger Reference the program unit and
pass the required parameters as specified in the attached library specification in the Object Navigator
![Page 35: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/35.jpg)
35
Calendar Windows Associated with a
form text item that displays date values
Allows the user to select a date
The selected date value is returned to the form text item
![Page 36: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/36.jpg)
36
Creating a Calendar Window Open the STNDRD20.OLB object
library and copy or subclass the Calendar object group into the form
Attach the CALENDAR.PLL PL/SQL library to the form
Create a trigger associated with the form text item that calls a procedure in the CALENDAR.PLL PL/SQL library
![Page 37: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/37.jpg)
37
Subclassing the Calendar Object Group Into the Form Open the target form Open the STNDRD20.OLB object
library Subclass the CALENDAR object
group into the target form
![Page 38: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/38.jpg)
38
Subclassing the Calendar Object Group Into the Form
![Page 39: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/39.jpg)
39
Attaching the CALENDAR.PLL PL/SQL Library to the Form
Create a new attached library object in the target form
Click Browser, select CALENDAR.PLL, click Open, and then click Attach to attach the library
![Page 40: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/40.jpg)
40
Creating a Trigger to Open the Calendar Window Create a Show Calendar button
next to the date text item Create the trigger to call the
GET_DATE procedure in the DATE_LOV package
![Page 41: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/41.jpg)
41
Creating a Trigger to Open the Calendar Window
![Page 42: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/42.jpg)
42
Flexible Code Allows you to create objects that
can be configured at runtime Approaches
Use system variables to retrieve and set system values
Use built-in subprograms that dynamically retrieve and set form object properties
![Page 43: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/43.jpg)
43
Using Built-in Subprograms to Create Flexible Code GET_ built-ins
Allow you to retrieve current object properties
SET_ built-ins Allow you to dynamically set object
properties
![Page 44: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/44.jpg)
44
GET_APPLICATION_PROPERTY Built-in
Returns information about the current Form Builder application
Syntax:GET_APPLICATION_PROPERTY(property_name);
![Page 45: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/45.jpg)
45
Retrieving Specific Object Properties Syntax:return_value := GET_object_PROPERTY (object_id | ‘object_name’, property_name);
![Page 46: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/46.jpg)
46
Retrieving Object ID ValuesUsing the FIND_ Built-ins Syntax:return_value := FIND_object(‘object_name’);
![Page 47: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/47.jpg)
47
Dynamically Setting Object Properties Syntax:SET_object_PROPERTY(object_id | ‘object_name’, property_name, property_value);
![Page 48: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/48.jpg)
48
Using Indirect Referencing to Write Flexible Code Direct referencing
Directly referencing a form object using the format :block_name.object_name
Indirect referencing Specifying block and item names in
single quotation marks Allows you to reference objects that
are not in the current form
![Page 49: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/49.jpg)
49
Commands For Indirect Referencing COPY
Indirectly sets the value of a form item
Syntax:COPY(value, ‘destination’);
Value: desired value Destination: form item
Format: block_name.item_name
![Page 50: 1 Chapter 12: Form Builder Objects and Flexible Code](https://reader036.vdocuments.site/reader036/viewer/2022070400/56649f0d5503460f94c20a37/html5/thumbnails/50.jpg)
50
Commands For Indirect Referencing NAME_IN
Indirectly retrieves the value of a form item
Syntax:return_value := NAME_IN(source);
Return_value: retrieved value Is always a character string
Source: form item Format: block_name.item_name