Overblog
Suivre ce blog Administration + Créer mon blog
12 décembre 2011 1 12 /12 /décembre /2011 19:29

Purpose

Here is a PJC that hide parts of a text item
. It is usefull to hide the begin or the end (or any part actually) of a phone number or a credit card.


Conceal Text Field



The implementation class of the PJC

     oracle.forms.fd.ConcealTextField


The methods you can call



  • Set the bounds

Set_Custom_Property( 'BL.TI', 1, 'SET_BOUNDS', '1,6' );
 
This method indicates what part of the text you want to obfusk. In this example, we want to obfusk the first six charaters.

 

 

  • Set the log

Set_Custom_Property('BLOCK.TEXT_ITEM', 1, 'SET_LOG', 'true'); 



The sample dialog

     .
Download the concealtextfield.zip file
     .  Unzip the concealtextfield.zip.zip file
     .  Copy the concealtextfield.jar file in your /forms/java/ folder
     .  Add it to the archive and archive_jini tags of the /forms/server/formsweb.cfg file
        e.g.: archive_jini=frmall_jinit.jar,concealtextfield.jar
                archive=frmall.jar,concealtextfield.jar
     . Open the ConcealTextField.fmb module (Oracle Forms 10.1.2)
     . Compile all and run the module
 

Partager cet article
Repost0
26 juin 2011 7 26 /06 /juin /2011 08:27

Purpose

Here is a Pluggable Java Component from Andreas Weiden, to have a "Card" item style within a single Text Item.

CardItem PJC



The Java source
 

     CardTextfield.java



The implementation class of the PJC (TextItem Item)


     forms.CardTextfield


The PJC initialisation


    
Read the content of the PK_CARDITEM package from the CARDITEM.fmb sample dialog





The sample dialog

     .
Download the carditem.zip file
     . Unzip the carditem.zip file
     . Copy the carditem.jar file in your /forms/java/ folder
     . Add it to the archive and archive_jini tags of the /forms/server/formsweb.cfg file
     . Compile the PKG_READ_BLOB_IMAGE.sql script in your database schema
     . Open the CARDITEM.fmb module (Oracle Forms 10.1.2.0.2)
     . Compile all and run the module

 

Partager cet article
Repost0
7 janvier 2010 4 07 /01 /janvier /2010 15:31

Purpose

Here is a Forms 11g Pluggable Java Component that allows sending back to the Forms application each key pressed in a Text Item (single or multi-line).

The single-line PJC extends the VTextField class.
The multi-line PJC extends the VTextArea class.



Key Pressed 11g


This PJC can only work with the Forms 11g version. It won't work with any older version like 10g or 9i.


The implementation class of the single-Line Text Item


     oracle.forms.fd.KeyPressedTextItem


The implementation class of the multi-Line Text Item

     oracle.forms.fd.KeyPressedTextArea



The methods you can call



Set the Java Console logging mode (true/false)

Set_Custom_Property('BLOCK.ITEM',1,'LOG','true|false');

By default, the logging mode is set to false.

e.g.:
-- set the logging on --
Set_Custom_Property( 'BL.TEXTITEM', 1, 'LOG', 'true' ) ;
 

 



The event fired by the PJCs


KEY_PRESSED


It is constituted by 3 parameters to get the key code, the key char and the key modifier.

To know what text item has just fired the event, ask the :SYSTEM.CURSOR_ITEM variable.

When-Custom-Item-Event:

DECLARE
  
    eventName varchar2(30) := :system.custom_item_event;
    eventValues ParamList;
    eventValueType number;
    LC$Code   varchar2(25); -- code
    LC$Char   varchar2(25); -- char
    LC$Modif  varchar2(25); -- modifier

  
BEGIN
  
   IF (eventName='KEY_PRESSED') THEN
      eventValues := get_parameter_list(:system.custom_item_event_parameters);
      get_parameter_attr(eventValues,'KEY_CODE',eventValueType, LC$Code);
      get_parameter_attr(eventValues,'KEY_CHAR',eventValueType, LC$Char);
      get_parameter_attr(eventValues,'KEY_MODIFIER',eventValueType,  LC$Modif);
     
      :BL.RESULT := :System.cursor_item || ' Key pressed:'|| LC$Code || ' (' || LC$Char||') '||' modif:'||LC$Modif ;
      Synchronize ;

   END IF; 
  
END;






