Purpose
Here is a text item's PJC that can be used in multi-records Forms tables.

It allows to have a coherent behaviour in a multi-record table for items that record number are greater than the number of records displayed.
In the standard way, you can set an Implementation Class to a PJC that extends the corresponding Forms item type (VTextField in this example), but you cannot use the Set_Custom_Property() built-in on a record number greater than the number of records displayed block's property.
For instance, it this property is set to 10 (ten records displayed by the block), the following instruction will raise an error:
Set_Custom_Property( 'BL.TEXT_ITEM', 11, 'SET_PROPERTY', '...' );
This is a problem because you cannot use a PJC on a multi-record block if the number of records fetched or created is greater than then number of records displayed.
This PJC can be used in this case because it holds a table of objects for each PJC's instance.
You can use it to give each record a special color (without having to use the Set_Item_Instance_Property() built-in with tens of visual attributes), or also have one different hint and tooltip for each record (which is not possible in standard).
How it works:
Within the PJC:
each PJC's instance (10 in this example) can handle 0 to n physical records.
You can see, on the screenshot above that the first line displays the record #9. If you scroll the block, it would display the 10th, then the 11th, and so on.
So, each PJC instance hold a table of objects. Each physical record must have a corresponding object in this table.
In this sample, each object contains the following values:
. tooltip
. hint
. background color
. foreground color
. int value
. float value
. string value
Within the Forms module:
The trick is to re-draw all the displayed items (the page set) with their corresponding values.
This job is done in the When-New-Item-Instance block-level trigger:
Declare
LN$Pos pls_integer ;
LN$Max pls_integer := Get_Block_Property( :system.current_block, RECORDS_DISPLAYED) ;
LN$Top pls_integer := get_block_property( :system.current_block, TOP_RECORD) ;
Begin
---------------------------------------------------
-- Calculate the cursor position in the page set --
-- cannot be greater than the number --
-- of records displayed --
---------------------------------------------------
If LN$Top > 1 Then
LN$Pos := :system.cursor_record - LN$Top + 1 ;
Else
LN$Pos := :system.cursor_record ;
End if;
--------------------------------
-- Handle the graphic aspects --
-- for the entire page set --
--------------------------------
For i In 0 .. LN$Max-1 Loop
Set_Custom_Property('BL.TXT', i+1, 'PAINT_RECORD', to_char(LN$Top+i) );
End loop ;
End;
The Java code
MultiTextField.java MultiProps.java
The implementation class of the Text Item
oracle.forms.fd.MultiTextField
The methods you can call
- Add a new record object
Set_Custom_Property( 'BL.TEXTITEM', disp_rec, 'SET_NEW_REC', 'num_record' ) ;
- Set the Foreground color
Set_Custom_Property( 'BL.TEXTITEM', disp_rec, 'SET_FGCOLOR', 'num_rec,r,g,b' ) ;
- Set the Background color
Set_Custom_Property( 'BL.TEXTITEM', disp_rec, 'SET_BGCOLOR', 'num_rec,r,g,b' ) ;
- Set the hint
Set_Custom_Property( 'BL.TEXTITEM', disp_rec, 'SET_HINT', 'num_rec,hint_text' ) ;
- Set the tooltip
Set_Custom_Property( 'BL.TEXTITEM', disp_rec, 'SET_TOOLTIP', 'num_rec,tooltip_text' ) ;
- Set a int value
Set_Custom_Property( 'BL.TEXTITEM', disp_rec, 'SET_INT_VALUE', 'num_rec,int_value' ) ;
- Set a float value
Set_Custom_Property( 'BL.TEXTITEM', disp_rec, 'SET_FLOAT_VALUE', 'num_rec,float_value' ) ;
- Set a char value
Set_Custom_Property( 'BL.TEXTITEM', disp_rec, 'SET_CHAR_VALUE', 'num_rec,char_value' ) ;
- Set the curent record indice
Set_Custom_Property( 'BL.TEXTITEM', disp_rec, 'SET_INDICE', 'physical_record_number' ) ;
The methods you can get
Varchar2 := Get_Custom_Property( 'BL.TEXTITEM', disp_rec, 'GET_HINT' ) ;
Varchar2 := Get_Custom_Property( 'BL.TEXTITEM', disp_rec, 'GET_TOOLTIP' ) ;
Varchar2 := Get_Custom_Property( 'BL.TEXTITEM', disp_rec, 'GET_INT_VALUE' ) ;
Varchar2 := Get_Custom_Property( 'BL.TEXTITEM', disp_rec, 'GET_FLOAT' ) ;
Varchar2 := Get_Custom_Property( 'BL.TEXTITEM', disp_rec, 'GET_CHAR' ) ;
The property is read for the physical record number indicated by the SET_INDICE property, so you have to set this property before.
e.g. :
-------------------------------------------------
-- Get the hint of the current physical record --
-------------------------------------------------
Set_Custom_Property('BL.TXT', LN$Pos, 'SET_INDICE', to_char(:system.cursor_record) );
Message(Get_Custom_Property('BL.TXT', LN$Pos, 'GET_HINT' ));
The sample dialog
. Download the pjcmultirec.zip file
. Unzip the files
. copy the multirecord.jar file in the /forms/java directory
. Edit your /forms/server/formsweb.cfg file to add the jar file
. Open the PJCMULTIREC.fmb module (Oracle Forms 9.0.2)
. Compile all and run the module