When you register a JavaBean with FBean.Register_Bean
, all of
the attributes exposed by the JavaBean through get and set methods are automatically
registered as custom properties on the Bean Area. The custom properties
are given a name that is derived from the JavaBean setters and getters for the
JavaBean properties. For example, the Juggler JavaBean exposes a rate
property
through the bean methods getAnimationRate
and setAnimationRate
.
When you register the JavaBean, then the custom property animationRate
will be made available for that Bean Area in the Form.
For simple properties, FBean
contains Set_Property
and Get_Property
program units. These are all overloaded to handle
both the Name and the ID of the Bean Area Item and to handle multiple data types
(Boolean, varchar2, and number). Non-PL/SQL data types that can be used by the
JavaBean such as java.awt.Rectangle
are expressed as character
strings in a specific format in PL/SQL and translated to the correct type by
the enhanced JavaBean support feature. These data type translations are described
in Working with Data Type and Event Encoders.
FBean.Set_Property Syntax
FBEAN.SET_PROPERTY ( ITEM_NAME IN VARCHAR2, ITEM_INSTANCE IN PLS_INTEGER, PROPERTY_NAME IN VARCHAR2, VALUE IN VARCHAR2);
FBEAN.SET_PROPERTY ( ITEM_ID IN ITEM, ITEM_INSTANCE IN PLS_INTEGER, PROPERTY_NAME IN VARCHAR2, VALUE IN VARCHAR2);
FBEAN.SET_PROPERTY ( ITEM_NAME IN VARCHAR2, ITEM_INSTANCE IN PLS_INTEGER, PROPERTY_NAME IN VARCHAR2, VALUE IN NUMBER);
FBEAN.SET_PROPERTY ( ITEM_ID IN ITEM, ITEM_INSTANCE IN PLS_INTEGER, PROPERTY_NAME IN VARCHAR2, VALUE IN NUMBER);
FBEAN.SET_PROPERTY ( ITEM_NAME IN VARCHAR2, ITEM_INSTANCE IN PLS_INTEGER, PROPERTY_NAME IN VARCHAR2, VALUE IN BOOLEAN);
FBean.Get_Property SyntaxFBEAN.SET_PROPERTY ( ITEM_ID IN ITEM, ITEM_INSTANCE IN PLS_INTEGER, PROPERTY_NAME IN VARCHAR2, VALUE IN BOOLEAN);
Note that FBEAN.GET_PROPERTY
and FBEAN.GET_CHAR_PROPERTY
are synonymous, both return a VARCHAR2
value.
FBEAN.GET_PROPERTY ( ITEM_NAME IN VARCHAR2, ITEM_INSTANCE IN PLS_INTEGER, PROPERTY_NAME IN VARCHAR2) return VARCHAR2; FBEAN.GET_PROPERTY ( ITEM_ID IN ITEM, ITEM_INSTANCE IN PLS_INTEGER, PROPERTY_NAME IN VARCHAR2) return VARCHAR2; FBEAN.GET_CHAR_PROPERTY ( ITEM_NAME IN VARCHAR2, ITEM_INSTANCE IN PLS_INTEGER, PROPERTY_NAME IN VARCHAR2) return VARCHAR2; FBEAN.GET_CHAR_PROPERTY ( ITEM_ID IN ITEM, ITEM_INSTANCE IN PLS_INTEGER, PROPERTY_NAME IN VARCHAR2) return VARCHAR2; FBEAN.GET_NUM_PROPERTY ( ITEM_NAME IN VARCHAR2, ITEM_INSTANCE IN PLS_INTEGER, PROPERTY_NAME IN VARCHAR2) return NUMBER; FBEAN.GET_NUM_PROPERTY ( ITEM_ID IN ITEM, ITEM_INSTANCE IN PLS_INTEGER, PROPERTY_NAME IN VARCHAR2) return NUMBER; FBEAN.GET_BOOL_PROPERTY ( ITEM_NAME IN VARCHAR2, ITEM_INSTANCE IN PLS_INTEGER, PROPERTY_NAME IN VARCHAR2) return BOOLEAN; FBEAN.GET_BOOL_PROPERTY ( ITEM_ID IN ITEM, ITEM_INSTANCE IN PLS_INTEGER, PROPERTY_NAME IN VARCHAR2) return BOOLEAN;
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 get/set JavaBean properties in all instances of a multi-row block, use the value ALL_ROWS or FBean.ALL_ROWS. |
PROPERTY_NAME | the name of the JavaBean property that you want to get or set. |
VALUE | the value of the property. Can be either string ,
boolean , or number . |
To set and then get the value of the animation rate in the Juggler JavaBean you use the following code:
declare JugglingInterval number; begin FBean.Set_Property('MyBeanArea',1,'animationRate',150); -- Here we use the number version of Get_<>_Property
JugglingInterval := FBean.Get_Num_Property('MyBeanArea', 1, 'animationRate')); message('Animation Rate is now set to '||to_char(JugglingInterval)); ...
The first argument to the Get
and Set_Property
functions
is the name of the Bean Area item in the Form and the second is the instance
of the Bean Item. The third argument is the name of the property on the
JavaBean as exposed by the enhanced JavaBean support.
The fourth argument to FBean.Set_Property
is overloaded to take
a string, Boolean, or number as the value for the property. The enhanced JavaBean
support can map these basic types to a range of types in the JavaBean as required.
For example, if the JavaBean exposes a property as an int
(as is
animationRate
in this case) then the enhanced JavaBean feature
will handle the translation of the basic PL/SQL number
type into
that type. Again, it is possible to write your own encoders to handle
data type translations that are not currently provided. See Creating
Custom Encoders.
Note: Java, unlike PL/SQL is case-sensitive. When manipulating methods and properties using the enhanced JavaBean support be sure to use the correct case for the various custom property names.