The sample dialog


     . Download the KeyPressed.zip file
     . Unzip the file
     . copy the keypressed.jar file in the <ORACLE_HOME>\Middleware\as_1\forms\java directory
     . Edit your formsweb.cfg file to add the keypressed.jar to the archive tag.
      
<WEBLOGIC_HOME>\Middleware\user_projects\domains\ClassicDomain\config\fmwconfig\servers\WLS_FORMS\applications\formsapp_11.1.1\config\formsweb.cfg
     . Open the KEYPRESSED11g.fmb module (Oracle Forms 11g)
     . Compile all and run the module

Partager cet article
Repost0
17 novembre 2009 2 17 /11 /novembre /2009 20:13

Purpose

Here is a PJC that includes a menu in a Text Item.



Text Filed Menu



The implementation class of the PJC

     oracle.forms.fd.ComboMenuPJC


The methods you can call



  • Set the menu

Set_Custom_Property('BLOCK.TEXT_ITEM', 1, 'SET_MENU', 'menu_description');

menu_desription contains the menu definition in a XML format:

Declare
 LC$Menu  Varchar2(32000);
Begin
 LC$Menu := '<main>
    <label>Machines</label>
    <menu>
    <label>Cars</label>
    <smenu><label>Japaneese</label><item>Toyota Prius</item></smenu>
    <smenu><label>Europeen</label><item>Mercedes</item><item>BMW</item><smenu><label>French</label><item>Peugeot 207</item></smenu></smenu>
    </menu>
    <menu>
    <label>Planes</label>
    <smenu><label>Airbus</label><item>A350</item><item>A380</item></smenu>
    <item>Boeing 777</item>
    </menu>
    </main>' ;
    Set_Custom_Property('BLOCK.TEXT_ITEM', 1, 'SET_MENU', LC$Menu);
End;


The content of a complete sub-menu must be written on the same single line between <smenu> and </smenu> tags.

e.g. :
<smenu><label>Japaneese</label><item>Toyota Prius</item></smenu>

Only values included between <item> and </item> tags are real values you can use to populate the Text Item.


 

  • Set the border style

Set_Custom_Property('BLOCK.TEXT_ITEM', 1, 'SET_BORDER', 'border');

  border can be one of the following:

   - line  (défault)
   - raised
   - lowered
   - etched
   - null

 

  • Set the trace to the Java Console

Set_Custom_Property('BLOCK.TEXT_ITEM', 1, 'SET_LOG', 'true');





The sample dialog

     .
Download the combomenupjc.zip file
     .  Unzip the combomenupjc.zip file
     .  Copy the JAR files in your /forms/java/ folder
     .  Add it to the archive and archive_jini tags of the /forms/server/formsweb.cfg file
     . Open the combomenupjc.fmb module (Oracle Forms 10.1.2)
     . Compile all and run the module

     The jar file must be signed
     The jar file provided with the .zip file is already signed


Partager cet article
Repost0
13 mai 2008 2 13 /05 /mai /2008 10:03

Purpose

This PJC is a workaround to the issue defined in the bug 3867157 on Metalink.

It allows having the same behaviour on the Web that the one it has on the C/S version. The When-List-Changed trigger would fire only when the mouse is clicked or when the Enter key is pressed, but not when the end-user types a letter to filter the list.

It is a PJC so that you do not need any Bean Area. Just fill the Implementation Class of your existing List Item.



The Java code

     PopList.java



The implementation class of the List Item

     oracle.forms.fd.PopList


The methods you can set



SET_CASE_SENSITIVE

By default, the poplist is case sensitive, but you can set it not sensitive.

Set_Custom_Property( 'BL.BT', 1, 'SET_CASE_SENSITIVE','false');

 

 

  SET_LOG

Set_Custom_Property( 'BL.BT', 1, 'SET_LOG','true');




The sample dialog


     . Download the poplist.zip file
     . Unzip the file
     . copy the poplist.jar file in the <ORACLE_HOME>/forms/java directory
     . Edit your /forms/server/formsweb.cfg file to add the poplist.jar to both archive and archive_jini tags.
     . Open the poplist.fmb module (Oracle Forms 9.0.2) the first List-Item uses the PJC, so that you can compare with the second that is a standard List-Item.
     . Compile all and run the module

