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
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
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
tom.oracle.demos.dispatch.DispatchingVBean7. The Implementation Class property for a PJC must be:
tom.oracle.demos.dispatch.DispatchingPJC
Set_Custom_Property('BEANS.DISPATCHINGBEAN',1,'FINDCOMPS','dummyme');
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;