Oracle Forms Community - Pluggable Java Components & Java Beans' library

To content | To menu | To search

Friday, March 27 2015

A javabean to display Google static maps

Purpose


Here is a Java bean from Hafed Benteftifa (Québec - Canada) that allows the Forms module to display static Google maps with HTTP geocoding service.



Get the zip file here, that contains the documentation and all the necessary material, or go to his site to get the information.


A Full Web Browser Java Bean 2nd edition

Purpose

Here is a Java Bean from Mark Striekwold to have an enhanced Web Browser (2nd edition). It is a full Web browser that can handle Javascript. This bean is based on the idea of the Full Web Browser Java Bean and rewritten so it makes use of the fbean package to register the bean and to call the methods of the java bean. It also makes use of a newer version of the jdic.jar which makes it easier to use under windows.

The material comes from the JDICplus project (WIN32 only):
https://java.net/projects/jdic


 

Enhanced Web Browser

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

 

It needs, at least, a 1.6 JRE so the Sun Java plug-in, so that it won't run with the JInitiator and earlier version of the Sun Java plug-in.


The Java code

     ehb.java



The implementation class of the Bean Item

     oracle.forms.ms.ehb


The methods you can call

 

  • Register the bean

fbean.register_bean('BL.BEAN', 1, 'oracle.forms.ms.ehb');

This is the very first operation you have to do.

 

 

  • Get the Forms Window

