The first step in accessing a JavaBean is to register it in your runtime code. To do this, the FBEAN package provides the REGISTER_BEAN Built-in. There are two variations of REGISTER_BEAN, one lets you specify the bean area by its ITEM NAME and the second lets you use the ITEM ID.
FBEAN.REGISTER_BEAN Syntax
FBEAN.REGISTER_BEAN ( ITEM_NAME IN VARCHAR2, ITEM_INSTANCE IN PLS_INTEGER, BEAN_CLASS IN VARCHAR2);
FBEAN.REGISTER_BEAN ( ITEM_ID IN ITEM, ITEM_INSTANCE IN PLS_INTEGER, BEAN_CLASS IN VARCHAR2);
where:
Parameter | Description |
---|---|
ITEM_NAME | the name of the Bean Area |
ITEM_ID | the name of the Bean Area as an ITEM data type. You can use the Forms FIND_ITEM Built-in to get this value. |
ITEM_INSTANCE |
the instance of the item that should contain the bean. This argument is applicable where the Bean Area is part of a multi-row block and more than one instance of the Bean Area is displayed. To register the JavaBean in all instances of a multi-row block, use the value ALL_ROWS or FBean.ALL_ROWS. |
BEAN_CLASS | the full class name of the bean |
To use a JavaBean in your form, you register it into the bean area of your
form with its full class name. For example, if you wanted to display the Sun
demonstration Juggler JavaBean in the Bean Area MyBeanArea
,
you would register it like this:
FBean.Register_Bean('MyBeanArea', 1, 'sunw.demo.juggler.Juggler');
Upon setting this property, the JavaBean will be instanciated into the Bean
Area, and its initialize()
method will be called. In the case of
the Juggler JavaBean, the animation will start automatically as soon as FBean.Register_Bean()
is used to define the JavaBean class.
If you use FBean to perform any operation on a bean in a multi-row block, then the operation is performed on a specific UI objectnot on the underlying data.
For example, if a block has 5 records displayed, there will be 5 addressable instances of the Bean Area numbered 1 through 5. Setting properties and invoking methods using FBean on these bean areas will affect only the UInot the underlying data. Trying to register a JavaBean for Item_Instance 6 would raise an error.
To register the JavaBean for all instances of a multi-row block, use the value ALL_ROWS for the ITEM_INSTANCE argument.