Partager cet article
Repost0
10 janvier 2007 3 10 /01 /janvier /2007 14:27
 Purpose

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

     Multi-record PJC textfield

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
   . label (button)
   . font (button)
   . icon (button)

   . enable (button)
   . visible (button)



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-Record-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) ;
    LN$Rec  pls_integer := Get_Block_Property( :system.current_block, CURRENT_RECORD) ;
Begin   

  ---------------------------------------------------
  -- Calculate the cursor position in the page set --
  -- cannot be greater than the number             --
  -- of records displayed                          --
  ---------------------------------------------------
  If get_block_property('DEPT',TOP_RECORD) > 1 Then
      LN$Pos := LN$Rec - get_block_property('DEPT',TOP_RECORD) + 1 ;
  Else
      LN$Pos := LN$Rec ;
  End if;

  --------------------------------
  -- Handle the graphic aspects --
  -- for the entire page set    --
  --------------------------------
  For i In 1 .. LN$Max Loop   
      Set_Custom_Property('DEPT.DNAME', i, 'PAINT_RECORD', to_char((LN$Top+i)-1) );
  End loop ;
  Synchronize;


End;


Post-Query trigger:

Declare
    LN$Pos  pls_integer ;
    LN$Rec  pls_integer := Get_Block_Property('EMP', CURRENT_RECORD) ;
    LN$Max  pls_integer := Get_Block_Property('EMP', RECORDS_DISPLAYED) ;
    LC$C    Varchar2(15) ;
Begin   
    LN$Pos :=  LN$Rec - (trunc(LN$Rec/LN$Max) * LN$Max) ;
    If LN$Pos = 0 Then LN$Pos := LN$Max ; End if ;

    If LN$Pos > 0 Then
        Set_Custom_Property('EMP.BT', LN$Pos, 'SET_LOG', 'true' );
        -- Add the new item --
        Set_Custom_Property('EMP.BT', LN$Pos, 'SET_NEW_REC', to_char(LN$Rec) );
        Set_Custom_Property('EMP.ENAME', LN$Pos, 'SET_NEW_REC', to_char(LN$Rec) );
        -- Set some properties --
        Set_Custom_Property('EMP.BT', LN$Pos, 'SET_LABEL', to_char(LN$Rec)
                               || ',' || :EMP.ENAME );

        If :EMP.JOB = 'MANAGER' Then
          Set_Custom_Property('EMP.BT', LN$Pos, 'SET_FONT', to_char(LN$Rec)
                               || ',Arial,bold,14' );

          Set_Custom_Property('EMP.BT', LN$Pos, 'SET_FGCOLOR', to_char(LN$Rec)
                               || ',0,0,255' );

        ElsIf :EMP.JOB = 'CLERK' Then         
      Set_Custom_Property('EMP.BT', LN$Pos, 'SET_ICON', to_char(LN$Rec)
                      || ',C:/dev/Forms/PJCBeans/LAF/icons/ic1-16.png' );

    ElsIf :EMP.JOB = 'ANALYST' Then         
      Set_Custom_Property('EMP.BT', LN$Pos, 'SET_ICON', to_char(LN$Rec)
                      || ',C:/dev/Forms/PJCBeans/LAF/icons/ic2-16.png' );           

        End if ;
        If :GLOBAL.I > 250 Then :GLOBAL.I := 5 ;
        Else  :GLOBAL.I := :GLOBAL.I + 5 ;
        End if ;   
        LC$C := To_Char(LN$Rec) || ','
             || To_Char(255) || ','
             || To_Char(255-:GLOBAL.I) || ','
             || To_Char(255-:GLOBAL.I) ;    
        Set_Custom_Property('EMP.BT', LN$Pos, 'SET_BGCOLOR', LC$C );
        LC$C := To_Char(LN$Rec) || ','
             || To_Char(255) || ','
             || To_Char(255) || ','
             || To_Char(255-:GLOBAL.I) ;            
        Set_Custom_Property('EMP.ENAME', LN$Pos, 'SET_BGCOLOR', LC$C );
        Synchronize;
    End if ;
End;
When-Create-Record trigger:

Declare
    LN$N    pls_integer ;
    LN$Rec  pls_integer := :system.cursor_record ;
    LC$C    Varchar2(15) ;
Begin   
    if get_block_property('EMP',TOP_RECORD) > 1 Then
        LN$n := :system.cursor_record - get_block_property('EMP',TOP_RECORD) + 1 ;
    else
        LN$N := :system.cursor_record ;
    end if;
    If LN$N > 0 Then
        Set_Custom_Property('EMP.BT', LN$n, 'SET_LOG', 'true' );
        -- Add the new item --
        Set_Custom_Property('EMP.BT', LN$n, 'SET_NEW_REC', to_char(LN$Rec) );
    End if ;
