Overblog Suivre ce blog
Administration Créer mon blog
7 février 2007 3 07 /02 /février /2007 14:14

Purpose

Here is a package that allows the dispatching of events from Java Beans to Forms on Beans that extend VBean, beans that use the FBean package and also PJCs !
No, you are not dreaming and there is no mist on your glasses, a PJC that dispatch event to the form module !

            Dispatching events


You know that a Bean that extends VButton or VTextField for example cannot use the dispatchCustomEvent() method to send message to Forms, so how could this be possible ?

Tom Cleymans from Belgium brings here the solution.

He decided to attach a class that extends VBean to each PJC, so that it can use the included dispatchCustomEvent() method to send messages to the corresponding Forms' module Bean Area.

As brilliant as simple !

Read the Tom's article then do what you are searching for years.

Repost 0
Published by Oracle Forms community - dans Bean - general
commenter cet article
30 janvier 2007 2 30 /01 /janvier /2007 14:50
Purpose

Here is a Java Bean that allows to paint the current canevas with a Java gradient.
It needs the JRE 1.4 (Sun Java Plug-in)

     Gradient Canevas



The Java code

     PaintCanevas.java



The implementation class of the B
ean

     oracle.forms.fd.PaintCanevas


The methods you can call


  • Set the gradient parameters

    Set_Custom_Property( 'BL.BEAN', 1, 'SET_GRADIENT_COLORS', '255,255,0,255,0,0');

    It takes two RGB colors, the starting color then the ending color.


  • Set the Horizontal cycle

    Set_Custom_Property( 'BL.BEAN', 1, 'SET_H_CYCLE', 'cycle_info' ) ;

    Set the Horizontal cycle when you want to have a repetitive gradient.

    You can provide a value exprimed in pixel or a fraction

    e.g.: 

    - repeat the gradient 2 times horizontally:

    Set_Custom_Property( 'BL.BEAN', 1, 'SET_H_CYCLE', '/2' ) ;





    - repeat the gradient each 50 horizontal and vertical pixels

    Set_Custom_Property( 'BL.BEAN', 1, 'SET_H_CYCLE', '50' ) ;
    Set_Custom_Property( 'BL.BEAN', 1, 'SET_V_CYCLE', '50' ) ;






  • Set the Vertical cycle

    Set_Custom_Property( 'BL.BEAN', 1, 'SET_V_CYCLE', 'cycle_info' ) ;

    See the Horizontal cycle explanation.


  • Set the gradient direction

    Set_Custom_Property( 'BL.BEAN', 1, 'SET_GRADIENT_DIRECTION', 'direction' ) ;

    Where direction can take one of the following values:

      LeftToRight : Left to Right
      UpToDown : Up to Down
      LeftUpToRightDown : Left Up to Right Down
      LeftDownToRightUp : Left Down to Right Up

Of course, you can have one Bean per canevas, so you can have some nice mixed compositions with multiple canevases !




The sample dialog

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

 

 

 
Repost 0
Published by Oracle Forms community - dans Bean - general
commenter cet article
26 janvier 2007 5 26 /01 /janvier /2007 19:44
 Purpose

Here is a Swing JButton that overloads a standard PJC's button.
It needs the JRE 1.4 (Sun Java Plug-in)

     Swing button

It allows to have a standard Forms button with some nice decoration features.

You can apply a gradient color, set rounded borders, justify the label and also have a shadow behind the label.
Because it is firstly a PJC, you can set most of the common properties with the Set_Item_Property() built-in (label, position, foreground color, background color, etc...).

The gradient feature is part of the JRE 1.4 so this bean need the Sun Java plug-in to run.
 

 

The Java code

     SwingButton.java      CButton.java



The implementation class of the Button item

     oracle.forms.fd.SwingButton


The methods you can call

 

  • Set the gradient parameter

    Set_Custom_Property( 'BL.SWINGBUTTON', 1, 'SET_GRADIENT_COLOR', '255,255,0,255,0,0');

    It takes two RGB colors, the starting color then the ending color.


  • Set the label's shadow color

    Set_Custom_Property( 'BL.SWINGBUTTON', 1, 'SET_SHADOW_COLOR', 'r,g,b');

    On the screenshot, you can see a white shadow behind the label.


  • Set the buttons's border color

    Set_Custom_Property( 'BL.SWINGBUTTON', 1, 'SET_BORDER_COLOR', 'r,g,b');


  • Set the gradient direction

    Set_Custom_Property( 'BL.SWINGBUTTON', 1, 'SET_GRADIENT_DIR', 'direction');

    Where direction can take one of the following value:

      1 : left to right
      2 : right to left
      3 : up to down (like the screen-shot)
      4 : down to up


  • Set the text position

    Set_Custom_Property( 'BL.SWINGBUTTON', 1, 'SET_TEXT_POSITION', 'left | center | right' ) ;


  • Set the image position

    Set_Custom_Property('BL.SWINGBUTTON', 1, 'SET_IMAGE_POSITION', 'HV' );

    Where H can be:
    Left, Center, Right

    and V can be:
    Top, Middle, Bottom


 

