Overblog
Suivre ce blog
Editer l'article Administration Créer mon blog
24 décembre 2008 3 24 /12 /décembre /2008 14:40

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

Partager cet article

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

commentaires

zeid 13/12/2015 13:53

hi and thanks for the great post , i hava a question , what should i do to build the jar jar file and how to , after i modify the the java code, if possible ??

Dave Schmoldt 10/12/2009 00:38


This works so much better than the default Webutil file dialogues.  Thanks!

Just a correction based on my experiments:  to save a file as a specific name, use this syntax.  This will default the save dialog to the C: drive and a filename of 'myfilename.txt'.


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



Hafed 26/12/2008 05:29

Hello,I posted a similar implementation based on VBean over at http://www.degenio.com/2008/12/file-selection-dialog-with-oracle-forms-10g-1012-replacing-some-of-webutil-functionalities/I choose to follow the fileuploader  demo used in Forms 10g.Now, whether the use of FileDialog over JFileChooser is warranted was not an option. With a directory that contains more than 1200 folders,  FileDialog gives a much better user experience and saved us from a number of user complaints.

Oracle Forms community 26/12/2008 09:09


Good information, Hafed. I have added a link to your blog entry to this article