End;

The Java code

     MultiTextField.java      MultiProps.java      MultiButton.java



The implementation class of the Text Item

     oracle.forms.fd.MultiTextField


The implementation class of the Button

     oracle.forms.fd.MultiButton



The methods you can call

  • Add a new record object
    Set_Custom_Property( 'BL.TEXTITEM', disp_rec, 'SET_NEW_REC', 'num_rec' ) ;
  • 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 label (button)
    Set_Custom_Property( 'BL.BUTTON', disp_rec, 'SET_LABEL', 'num_rec,label' ) ;
  • Set the font (button)
    Set_Custom_Property( 'BL.BUTTON', disp_rec, 'SET_FONT', 'num_rec,Arial,bold,12' )
  • Set the icon (button)
    Set_Custom_Property( 'BL.BUTTON', disp_rec, 'SET_ICON', 'num_rec,/icon.png' )
  • Set button enable/disable
    Set_Custom_Property( 'BL.BUTTON', disp_rec, 'SET_ENABLE', 'num_rec,false' )
  • Set the button visible/hidden
    Set_Custom_Property( 'BL.BUTTON', disp_rec, 'SET_VISIBLE', 'num_rec,true' )

The methods you can get

  • every property set

   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' ) ; 
   Varchar2 := Get_Custom_Property( 'BL.BUTTON'  , disp_rec, 'GET_LABEL' ) ; 

   Varchar2 := Get_Custom_Property( 'BL.BUTTON'  , disp_rec, 'GET_FONT' ) ;


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

Partager cet article
Repost0
8 janvier 2007 1 08 /01 /janvier /2007 16:15

 Purpose

Here is a PJC for textfields that allows to have a blinking behaviour.

Blinking textfield

This behaviour could be easily applied to other kind of items, like Command buttons for instance.


The Java code

     BlinkTextField.java



The implementation class of the Text Item

     oracle.forms.fd.BlinkTextField


The methods you can call



  • Set the blinking rate

Set_Custom_Property( 'BL.BEAN', 1, 'SETBLINKRATE', 'milliseconds' ) ;

 

 

  • Set the Foreground color

Set_Custom_Property( 'BL.BEAN', 1, 'SETFGCOLOR', 'r,g,b' ) ;


 

  • Set the Background color

Set_Custom_Property( 'BL.BEAN', 1, 'SETBGCOLOR', 'r,g,b' ) ;

  • Start blinking

Set_Custom_Property( 'BL.BEAN', 1, 'START', '' ) ;

  • Stop blinking

Set_Custom_Property( 'BL.BEAN', 1, 'STOP', '' ) ;




The sample dialog

   . Download the blink.zip file
   . Unzip the files
   . copy the blink.jar file in the /forms/java directory
   . Edit your /forms/server/formsweb.cfg file to add the jar file
   . Open the BLINK.fmb module (Oracle Forms 9.0.2)
   . Compile all and run the module

Partager cet article
Repost0
13 octobre 2006 5 13 /10 /octobre /2006 15:10

Purpose

Here is a PJC that allows to set the cursor from any image stored in the jar file.

This PJC extends VTextField, so you must set the Implementation Class name on a Text item.


Text item and custom cursor


The Java code

     JTextFieldIcon.java  



The implementation class of the Bean Item

     oracle.forms.fd.JTextFieldIcon


The methods you can call


Set the image name

Set_Custom_Property('BLOCK.ITEM', 1, 'SETCURSOR', 'image_name');

e.g. :
Set_Custom_Property( 'BL.T1', 1, 'SETCURSOR', '/cursor1.gif' ) ;
   

   images are searched in the jar file.

The jar file provided with the article contains one icon : cursor1.gif


The sample dialog


     . Download the jtextfieldcursor.zip file
     . Unzip the file
     . copy the jtextfieldcursor.jar file in the <ORACLE_HOME>/forms/java directory
     . Edit your /forms/server/formsweb.cfg file
     . Open the TEXTCURSOR.fmb module (Oracle Forms 9.0.2)
     . Compile all and run the module

Partager cet article
Repost0
20 mars 2006 1 20 /03 /mars /2006 22:47
Partager cet article
Repost0