fbean.invoke( '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

fbean.invoke( 'BL.BEAN', 1, 'setUrl', 'URL');


e.g. :

fbean.invoke( 'BL.BEAN', 1, 'setUrl', 'http://mark-oracle.blogspot.com');        



 

  • Set the border of the bean

fbean.invoke( 'BL.BEAN', 1, 'setBorder', '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

fbean.invoke( 'BL.BEAN', 1, 'setNavigation', 'back | forward | refresh' ) ;

e.g.:

fbean.invoke( 'BL.BEAN', 1, 'setNavigation', 'back');




The sample dialog

     . Download the ehb.zip file
     .  Unzip the ehb.zip file
     .  Copy the ehb.jar file in your /forms/java/ folder

     . Download the JDICplus project zip file
     .  Unzip the JDICplus-0.2.2-bin-win32.zip file
     . copy the /lib/JDICplus.jar in your /forms/java/ folder
     . copy the /lib/bin/jdicArc.dll and /lib/bin/jdicWeb.dll in your /windows/system32 folder
     . Update your /forms/server/formsweb.cfg configuration file:
          . archive=frmall.jar,ehb.jar,JDICplus.jar
     . Notice that we update the archive tag and not the archive_jini tag because this bean needs the Sun Java plug-in 1.6 and won't run with any older version, including the Oracle JInitiator

     . Open the EHBROWSER.fmb module (Oracle Forms 10.1.2)
     . Compile all and run the module


     The .jar files must be signed
     The ehb.jar file provided with the .zip file are already signed

 

For any question concerning this bean, send a mail to Mark at mark.striekwold@gmail.com.


an AWT open/save File Dialog

Purpose

This enhanced Java Bean is a "fast" open/save file chooser dialog, based on the AWT system, for those who think that the Swing JFileChooser available is too "slow".

It uses the FBean package.





The Java code

     AWTFileDialog.java



The methods you can set


Register the bean


The Implementation Class is : oracle.forms.fd.AWTFileDialog

FBean.Register_Bean('CTRL.BEAN', 1, 'oracle.forms.fd.AWTFileDialog');

 



Open file dialog box


var := FBean.Invoke_Char('CTRL.BEAN', 1, 'openFile' ,'Open a file...,C:\,*.java');

The last argument is composed by a title, a starting directory and a file filter.
If you want to provide a file type list, separate them with a ; like the following:
var := FBean.Invoke_Char('CTRL.BEAN', 1, 'openFile' ,'Open a file...,C:\,*.jpg;*.jpeg;*.gif');

 


Save file dialog box


var := FBean.Invoke_Char('CTRL.BEAN', 1, 'saveFile' ,'Save file as......,C:\,filename.txt');



set debug ON/OFF


FBean.Invoke('CTRL.BEAN', 1, 'setLog' ,'true | false');






The sample dialog


     . Download the AWTFileDialog.jar file
     . Download the AWTFileDialog.fmb file
     . copy the AWTFileDialog.jar file in the <ORACLE_HOME>/forms/java directory
     . Edit your /forms/server/formsweb.cfg file to add the AWTFileDialog.jar to both archive and archive_jini tags.
     . Open the AWTFileDialog.fmb module
     . Compile all and run the module

See also another File selection bean by Hafed Benteftifa

A FTP Java Bean

Purpose

Here is a Pluggable Java Component that allows to manage a FTP connection.

It is based on the Calvin Tai ftpbean.

simpleFTP bean


The Java source

     SimpleFTP.java



The implementation class of the Bean Area

     oracle.forms.fd.SimpleFTP


The methods you can set

  • managing connection


-- connect the FTP host --
Set_Custom_Property('BL.BEAN', 1, 'CONNECT', 'host_name,user[,password]' );

-- set the port number (if <> 21)
Set_Custom_Property('BL.BEAN', 1, 'SET_PORT', 'port_number' );

-- set the socket timeout number --
Set_Custom_Property('BL.BEAN', 1, 'SET_SOCKET_TIMEOUT', 'number' );

-- set the passive mode (default true) --
Set_Custom_Property('BL.BEAN', 1, 'SET_PASSIVE_MODE_TRANSFER, 'true|false');'

-- close the connection --
Set_Custom_Property('BL.BEAN', 1, 'CLOSE', '' );


  • managing content


-- change host directory --
Set_Custom_Property('BL.BEAN', 1, 'SET_DIRECTORY', 'remote_directory' );

-- get the host directory list --
Set_Custom_Property('BL.BEAN', 1, 'DIRECTORY_LIST', 'remote_directory' );

-- get a binary file --
Set_Custom_Property('BL.BEAN', 1, 'GET_BINARY_FILE', 'remote_filename,local_filename[,remote_file_size][,...]' );

You can provide multiple pairs of remote/local/file_size:
Set_Custom_Property('BL.BEAN',1,'GET_BINARY_FILE','file1.jpg,d:\file1.jpg,0,file2.jpg,d:\file2.jpg,0

If the remote_file_size is not provided, the progress bar will not display the exact values.

-- get an ascii file --
Set_Custom_Property('BL.BEAN', 1, 'GET_ACSII_FILE', 'remote_filename,local_filename[,remote_file_size]' );

If the remote_file_size is not provided, the progress bar will not display the exact values.

-- put a binary file --
Set_Custom_Property('BL.BEAN', 1, 'PUT_BINARY_FILE', 'locale_filename,remote_filename[,...]' );

You can provide multiple pairs of remote/local/file_size:

Set_Custom_Property('BL.BEAN',1,'PUT_BINARY_FILE','d:\file1.jpg,file1.jpg,d:\file2.jpg,file2.jpg


-- change to the parent host directory --
Set_Custom_Property('BL.BEAN', 1, 'TO_PARENT_DIR', '' );

-- create a host directory --
Set_Custom_Property('BL.BEAN', 1, 'MAKE_DIRECTORY', 'remote_directory' );

-- remove a host directory --
Set_Custom_Property('BL.BEAN', 1, 'REMOVE_DIRECTORY', 'remote_directory' );

-- delete a remote file --
Set_Custom_Property('BL.BEAN', 1, 'FILE_DELETE', 'remote_filename' );     

-- rename a remote file --
Set_Custom_Property('BL.BEAN', 1, 'FILE_RENAME', 'remote_filename' );

-- execute a command --
Set_Custom_Property('BL.BEAN', 1, 'EXECUTE', 'command' );


  • progress bar

To not just making the wrapper around the great Calvin work, I have added a nice progress bar you can display while transfering files.
The progress bar can be as simple as possible to include it in your existing design, but it can also have a titled border.
All the dimensions must be given in pixel.

-- display/hide the file transfer progress bar --
Set_Custom_Property('BL.BEAN', 1, 'SET_PROGRESS_BAR, 'true|false');'

-- set the progress bar location --
Set_Custom_Property('BL.BEAN', 1, 'SET_PROGRESS_BAR_LOCATION', 'X_POS,Y_POS' );

The coordinates are pixel based, and relative to the upper-left corner of the canvas.
If it is not provided or equals to -1,-1  the progress bar is centered to the canvas.

-- set the progress bar size --
Set_Custom_Property('BL.BEAN', 1, 'SET_PROGRESS_BAR_SIZE', 'width,height' );

If it is not provided, the default values are : 200,16

-- set the progress bar title --
Set_Custom_Property('BL.BEAN', 1, 'SET_PROGRESS_BAR_TITLE', 'title' );

If it is not provided, the progress bar is displayed without any titled border

-- switch on/off the Java console loggin --
Set_Custom_Property('BL.BEAN', 1, 'SET_LOG', 'true|false');


The methods you can get

-- get the message corresponding to the last FTP order --
var := Get_Custom_Property('BL.BEAN', 1, 'GET_MESSAGE');

Generally used after every FTP order to check the execution status.
Returns "OK" if the command succeeded, else returns the error message.

-- get the file list --
var := Get_Custom_Property('BL.BEAN', 1, 'GET_FILE_LIST');

Returns a delimited string of all records founds. The fields are separated by a CHR(9), and the records are separated by a CHR(10).

The record is composed by the following:
 - File type (DIR | FILE | LINK | OTHER)
 - File name
 - File size
 - File date

-- get the FTP reply string --
var := Get_Custom_Property('BL.BEAN', 1, 'GET_REPLY');

It is composed by the FTP code and the FTP message.

-- get the FTP port number --
var := Get_Custom_Property('BL.BEAN', 1, 'GET_PORT');

-- get the FTP socket timeout value --
var := Get_Custom_Property('BL.BEAN', 1, 'GET_SOCKET_TIMEOUT');

-- get the host server name --
var := Get_Custom_Property('BL.BEAN', 1, 'GET_SERVER_NAME');


The events raised by the bean

PROGRESS_MESSAGE
Is raised by the bean by the progress bar

PROGRESS_VALUE
is the current progress bar value

-- example of When-Custom-Item-Event trigger --
DECLARE
    eventName varchar2(30) := :system.custom_item_event;
    eventValues ParamList;
    eventValueType number;
    LC$Value  varchar2(1000);
BEGIN
   IF (eventName='PROGRESS_MESSAGE') THEN
      eventValues := get_parameter_list(:system.custom_item_event_parameters);
      get_parameter_attr(eventValues,'PROGRESS_VALUE',eventValueType, LC$Value);  
      -- display the current transfert percentage --
      :BL.PROGRESS := LC$Value || '%' ;
      Synchronize;
   END IF;
END;



The sample dialog


     . Download the simpleFTP.zip file
     . Unzip the file
     . copy the ftpbean.jar and simpleFTP.jar files in the <ORACLE_HOME>/forms/java directory
     . Edit your /forms/server/formsweb.cfg file
     archive_jini=f90all_jinit.jar,ftpbean.jar,simpleFTP.jar
     archive=f90all.jar,ftpbean.jar,simpleFTP.jar

     . Open the simpleFTP.fmb module (Oracle Forms 9.0.2)
     . Compile all and run the module

In the sample dialog, when you are connected to the FTP server, double-clicking one line of the file content table-block will open and display the new folder if the file type is DIR, or download the underlying file on the c:/ folder if the file type is FILE.


The two JAR files have to be signed.
Those, shipped with the zip file are already signed.


A PopList PJC with same C/S behaviour

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

- page 4 of 13 -