LT CT RT
LM CM RM
LB CB RB


  • Set the current image name

    Set_Custom_Property('BL.SWINGBUTTON', 1, 'SET_IMAGE', 'image_name[,position]');

    position is facultative and by default CM (Center Middle)


    image_name can be a url (http://...) a client machine file (d:/...) or a JAR file.



  • Set the mouse ON image (that appears when the mouse enters the button)

    Set_Custom_Property('BL.SWINGBUTTON', 1, 'SET_IMAGE_ON', 'image_name' ) ;


  • Set the rounded setting

    Set_Custom_Property( 'BL.SWINGBUTTON', 1, 'SET_ROUNDED', 'horizontal diameter,vertical diameter' ) ;





The sample dialog

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

   The swingbutton.jar file have to be signed.
   The swingbutton.jar file provided with the article is already signed.

Repost 0
Published by Oracle Forms community - dans PJC - Buttons
commenter cet article
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

Repost 0
Published by Oracle Forms community - dans PJC - Text items
commenter cet article
9 janvier 2007 2 09 /01 /janvier /2007 18:48

Purpose

Here is a Java bean that allows to Drag 'n Drop between Forms items.

Drag 'n Drop

You can Drag 'n Drop between mono and multi-line text fields and between images.

Because the "real Java" Drag 'n Drop is not implemented in the Forms application, This one is "hand made".
So when you release the mouse button to drop the object, you have to move the mouse about one pixel to
really drop the object.

Press the Ctrl keybord key if you want to keep the original object (COPY).

This demo load the image from the c:/wile.jpg image file, so copy this file from the zip file to your c:/ directory.


The Java code

     DnD.java



The implementation class of the Bean Item

     oracle.forms.fd.DnD




The sample dialog

     . Download the DnD.zip file

     . Unzip the file
     . copy the DnD.jar file in the <ORACLE_HOME>/forms/java directory

     . Edit your /forms/server/formsweb.cfg file to add this jar file
     . Open the DnD.fmb module (Oracle Forms 9.0.2)
     . Compile all and run the module

Repost 0
Published by Oracle Forms community - dans Bean - general
commenter cet article
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

Repost 0
Published by Oracle Forms community - dans PJC - Text items
commenter cet article
5 janvier 2007 5 05 /01 /janvier /2007 13:22

Purpose

Here is a collection of PJCs that allow to have multiline labels and tooltips.
The tooltips can have a nice decoration like Java gradients, and be displayed anywhere on the screen.

It needs, at least, the Sun Java plugin 1.4 to run. It won't run against the JInitiator.


        Multiline

All the properties can be set within the Tooltip item property.
So it is convenient for modules generated by Oracle Designer for instance
(no need to use the Set_Custom_Property built-in)


The character that simulates the carriage return is the | (alt+124)
You can place it in both label and tooltip properties.

On the image above, you can see the multi-line CheckBox label.

Here are its particular properties:

   Implementation Class : oracle.forms.fd.JCheckBoxMLline
   Label : Check|box
   Tooltip : CheckBox tooltip<params>fg=255,255,255 bg=120,120,255</params>


The parameters set in the tooltip property must be entered between the <params> and </params> tags.
The properties you can set are:

   the tooltip text color : fg=r,g,b
   the tooltip background color : bg=r,g,b[,r,g,b]
   the tooltip position : pos=x,y





The Java code

     src.zip



The implementation classes of the Bean Item

   There are as many classes as Forms item types:

Forms item Implementation Class property
Check Box item oracle.forms.fd.JCheckBoxMLline
Combo list oracle.forms.fd.JComboBoxMLline
T list oracle.forms.fd.JTListMLline
Pop list oracle.forms.fd.JPopListMLline
Radio button oracle.forms.fd.JRadioButtonMLline
Text item oracle.forms.fd.JTextFieldTooltip
Command button oracle.forms.fd.JVButtonMLline




The methods you can call


  • Set the tooltip text color

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

  • Set the backgtound tooltip color

Set_Custom_Property( 'BL.BEAN', 1, 'SET_COLORS', 'r,g,b[,r,g,b]' ) ;

If you set two colors, the tooltip background will be colorized with a gradient from the first color to the second one.
e.g. :

// set background tooltip color gradient from red to yellow
Set_Custom_Property('BL.BEAN', 1, 'SET
_COLORS', '255,120,120,255,255,128' ) ;         


// set background tooltip color to light blue
Set_Custom_Property('BL.BEAN', 1, 'SET
_COLORS', '120,120,255' ) ;         

  • Set the tooltip absolute position

You can enforce the tooltip to be displayed on a particular position relative to the parent window (default) or the MDI window.
The X,Y coordinates are in pixel.

Set_Custom_Property( 'BL.BEAN', 1, 'SET_POSITION', '10,250' ) ;

  • Set the window attachment for absolute tooltip position

Set_Custom_Property( 'BL.BEAN', 1, 'SET_ATTACH', 'MDI | anything_else' ) ;

If you decide to use the absolute tooltip positionning (SET_POSITION) you can define if the tooltip is attached to its parent window (default) or to the MDI window



The sample dialog

     .
Download the multiline.zip file
     . Unzip the files
     . copy the
Multiline.jar file in the <ORACLE_HOME>/forms/java directory
     . Edit your /forms/server/formsweb.cfg file to add these 2 jar files
     . Open the
MULTILINE.fmb module (Oracle Forms 10.1.2)
   . Compile all and run the module

Repost 0
Published by Oracle Forms community - dans Bean - general
commenter cet article
26 décembre 2006 2 26 /12 /décembre /2006 17:46

Purpose

Here is a Java bean that allows to have an enhanced Web Browser.
It is a full Web browser that can handle Javascript and display Flash animations.

The material comes from a sourceforge project:
http://sourceforge.net/project/showfiles.php?group_id=170904


Enhanced Web Browser

It can accept both http url and local machine html file names.

It needs, at least, a 1.4 JRE so the Sun Java plug-in, so that it won't run with the JInitiator.


The Java code

     EnhancedHTMLBrowser.java



The implementation class of the Bean Item

     oracle.forms.fd.EnhancedHTMLBrowser


The methods you can call



  • Get the Forms Window

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

This must be used to retrieve the Forms window that handles the webBrowser, then synchronize its position when the windows is moved. This must be the first property set (in the When-New-Form-Instance trigger).

 

 

 

 

 

  • Set the URL/File

Set_Custom_Property( 'BL.BEAN', 1, 'SET_URL', 'url | file_name' ) ;


e.g. :

Set_Custom_Property('BL.BEAN', 1, 'SET_URL', 'http://www.developpez.com/' ) ;         


Set_Custom_Property('BL.BEAN', 1, 'SET_URL', 'd:/mypage.htm' ) ;

  • Set the border of the bean

Set_Custom_Property( 'BL.BEAN', 1, 'SET_BORDER', 'true | false' ) ;


When you want to use this bean to display a Flash image (*.swf), you would probably prefer not to have any border bounding the image.
In this case, set the border to false.


  • Basic navigation

Set_Custom_Property( 'BL.BEAN', 1, 'SET_NAVIGATION', 'back | forward | refresh' ) ;



The sample dialog

     .
Download the eHTMLBrowser.zip file
     . Download the sourceforge project zip file

     . Unzip the files
     . copy the jdic.jar and eHTMLBrowser.jar files in the <ORACLE_HOME>/forms/java directory

     . Edit your /forms/server/formsweb.cfg file to add these 2 jar files
     . Add the 2 .dll files and IeEmbed.exe (from the javaflashbridge-v1.zip file) to your Windows/system32 directory
     . Open the EHTMLBROWSER.fmb module (Oracle Forms 9.0.2)
     . Compile all and run the module

     The .jar files must be signed
     The eHTMLBrowser.jar and jdic.jar files provided with the .zip file are already signed


 

Repost 0
Published by Oracle Forms community - dans Bean - general
commenter cet article
22 décembre 2006 5 22 /12 /décembre /2006 10:04

Purpose

Here is a Java bean that allows to start programmes on the client machine, then capture the standard/error output.
It could be used if you don't want to install or use the Webutil library.


Java Host

If you target to use parameters that contain blanks, separate them by a comma.
The output lines are sent by the external programme (and received by Forms) asynchronously.



The Java code

     JavaHost.java



The implementation class of the Bean Item

     oracle.forms.fd.JavaHost


The methods you can call


 

  • Set the command

Set_Custom_Property( 'BL.BEAN', 1, 'SET_PROG', 'command' ) ;


e.g. :

Set_Custom_Property('BL.BEAN', 1, 'SET_PROG', 'cmd /c dir /b d:/*.jpg' ) ;         

If you intend to use parameters that contains blanks, use a comma to seperate them:

Set_Custom_Property('BL.BEAN', 1, 'SET_PROG', 'cmd,/c,findstr,"width height", d:/oracle9i/forms90/server/formsweb.cfg' ) ;


The event raised by the bean



 

  • MSGSTND

This event is raised by the bean to inform Forms that a line has been sent by the external process on the standard output.

 

  • MSGERROR

This event is raised by the bean to inform Forms that a line has been sent by the external process on the error output.


Here is the code of the When-Custom-Item-Event trigger of the sample dialog:

DECLARE
   
    eventName varchar2(30) := :system.custom_item_event;
    eventValues ParamList;
    eventValueType number;
    LC$Msg     Varchar2(32000);
    LC$Item    varchar2(256);
    LC$Event   varchar2(256);  
   
BEGIN
   
   IF (eventName='MSGSTND') THEN
      -- get the standard output --
      eventValues := get_parameter_list(:system.custom_item_event_parameters);
      get_parameter_attr(eventValues,'MSGTEXT',eventValueType, LC$Msg);
      If Length(:BL.RESULT) + Length(LC$Msg) > 32000 Then
       :BL.RESULT := '' ;
      End if ;
      :BL.RESULT := :BL.RESULT || LC$Msg || CHR(10) ;
      Synchronize;
   ELSIF (eventName='MSGERROR') THEN
      -- get the component properties --    
      eventValues := get_parameter_list(:system.custom_item_event_parameters);
      get_parameter_attr(eventValues,'MSGTEXT',eventValueType, LC$Msg);
      If Length(:BL.RESULT) + Length(LC$Msg) > 32000 Then
       :BL.RESULT := '' ;
      End if ;
      :BL.RESULT := :BL.RESULT || ' *** ERROR ***' || CHR(10) || LC$Msg || CHR(10) ;
      Synchronize;
   END IF;
   
END;


The sample dialog

     . Download the javahost.zip file

     . Unzip the file
     . copy the javahost.jar file in the <ORACLE_HOME>/forms/java directory

     . Edit your /forms/server/formsweb.cfg file to add this jar file
     . Open the JAVA_HOST.fmb module (Oracle Forms 9.0.2)
     . Compile all and run the module

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


Repost 0
Published by Oracle Forms community - dans Bean - general
commenter cet article
10 décembre 2006 7 10 /12 /décembre /2006 15:39

Purpose

Here is a Java bean that allows to capture the mouse events and display the properties and methods of the clicked component.
In this second chapter, the bean is able to etablish the correspondance between the Java components and the Forms module's items.
When the mouse enter an item, the background color is changed, then an event is sent to Forms to indicate which item is concerned. The message indicates the Forms item name.

This demonstrates that you can get events from every item with a single Bean component.



Right-click on a component to display its properties and methods.


The Java code

     HandleMouseEvent2.java



The implementation class of the Bean Item


     oracle.forms.fd.HandleMouseEvent2


The methods you can call


    * Enable/disable mouse event capture

Set_Custom_Property('BLOCK.ITEM', 1, 'SETEVENT', 'parameter');

where parameter is:

   event name,boolean

e.g. :

Set_Custom_Property('BL.BEAN', 1, 'SETEVENT', 'PRESS=FALSE' ) ;
        

event name can be one of the following:

  - MOVE (mouse move)
  - EXIT (mouse exit)
  - PRESS (mouse button pressed)
  - REL (mouse button released)
  - ENTER (mouse enter)
  - CLICK (mouse click)

   By default, the MOVE event is disabled.

    * Enable/disable all mouse events

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


    * Set the highlight mode

The highlight mode is used to colorize the item background when the mouse entered in it.

Set_Custom_Property('BLOCK.ITEM', 1, 'SETHIGLIGHT, 'mode');
where mode can be:

   - a positive value to brighter the current item background color
   - a negative value to darker the current item background color
   - a valid r,g,b value
   - false (to avoid automatic coloration)

  e.g.:

  -- darker --
  Set_Custom_Property('BL.BEAN', 1, 'SETHIGLIGHT', '-20' ) ;
  -- brighter --
  Set_Custom_Property('BL.BEAN', 1, 'SETHIGLIGHT', '20' ) ;
  -- special color --                                        
  Set_Custom_Property('BL.BEAN', 1, 'SETHIGLIGHT', '185,255,185' ) ;
  -- no highlight --                                        
  Set_Custom_Property('BL.BEAN', 1, 'SETHIGLIGHT', 'false' ) ;
  

    * Send the Forms item properties to the bean

Set_Custom_Property('BLOCK.ITEM', 1, 'SETPROP', 'properties');
where properties are:

   item name, X position on canvas, Y position on canvas

e.g.:

Set_Custom_Property( 'BL.BEAN', 1, 'SETPROP','BL.PBUTTON,40,30' ) ;

This last method is used to communicate the item coordinates to the Bean, so it can etablish the matching between the Java component and the Forms items.

It is used in the SetProperties() Forms procedure that scans the visible items of the form.


Note : the coordinates used by the java bean are pixel, so the Forms coordinate system must be set to pixel too.

If your coordinate system is different, here is a procedure that convert inches, points or centimeters to pixels:

Declare
   LC$Scoord VARCHAR2(100) := Get_Form_Property( Name_in('system.current_form'), COORDINATE_SYSTEM ) ;
Begin
   -- Convert to pixel --
   If LC$Scoord = 'INCHES' Then
      value := value * 0.0104 ;
   ElsIf LC$Scoord = 'POINTS' Then
      value := value * 1.333 ;
   ElsIf LC$Scoord = 'CENTIMETERS' Then
      value := value * 0.0263 ;
   End if ;
End ;



The event raised by the bean

    * SENDMSG

This event is raised by the bean to inform Forms that a mouse event has occured.
4 properties are provided:

  - MSGEVENT : event raised (mouse enter, exit, click, move, press)
  - MSGTYPE : type of the component ( e.g. oracle.forms.ui.VButton for a PushButton)
  - MSGITEM : class name of the component
  - MSGCOORD : coordinates of the mouse pointer
  - MSGBTMOUSE : mouse button number

  IF (eventName='SENDMSG') THEN
      -- get the mouse message --
      eventValues := get_parameter_list(:system.custom_item_event_parameters);
      get_parameter_attr(eventValues,'MSGEVENT',eventValueType, LC$Event);
      get_parameter_attr(eventValues,'MSGTYPE',eventValueType, LC$Type);
      get_parameter_attr(eventValues,'MSGITEM',eventValueType, LC$Item);
      get_parameter_attr(eventValues,'MSGCOORD',eventValueType, LC$Coord);
      get_parameter_attr(eventValues,'MSGBTMOUSE',eventValueType, LC$Button);
      LC$Msg := LC$Event
             || ' object=' || LC$Type
             || ' item=' || LC$Item           
             || ' at ' || LC$Coord
             || ' mouse=' || LC$Button ;
      clear_message;
      Message(LC$Msg, no_acknowledge) ;
      Synchronize ; 


    * SENDPROPS

This event is raised by the bean to inform Forms that the property and method information of the component has been sent.
In the sample dialog, this information is stored in a Text item, then displayed via the Edit_TextItem() Forms built-in.
It can be displayed by right-clicking on anywhere on the screen.




   ELSIF (eventName='SENDPROPS') THEN
      -- get the component properties --     
      eventValues := get_parameter_list(:system.custom_item_event_parameters);
      get_parameter_attr(eventValues,'MSGPROPS',eventValueType, LC$Msg);
      :BL.PROPERTIES := Replace(LC$Msg, '/n', CHR(10));
      Set_Custom_Property('BL.BEAN', 1, 'ALLOWEVENT', 'false' ) ;
      Go_Item('BL.PROPERTIES');
      edit_textitem ;
      Set_Custom_Property('BL.BEAN', 1, 'ALLOWEVENT', 'true' ) ;
   END IF;



The sample dialog

     . Download the mouseevent2.zip file
     . Unzip the file
     . copy the handlemouseevent2.jar file in the <ORACLE_HOME>/forms/java directory
     . Edit your /forms/server/formsweb.cfg file to add this jar file
     . Open the MOUSEEVENT2.fmb module (Oracle Forms 10.1.2)
     . Compile all and run the module


Using the JInitiator:

Tom Casserly provides, here, an equivalent that runs correctly with JInitiator.

Download the JInititator compatible version

Repost 0
Published by Oracle Forms community - dans Bean - general
commenter cet article