, ,

Fundamentals of object sharing in Oracle Forms 10g

This article is all about the fundamentals of sharing the objects in Oracle Forms , its benefits and the various ways to do it. It will describes the various methods for reusing objects – Property Classes, Copying and Subclassing Objects and Code, Object Groups, Object Libraries and  SmartClasses.
When you share and reuse objects and code, you increase productivity, decrease maintenance, increase modularity, and improve the performance of your applications. When you are developing applications, you should share and reuse objects and code wherever possible.
There are many advantages of sharing and reusing objects and code.
  • You can develop applications much more effectively and efficiently if you are not trying to “start over” each time you write a piece of code. By sharing and reusing frequently used objects and code, you can cut down development time and increase productivity.
  • You can decrease maintenance time by creating applications that use or call the same object or piece of code several times.
  • You can maintain standards by reusing objects and code.
To maximize reuse, the developer should apply the following guidelines in the order shown:
  • Accept default properties as much as possible
  • Use SmartClasses to describe an object
  • Use sets of visual attributes
 Now lets discuss the various methods of object sharing:
A) Property Class 
A property class is a named object that contains a list of properties and their settings. You can use property classes to increase productivity and improve network performance.

 Here are some of the uses of a property class:
  • It increases productivity by setting standard or frequently used values for common properties and associates them with several form builder objects.
  • It defines standard properties not just for one particular object but also for several at a time. This results in increased productivity, because it eliminates the time spent on setting identical properties for several objects.
  • It improves network performance by increasing the efficiency of message diffing.
 Note: Once an item is defined, the meta-data about the next item includes only those properties that differ from the previous item. This is referred to as message diffing.
Creating a Property Class
When you create a property class, you have all the properties from every Forms Builder object available. You choose the properties and their values to include in the property class. You can create a property class in two ways:
  • Using the Create button in the Object Navigator
  • Using the Create Property Class button
Steps to create a property class from the Object Navigator:
  1. Select the Property Class node.
  2. Select Create.
  3. Add the required properties and their values.
  4. Set the value for that property.
Steps to create a property class from the Property Palette
  1. Select the object in the Object Navigator.
  2. Select the properties to be copied into a property class in the Property Palette.
  3. Select the Property Class button.
  4. Locate the property class and change its name in the Object Navigator.
Inheriting from a Property Class
Once you create a property class and add properties, you can use the property class. To apply the properties from a property class to an object, use the Subclass Information property in the Property Palette.
What is an inherited property?
An inherited property is one that takes its value from the property class that you associated with the object. An inherited property is displayed with an arrow to the left of the property name.
What is a variant property?
variant property is one that has a modified value even though it is inherited from the property class associated with the object. You can override the setting of any inherited property to make that property variant. Variant properties are displayed with a red cross over an arrow.
Notes:
  • To convert an inherited property to a variant property, simply enter a new value over the inherited one.
  • To convert a variant property to an inherited property, click the Inherit icon in the Property Palette.
  • You can also use the Inherit icon to revert a changed property back to its default.
B) Copying and Subclassing Objects and Code
With subclassing you can make an exact copy, and then alter the properties of some objects if desired. If you change the parent class, the changes also apply to the properties of the subclassed object that you have not altered. However, any properties that you override remain overridden. This provides a powerful object inheritance model.
When you subclass a data block, you can:
  • Change the structure of the parent, automatically propagating the changes to the child
  • Add or change properties to the child to override the inheritance
You can copy or subclass objects:
  • Between modules, by dragging objects between the modules in the Object Navigator
  • Within a single module by selecting the object in the Object Navigator, pressing [Ctrl], and dragging it to create the new object
When you drag objects, a dialog box appears that asks whether you want to copy or subclass the object.
Copy or Subclass?
When you copy an object, a separate, unique version of that object is created in the target module. Any objects owned by the copied object also get copied. Changes made to a copied object in the source module do not affect the copied object in the target module.
With subclassing, you can make an exact copy, and then alter the properties of some objects. If you change the parent class, the changes also apply to the properties of the subclassed object that you have not altered.
When you subclass a data block you cannot:
  • Delete items from the child
  • Change the order of items in the child
  • Add items to the child unless you add them to the end
C) Object Groups
An object group is a logical container for a set of Forms Builder objects.
You need to define an object group when you want to package related objects for copying or subclassing in another module or if you want to bundle numerous objects into higher-level building blocks that you can use again in another application. You can package the various objects in an object group and copy the entire bundle in one operation.
Steps to create an object group
  1. Select the Object Group node in the Object Navigator.
  2. Select the Create icon.
  3. Rename the new object group that is displayed.
  4. Click the form module and expand all the nodes.
  5. Select all the objects of one type that you want to include in the object group.
  6. Drag the selected objects into the new object group entry.
Key notes about object groups
  • Including a block in an object group also includes its items, the item-level triggers, the block-level triggers and the relations. You cannot use any of these objects in an object group without the block.
  • It is not possible to include another object group.
  • Deleting an object from a module automatically deletes the object from the object group.
  • Deleting an object group from a module does not delete the objects it contains from the module.
D) Object Libraries
Object libraries are convenient containers of objects for reuse. They simplify reuse in complex environments, and they support corporate, project, and personal standards. An object library can contain simple objects, property classes, object groups, and program units, but they are protected against change in the library. Objects can be used as standards (classes) for other objects.
Why object libraries instead of object groups?
  • Object libraries are external to the form, so are easily shared among form modules.
  • Object libraries can contain individual items; for example, iconic buttons. The smallest unit accepted in an object group is a block.
  • Object libraries accept PL/SQL program units.
  • If you change an object in an object library, all forms that contain the subclassed object reflect the change.
Object libraries appear in the Navigator if they are open. You can create, open, and close object libraries like other modules. Forms Builder automatically opens all object libraries that were open when you last closed Forms Builder.
Note: You cannot modify objects inside the object library itself. To make changes, drag the object into a form, change it, and drag it back to the object library.
Steps to populate an Object Library
  1. Select Tools > Object Library to display the object library.
  2. Drag objects from the Object Navigator into the object library.
  3. You can edit the descriptive comment by clicking the Edit icon in the object library interface.
E) SmartClass
A SmartClass is a special member of an Object Library. It can be used to easily subclass existing objects in a form using the SmartClass option from the right mouse button popup menu.
To use Object Library members which are not SmartClasses, you have to use the Subclass Information dialog available in the Property Palette of the form object that you are modifying.
If you frequently use certain objects as standards, such as standard buttons, date items, and alerts, you can mark them as SmartClasses by selecting each object in the object library and choosing Edit > SmartClass. You can mark many different objects, spread across multiple object libraries, as SmartClasses.
To apply a SmartClass to a Forms object, perform the following steps:
1. Right-click an object in the Layout Editor or Navigator.
2. From the pop-up menu, select SmartClasses. The SmartClasses pop-up menu lists all the SmartClasses from all open object libraries that have the same type as the object, and, for items, also have the same item type; for example, push button, text item.
3. Select a class for the object; it then becomes the parent class of the object. You can see its details in the Subclass Information dialog box in the object’s Property Palette, just like any other subclassed object.
0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply