Dispatching Information

Please see the following note for a full description:
398912.1 - How To Dispatch Events From JavaBeans and PJC Items.
This note is published on Oracle Metalink, so you need an account to connect and see it.

This is a sample form that shows the workaround to dispatch CustomEvents to forms from real javabeans & PJC items

        

Since CustomEvents cannot be dispatched from real JavaBeans or PJC items, the workaround will consist of making use of a Bean extending VBean and using this Bean's method to dispatch a CustomEvent to Forms.

There are 3 classes used:
- DispatchingBean: extends VBean 
- DispatchingFBean: real JavaBean
- DispatchingPJC: extends VTextField 

Both the DispatchingFBean and DispatchingPJC contain a field dBean that is type of DispatchingBean. This field will be set at runtime to the DispatchingBean instance. In this way they can make use of the method to dispatch a CustomEvent to Forms.

DispatchingBean

a Bean that extends VBean. This Bean contains a method that can dispatch a CustomEvent to forms. Also it contains a method that searches through all components in the Applet and sets the dBean field to itself in DispatchingFBean and DispatchingPJC.

DispatchingFbean

has to be used with the FBean package. Is an extension of JPasswordField, when enter is pressed a CustomEvent will be raised

Dispatching PJC

a PJC extending VTextField. When Enter is pressed in the TextField or the custom property MYEVENT is set in the PJC, a CustomEvent is dispatched to Forms

Modules In This Demo

The dispatching Demo consists of the following files

1. tomsdemos.jar - contains all Beans and Pjcs (signed file)
2. DISPATCHING.fmb - Sample Form
3. tomsdemos_unsigned.jar - contains all Beans and Pjcs (unsigned file)

Reusing the code

Setting up Forms Services

1. In order for an application to be able to use the DispatchingBeans, the relevant configuration in the formsweb.cfg file has to ensure that the supplied tomsdemos.jar is included in the relevant archive setting.

An entry in the formsweb.cfg file for an application that used the FormattingBeans would look like this:

[formatterDemo]
pageTitle=OracleAS Forms Services - Client Info Demo
IE=jinitiator
baseHTMLJInitiator=demobasejini.html
archive_jini=f90all_jinit.jar,tomsdemos.jar
form=DISPATCHING.fmx
width=675
height=480
separateFrame=false
splashScreen=no
lookAndFeel=oracle
colorScheme=blue
background=/formsdemo/images/blue.gif

2. The DISPATCHING.fmx needs to be in a directory available in FORMS_PATH
3. The tomsdemos.jar needs to be signed and placed in the $ORACLE_HOME/forms/java directory

4. A Bean Area handled by the FBean package must register the following class:
fbean.register_Bean('BEANS.DISPATCHINGFBEAN',1,'tom.oracle.demos.dispatch.DispatchingFBean');
5. The Implementation Class property for a hidden Bean Area must be:
tom.oracle.demos.dispatch.DispatchingBean

6. The Implementation Class property for a VBean must be:
tom.oracle.demos.dispatch.DispatchingVBean
7. The Implementation Class property for a PJC must be:
tom.oracle.demos.dispatch.DispatchingPJC

8. Search for all the bean areas of the current module:
Set_Custom_Property('BEANS.DISPATCHINGBEAN',1,'FINDCOMPS','dummyme');

9. Handle the bean events inside the form's module in a When-Custom-Item-Event trigger:
Declare
  BeanValListHdl ParamList;
  paramType      Number;
  EventName      VarChar2(20);
  outputparam    varchar2(255);
Begin
  BeanValListHdl := get_parameter_list(:system.Custom_Item_Event_Parameters);
  EventName      := :SYSTEM.Custom_Item_Event;
  If (EventName = 'MYEVENT') then
    get_parameter_attr(BeanValListHdl,'MYVALUE',ParamType, outputparam);
    message ('Event value: ' || outputparam, no_acknowledge);
  End if;
End;

10. Get the zip file here