Mardi 11 septembre 2007

Purpose

Here is a Java Bean that allows reading, displaying with scaling and writing images.

(See the last  evolution of this solution here)

 

This Bean allows scaling images to fit the target item size, and includes a FileChooser with image preview dialog.


handleimage2

This JavaBean connects to the database through the JDBC driver to read and write the images, and does not need the Webutil library to pick up the image files from the JAR file, the client machine files or the Internet.


The Java code

     HandleImage.java     LectureBlob.java        GetImageFileName.java



The implementation class of the Bean Item

     oracle.forms.fd.HandleImage


The methods you can call


Set the connection string


Set_Custom_Property('BLOCK.ITEM',1,'SETCONN','the_connection_string');
e.g. :
Set_Custom_Property( 'BL.BEAN', 1, '
SETCONN', 'jdbc:oracle:thin:@my-machine:1521:XE' ) ;   
(Provide the complete jdbc:oracle:thin:... syntax)


Set the username


Set_Custom_Property('BLOCK.ITEM',1,'SETUSER','username');


Set the password

Set_Custom_Property('BLOCK.ITEM',1,'SETPWD','password');


Set the
database image table information

Set_Custom_Property('BLOCK.ITEM',1,'SETTABLEINFO','p1,p2');

p1 is the table name that holds the image Blob column
p2 is the Blob column name that holds the image

e.g.:
Set_Custom_Property( 'BLZ.BEAN', 1, 'SETTABLEINFO', 'PHOTOS,IMAGE' ) ;  

The instruction above indicates that the PHOTOS table handle images in the IMAGE Blob column..


Read an image from a file

Set_Custom_Property('BLOCK.ITEM',1,'READIMGFILE','the_complete_filename');

e.g.:
Set_Custom_Property( 'BLZ.BEAN', 1, 'READIMGFILE', 'D:/image.jpg' ) ; 


Read an image from the database table

Set_Custom_Property('BLOCK.ITEM',1,'READIMGBASE,'where_clause');

e.g.:
Set_Custom_Property( 'BLZ.BEAN', 1, 'READIMGBASE', 'IDENTIFIANT=20' ) ;  

where_clause is the SQL clause to identify a unique row to update in the table. The above instruction will be interpreted as :

   Select IMAGE From PHOTOS Where IDENTIFIANT=20


Put this method into the When-New-Record-Instance block-level trigger


Write an image to the database table

Set_Custom_Property('BLOCK.ITEM',1,'WRITEIMGFILE','where_clause');

e.g.:
Set_Custom_Property( 'BLZ.BEAN', 1, 'WRITEIMGBASE', 'IDENTIFIANT=20' ) ;  

where_clause is the SQL clause to identify a unique row to update in the table.
The above instruction will be interpreted as :

   Update PHOTOS Set IMAGE = ? Where IDENTIFIANT=20


Put this method into the Post-Insert and Post-Update block-level triggers



Clear the image

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

This function has to be called in a When-New-Record-Instance trigger if the record does not exist:

When-New-Record-Instance trigger:
If :PHOTOS.IDENTIFIANT is not null Then
   Set_Custom_Property( 'BLZ.BEAN', 1, 'READIMGBASE', 'IDENTIFIANT=12' ) ;
Else
   Set_Custom_Property( 'BLZ.BEAN', 1, 'CLEAR', '' ) ;
End if ;
:BLZ.IMG_SIZE := Get_Custom_Property( 'BLZ.BEAN', 1, 'GETSIZE' ) ;


Set the display image scalling

This function concerns only the image displayed. The image stored with the WRITEIMGBASE method will be the initial image.

Set_Custom_Property( 'BL.BEAN', 1, '
SCALE_IMAGE
' , 'Width=x,Height=y' ) ;

Both Width and Height parameters must be transmitted

x and y can take the following values:


Any value greater than 0 that express an absolute size in pixels
the special value: FIT that extend to fit the exact size of the image panel' size
-1 that to keep the corresponding aspect ratio
0 that indicates no scale at all



Examples:


-- Scale the image to fit horizontally and vertically the image item --

Set_Custom_Property( 'BLZ.BEAN', 1, 'SCALE_IMAGE', 'Width=FIT,Height=FIT' ) ;

-- Scale the image to 200x100 pixels --
Set_Custom_Property( 'BLZ.BEAN', 1, 'SCALE_IMAGE', 'Width=200,Height=100' ) ;

-- Scale the image to 200 horizontal pixels and keep vertical aspect ratio --
Set_Custom_Property( 'BLZ.BEAN', 1, 'SCALE_IMAGE', 'Width=200,Height=-1' ) ;





Display/hide the image panel' scrollbars

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


e.g.:
Set_Custom_Property( 'BLZ.BEAN', 1, 'SETSCROLL', 'true' ) ; 



Set the JFileChooser title and starting directory

Set_Custom_Property('BLOCK.ITEM',1,'SET_FILECHOOSER_TITLE','title[,directory]');

e.g.:
Set_Custom_Property( 'BLZ.BEAN', 1, 'SET_FILECHOOSER_TITLE', 'Select a file,D:/' ) ; 


Set the JFileChooser Look and Feel


Set_Custom_Property('BLOCK.ITEM',1,'SET_FILECHOOSER_LAF','SYSTEM|other_value');


e.g.:
-- use the current O.S. L&F --
Set_Custom_Property( 'BLZ.BEAN', 1, 'SET_FILECHOOSER_LAF', 'SYSTEM' ) ;
 

-- use the Metal L&F --
Set_Custom_Property( 'BLZ.BEAN', 1, 'SET_FILECHOOSER_LAF', 'JAVA' ) ;
 



Set the log mode to output the Bean messages

Set_Custom_Property( 'BLZ
.BEAN', 1, 'SETLOG' , 'true|false' ) ;



In the sample dialog provided, here is the code used in the When-New-Form-Instance trigger:

PROCEDURE InitForm IS
BEGIN
  -- switch the log to true --
  Set_Custom_Property( 'BLZ.BEAN', 1, 'SETLOG', 'true' ) ;
  -- set the baen image bckground color --
  Set_Custom_Property( 'BLZ.BEAN', 1, 'SETBG', '255,255,255' ) ;
  -- set the JDBC connection information --
  Set_Custom_Property( 'BLZ.BEAN', 1, 'SETCONN', 'jdbc:oracle:thin:@my-machine:1521:XE' ) ;
  Set_Custom_Property( 'BLZ.BEAN', 1, 'SETUSER', 'tutoforms' ) ;
  Set_Custom_Property( 'BLZ.BEAN', 1, 'SETPWD',  'tutoforms' ) ;
  -- set the image table and column name --
  Set_Custom_Property( 'BLZ.BEAN', 1, 'SETTABLEINFO',  'PHOTOS,PHOTO_JAVA,IDENTIFIANT' ) ;
  -- Set the JFileChooser title --
  Set_Custom_Property( 'BLZ.BEAN', 1, 'SET_FILECHOOSER_TITLE',  'Select an image file' ) ;
  -- Set the JFileChooser L&F --
  Set_Custom_Property( 'BLZ.BEAN', 1, 'SET_FILECHOOSER_LAF', 'SYSTEM' ) ;
  -- scalling properties --
  Set_Custom_Property( 'BLZ.BEAN', 1, 'SCALE_IMAGE' , 'Width=FIT,Height=FIT' ) ;
  -- display scrollbars policy --
  Set_Custom_Property( 'BLZ.BEAN', 1, 'SETSCROLL',  'false' ) ;
 
END;

Here is the description of the database table used:

CREATE TABLE PHOTOS
   (   
      "IDENTIFIANT" NUMBER(5,0) NOT NULL ENABLE,
      "NOM" VARCHAR2(50 BYTE),
      "PHOTO" BLOB,
      "PHOTO_JAVA" BLOB,
      CONSTRAINT "PHOTO_PK" PRIMARY KEY ("IDENTIFIANT") ENABLE
   )
/



The properties you can get from the JavaBean


Get the image size

Varchar2 :=
Get_Custom_Property( 'BL.BEAN', 1, 'GETSIZE'
) ;

The format returned (width,height) is like the following : 50,120



Get the
selected filename (JFileChooser)

Varchar2 :=
Get_Custom_Property( 'BL.BEAN', 1, 'GET_FILE_NAME'
) ;


This method, both open the JFileChooser dialog box, then returns the selected file.





Accessing to a remote database

Because the JavaBean is executed within an applet, it is not possible to connect to a remote database without a little adaptation:

   - first, the jar file must be signed.
   - second : you have to update the java.policy file stored in the Jinitiator directory

For example, to access to the database located on the machine-name server on the port 1524, add the following lines to the java.policy file:

C:/Program Files/Oracle/JInitiator 1.3.1.xx/lib/security/java.policy file

 

permission java.net.SocketPermission "machine-name:1524-", "accept,connect,listen,resolve";	  

permission java.security.AllPermission;


The sample dialog


     . Download the handleimage2.zip file
     . Unzip the file
     . run the create_table.sql under the Oracle user you want to test (It creates the sample image table).
     . copy the handleimage2.jar file in the <ORACLE_HOME>/forms/java directory
     . Edit your /forms/server/formsweb.cfg file to add both handleimage2.jar and classes12.jar (the classes12.jar is located in the <DEV_HOME>/jdbc/lib directory. add a copy of this file in the <DEV_HOME>/forms/java directory).
     . Open the HANDLEIMAGE2.fmb module (Oracle Forms 10.1.2)
     . Compile all and run the module



Note : If you rebuild the jar file, it has to be signed. (the handleimage2.jar file provided in this article is already signed).
par Oracle Forms community publié dans : Bean - general
ajouter un commentaire commentaires (5)    recommander
Mercredi 30 mai 2007

Purpose

Here is a Java Bean that allows handling frames at runtime.
Almost everything about frames can by handled.

With this single bean, you can create and handle as many frames as needed.

This Bean needs at least the Sun Java plugin 1.4

Dynamic Frames

Dynamic Frames

What you can do with these frames:

  • Create, move, modify, show, hide and remove
  • Set the border width, color, shadow color and rounded corners.
  • Set the title font, color and alignment. It can be on top, on left, on right or on bottom border line.
  • Set the frame inside color or gradient

The Implementation Class property

   oracle.forms.fd.frame


The Java code

    frame.java


The properties you can set


Each property takes a frame name as its first argument.
It is, so, easy to reuse this name to set the properties for the desired frame.


SET_FRAME
create the frame (must be used first)

Set_Custom_Property('BL.BEAN',1,'SET_FRAME','properties') ;

properties:
   name, border_width, title, font, font_size, font_weight [,title_pos, alignment]

title_pos can be:

  • top
  • bottom
  • left
  • right

alignment can be:

  • left
  • center
  • right

Set_Custom_Property('BL.BEAN',1,'SET_FRAME','F1,3,Frame Title,Arial,16,B,top,center') ;


SET_FRAME_TEXT
Set the frame title and eventually the position.

Set_Custom_Property('BL.BEAN',1,'SET_FRAME_TEXT','properties') ;

properties:
   name, title [,title_pos, alignment]

title_pos can be:

  • top
  • bottom
  • left
  • right

alignment can be:

  • left
  • center
  • right

Set_Custom_Property('BL.BEAN',1,'SET_FRAME'_TEXT,'F1,Frame Title,top,center') ;


SET_FRAME_TEXT_ALIGNMENT
Set the frame title position.


Set_Custom_Property('BL.BEAN',1,'SET_FRAME_TEXT_ALIGNMENT','properties') ;

properties:
   name, title_pos, alignment

title_pos can be:

  • top
  • bottom
  • left
  • right

alignment can be:

  • left
  • center
  • right

Set_Custom_Property('BL.BEAN',1,'SET_FRAME_TEXT_ALIGNMENT','F1,top,center') ;


SET_FRAME_TEXT_OPAQUE
Indicate if the title background is opaque or not

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

Set_Custom_Property('BL.BEAN',1,'SET_FRAME_TEXT_OPAQUE','F1,false') ;


SET_FRAME_FONT
Set the title font

Set_Custom_Property('BL.BEAN',1,'SET_FRAME_FONT','properties') ;

properties:
   name, font_name [,font_size [,font_weight ] ]

font_weight can be:

  • N (Normal)
  • B (Bold)
  • I (Italic)
  • BI (Bold+Italic)

Set_Custom_Property('BL.BEAN',1,'SET_FRAME_FONT','Arial,14,B') ;


SET_FRAME_BACKGROUND
Set the inside frame background


Set_Custom_Property('BL.BEAN',1,'SET_FRAME_BACKGROUND','properties') ;

properties:
   name, color1 [,color2 [, transparency_level]]

colors are exprimed as RxxxGxxxBxxx syntax.
If the first color is given, it represents the plain background color
If  you specify the two colors, it represents a gradient from color1 to color 2
Transparency_level must be a flot between 0.0 (full tra,sparency) and 1.0 (opaque)
If you provide a transparency_level but no second color, put - in place of color2

-- plain red background --
Set_Custom_Property('BL.BEAN',1,'SET_FRAME_BACKGROUND','F1,r255g0b0') ;
-- gradient background from white to red --
Set_Custom_Property('BL.BEAN',1,'SET_FRAME_BACKGROUND','F1,r255g255b255,r255g0b0') ;
-- plain red background with .3 transparency level --
Set_Custom_Property('BL.BEAN',1,'SET_FRAME_BACKGROUND',' F1,r255g0b0,-,.3') ;


SET_FRAME_COLORS
Set the border frame colors


Set_Custom_Property('BL.BEAN',1,'SET_FRAME_FONT','properties') ;

properties:
   name, color1 [,color2]

colors are exprimed as RxxxGxxxBxxx syntax.
color1 is the frame color
color2 is the frame shadow color

-- set frame color without shadow --
Set_Custom_Property('BL.BEAN',1,'SET_FRAME_COLORS','F1,r200g200b200') ;
-- set frame color with shadow --
Set_Custom_Property('BL.BEAN',1,'SET_FRAME_COLORS','F1,r255g255b255,r120g120b120') ;


SET_FRAME_GRADIENT_ORIENTATION
Set the frame inside gradient orientation

Set_Custom_Property('BL.BEAN',1,'SET_FRAME_BACKGROUND','F1,orientation') ;

orientation can be:

  • LeftToRight
  • RightToLeft
  • UpToDown
  • DownToUp


Set_Custom_Property('BL.BEAN',1,'SET_FRAME_BACKGROUND','F1,LeftToRight') ;


SET_FRAME_ROUND_BORDER
Tell if the frame border is rounded or not

By default, the frame is created with no rounded border.

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

Set_Custom_Property('BL.BEAN',1,'SET_FRAME_ROUND_BORDER','F1,true') ;


SET_FRAME_BOUNDS
Set the frame bounds

This method have to be used just after the SET_FRAME method

Set_Custom_Property('BL.BEAN',1,'SET_FRAME_BOUNDS','name,properties');

Properties:
   x_position, y_position, width, height

Set_Custom_Property('BL.BEAN',1,'SET_FRAME_BOUNDS','F1,10,10,300,200');


SET_FRAME_HCYCLE
Set the horizontal cycle factor for a gradient frame color


Set_Custom_Property('BL.BEAN',1,'SET_FRAME_HCYCLE','properties');

properties:
   name, cycle_value

cycle_value can be expressed in number of pixel or divisor_factor

-- Horizontal cycle that repeat twice in the frame --
Set_Custom_Property('BL.BEAN',1,'SET_FRAME_HCYCLE','F1,/2');


SET_FRAME_VCYCLE
Set the vertical cycle factor for a gradient frame color


Set_Custom_Property('BL.BEAN',1,'SET_FRAME_VCYCLE','properties');

properties:
   name, cycle_value

cycle_value can be expressed in number of pixel or divisor_factor

-- Vertical cycle that repeat each 50 pixels --
Set_Custom_Property('BL.BEAN',1,'SET_FRAME_VCYCLE','F1,50');

 

SET_FRAME_TITLE_COLOR
Set the frame title color


Set_Custom_Property('BL.BEAN',1,'SET_FRAME_TITLE_COLOR','properties');

properties:
   name, foreground_color [,background_color]

-- set a blue foreground title color
Set_Custom_Property('BL.BEAN',1,'SET_FRAME_TITLE_COLOR','F1,r0g0b255');


SHOW_FRAME
Show the given frame


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


HIDE_FRAME
Hide the given frame

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


REMOVE_FRAME
Remove the given frame

Set_Custom_Property('BL.BEAN',1,'REMOVE_FRAME','name');


REMOVE_ALL_FRAMES
Remove all frames


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


Full example:

  -- create the frame --
  Set_Custom_Property('BL.BEAN',1,'SET_FRAME','F1,3, Frame Title ,Arial,16,B,top,center') ;
  -- set the bounds --
  Set_Custom_Property('BL.BEAN',1,'SET_FRAME_BOUNDS','F1,10,10,320,180') ;
  -- set the title color --
  Set_Custom_Property('BL.BEAN',1,'SET_FRAME_TITLE_COLOR','F1,r204g0b0') ;
  -- set the inset frame colors --
  Set_Custom_Property('BL.BEAN',1,'SET_FRAME_BACKGROUND','F1,r255g255b255,r204g0b0') ;
  -- set the vertical gradient cycle --
  Set_Custom_Property('BL.BEAN',1,'SET_FRAME_VCYCLE','F1,/2') ;
  -- set a rounded border --
  Set_Custom_Property('BL.BEAN',1,'SET_FRAME_ROUND_BORDER','F1,true') ;
  -- set the frame border colors --
  Set_Custom_Property('BL.BEAN',1,'SET_FRAME_COLORS','F1,r204g0b0,r180g180b180') ;


The sample dialog

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

 

par Oracle Forms community publié dans : Bean - general
ajouter un commentaire commentaires (0)    recommander
Lundi 21 mai 2007

Purpose

Here is a Java Bean from Casey Bowden to get the status of a long report and to cancel it if needed.

Report Monitor

ReportMonitor detail

I. Problem One: Report Status


When running Oracle Forms and Reports in client/server, users knew the status of the report they were running. After converting to the web version of Oracle Forms and Reports users are get a locked screen and do not know the status of the report. This is usually an issue with longer running reports.

Solution: I created a ReportMonitor JavaBean that launches a separate applet, from the current forms session, to update the user on the status of the report. The applet will close when the report is finished or encounters an error.

 

II. Problem Two: Cancel Report

When running Oracle Forms and Reports in client/server, users could cancel a report. After converting to the web version of Oracle Forms and Reports users are get a locked screen. If the user wants to run another report without waiting for the current report to finish, I have found that users close the browser and start another session.

Solution: I created a ReportMonitor JavaBean that launches a separate applet, from the current forms session, that has a "Cancel Report" button so users can cancel the report and continue with what they were doing.

Download the  ReportMonitor Demo, overview, source and installation instructions


The zip file contains all the necessary documentation to install and configure this bean.
Read carrefully the Installation.rtf file that explains step by step how to configure the tool that needs external JAR files to run.
For any question concerning this bean, send a mail to Casey at
cbowden@dsdmail.net
par Oracle Forms community publié dans : Bean - general
ajouter un commentaire commentaires (0)    recommander
Samedi 19 mai 2007

Purpose

Here is a Java bean to dynamically handle menu options at runtime.

Dynamic Menu


Dynamic Menu

You can dynamically add, remove, enable, disable, show and hide menus and menu options.


The Java code

     DynamicMenu.java



The implementation class of the Bean Item

     oracle.forms.fd.DynamicMenu


The methods you can set



Set the menu and menu option graphical properties

Set_Custom_Property('BL.BEAN', 1, 'SET_PROPERTIES', 'props' ) ;

props is : menu_type, font_name, weight,size[,foreground_color[,background_color]]

menu_type can be MenuBar or MenuOption


e.g. :
Set_Custom_Property('BL.BEAN', 1, 'SET_PROPERTIES', 'MenuBar,Tahoma,B,14,r255g255b255,r255g0b0' ) ;
   


Read the current menu

It is used to get the starting Forms current menu to set the given graphical properties.

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

 

Add a popup menu

Set_Custom_Property('BL.BEAN', 1, 'ADD_MENU', 'menu_name,menu_label' ) ;

Adds a new popup menu at the end of the menu bar


e.g. :
Set_Custom_Property('BL.BEAN', 1, 'ADD_MENU', 'Main.Menu1,Menu1' ) ;
   

 

Add a menu option to an existing popup menu

Set_Custom_Property('BL.BEAN', 1, 'ADD_MENU_OPTION', 'props' ) ;

 

props is : internal_menu_name, label, command [, tooltip [,image] ]


internal_menu_name is the name given to the menu option -> e.g: Menu1.Option1


- If you want to provide image name, but no tooltip, put '-' instead of tooltip text


note: Image size for menu option is generally 16x16 pixels.


If the given parent's popup menu does not exists, the method does nothing.

e.g. :

-- Tooltip and no icon --
Set_Custom_Property('BL.BEAN', 1, 'ADD_MENU_OPTION', 'Menu1.Opt1,Option 1,Exit-Form','Option to exit the current form' ) ;

-- no tooltip but icon --
Set_Custom_Property('BL.BEAN', 1, 'ADD_MENU_OPTION', 'Menu2.Opt3,Option 3,instruction3,-,C:/dev/gif/icon-16.gif' ) ;


  

 

Add an option menu's separator

Set_Custom_Property('BL.BEAN', 1, 'ADD_MENU_OPTION', 'internal_option_name,SEPARATOR' ) ;

internal_option_name is the name given to the menu option -> e.g: Menu1.Sep1

e.g. :

Set_Custom_Property('BL.BEAN', 1, 'ADD_MENU_OPTION', 'Menu1.sep1,SEPARATOR' )


 

 

 

Show/Hide a popup menu

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

 

Enable/Disable a popup menu

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

 

Remove a menu option

Set_Custom_Property('BL.BEAN', 1, 'REMOVE_MENU_OPTION', 'Menu1.Opt10' ) ;

 

Show/Hide a menu option

Set_Custom_Property('BL.BEAN', 1, 'VISIBLE_MENU_OPTION', 'Menu1.Opt4, true|false' ) ;

 

Enabled/Disable a menu option

Set_Custom_Property('BL.BEAN', 1, 'STATUS_MENU_OPTION', 'Menu1.Opt4, true|false' ) ;

 

Move the "Window" system menu at end of the menu bar

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

Use this method when you have added all your popup menu to move the Window system popup menu at the end of the menu bar.

 

Here is an exemple of what could be a When-New-Form-Instance trigger:

-- Set menu properties --
Set_Custom_Property('BL.BEAN', 1, 'SET_PROPERTIES', 'MenuBar,Tahoma,B,14,r255g255b255,r255g0b0' ) ;
Set_Custom_Property('BL.BEAN', 1, 'SET_PROPERTIES', 'MenuOption,Tahoma,B,14,r128g128b255,r255g255b255' ) ;
-- Get the current menu --
Set_Custom_Property('BL.BEAN', 1, 'GET_MENU', '' ) ;
-- Add a few menu options --
Set_Custom_Property('BL.BEAN', 1, 'ADD_MENU', 'Menu1' ) ;
Set_Custom_Property('BL.BEAN', 1, 'ADD_MENU_OPTION', 'Menu1.Opt1,Option 1,instruction1' ) ;
Set_Custom_Property('BL.BEAN', 1, 'ADD_MENU_OPTION', 'Menu1.Opt2,Option 2,instruction2' ) ;
Set_Custom_Property('BL.BEAN', 1, 'ADD_MENU_OPTION', 'Menu1.sep1,SEPARATOR' ) ;
Set_Custom_Property('BL.BEAN', 1, 'ADD_MENU_OPTION', 'Menu1.Exit,Exit,Exit-Form' ) ;
Set_Custom_Property('BL.BEAN', 1, 'ADD_MENU', 'Menu1.SubMenu1,SubMenu1' ) ;
Set_Custom_Property('BL.BEAN', 1, 'ADD_MENU_OPTION', 'Menu1.SubMenu1.Exit,Exit,Exit-Form' ) ;
Set_Custom_Property('BL.BEAN', 1, 'ADD_MENU', 'Menu1.SubMenu1.SubSubMenu1,SubSubMenu1' ) ;  
Set_Custom_Property('BL.BEAN', 1, 'ADD_MENU_OPTION', 'Menu1.SubMenu1.SubSubMenu1.Exit,Exit,Exit-Form' ) ;
-- Move Window system menu at end --
Set_Custom_Property('BL.BEAN', 1, 'MOVE_WIN_MENU_OPTION', '' ) ;


 

 


The event received from the Bean

MENU_MSG


This event tells Forms that a menu option has been clicked.

The command associated to the menu option is read from the MENU_OPTION parameter.

You can get it in a WHEN-CUSTOM-ITEM-EVENT event:

DECLARE
    eventName      Varchar2(30) := :system.custom_item_event;
    eventValues    ParamList;
    eventValueType Number;
    LC$Option      varchar2(100);   
BEGIN
   
   IF (eventName='MENU_MSG') THEN
      -- get the menu message --
      eventValues := get_parameter_list(:system.custom_item_event_parameters);
      get_parameter_attr(eventValues,'MENU_OPTION',eventValueType, LC$Option);
      clear_message;
      Message(LC$Option, no_acknowledge) ;
      Synchronize ;
      ---------------------------------
      --  Handle the raised options  --
      ---------------------------------
      If LC$Option = 'Exit-Form' Then
           Exit_Form ;
      End if ;           
   END IF;
   
END;

 


The sample dialog

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


par Oracle Forms community publié dans : Bean - general
ajouter un commentaire commentaires (0)    recommander
Lundi 14 mai 2007

Purpose

Here is a Java Bean from Casey Bowden to get back print features lost in Oracle Reports  converting to web environment.

Direct Print

I. Problem One:

Point Of Sale (POS) clients is slow to print.

 

After converting reports from client/server to the web environment, OraRRP utility was used to print reports directly to client’s default printer, without being prompted with a print dialog. Even though OraRRP works as advertised, it does not meet the speed required for a POS terminal.

 

Solution:

In my experience with DirectPrint JavaBean, the time to print a receipt reduced from 12 – 14 seconds to 2 - 3 seconds. Also, DirectPrint JavaBean is downloaded and cached to the client machine when client accessed form that calls for DirectPrint JavaBean.

 

II. Problem Two:

OraRRP utility does not allow printing to named client printer.

 

Because of architectural change from client/server to web, knowledge of the client printers was lost since Report Server resides on the middle tier where knowledge of printers is loaded.

 

Solution:

With DirectPrint JavaBean, programmers can send PDF report output to named client printer. This feature can also be used to send a single report to multiple client printers that are either local or on the network. The exact printer name is required.

 

Conclusion:

DirectPrint JavaBean can be used to restore some print features lost when converting reports from a client/server to web environment.

 

Download the DirectPrint Demo, overview, source and installation instructions


The zip file contains all the necessary documentation to install and configure this bean.
All debug messages are output on the Java console. Set the debug property to ON to display them.
For any question concerning this bean, send a mail to Casey at
cbowden@dsdmail.net
par Oracle Forms community publié dans : Bean - general
ajouter un commentaire commentaires (0)    recommander
Samedi 12 mai 2007

Purpose

Here is a Java bean that allows decorating the Forms application containers.

Personalize

It becomes very easy to change all the fonts of a Forms application at runtime.

You can set the Font Family, weight and size, foreground and background color on the
following elements:

  • . Menu bar
  • . Menu options
  • . Window title (font only)
  • . Items
  • . Status bar




The Java code

    Personalize.java



The implementation class of the Bean Item

     oracle.forms.fd.Personalize


The methods you can set



Set the element properties


Set_Custom_Property( 'BL.BEAN', 1, 'SET_PROPERTIES', 'properties' );

properties is : Element_type, Font name, Font weight, Font size[, Foreground color, Background color]

Element_type can be:

  • . TextField
  • . TextArea
  • . Button
  • . CheckBox
  • . RadioB
  • . Tree
  • . ComboBox
  • . PopList
  • . TList
  • . Tree
  • . MenuBar
  • . MenuOption
  • . Status
  • . Window

e.g. :

Set_Custom_Property('BL.BEAN', 1, 'SET_PROPERTIES', 'TextField,Tahoma,B,14,r0g128b255' ) ;
Set_Custom_Property('BL.BEAN', 1, 'SET_PROPERTIES', 'Button,Tahoma,B,14,r0g128b255' ) ;
Set_Custom_Property('BL.BEAN', 1, 'SET_PROPERTIES', 'CheckBox,Tahoma,B,14,r0g128b255' ) ;
Set_Custom_Property('BL.BEAN', 1, 'SET_PROPERTIES', 'RadioB,Tahoma,B,14,r0g128b255' ) ;
Set_Custom_Property('BL.BEAN', 1, 'SET_PROPERTIES', 'Tree,Tahoma,B,14,r0g128b255' ) ;
Set_Custom_Property('BL.BEAN', 1, 'SET_PROPERTIES', 'ComboBox,Tahoma,B,14,r0g128b255' ) ;
Set_Custom_Property('BL.BEAN', 1, 'SET_PROPERTIES', 'Tree,Tahoma,B,14,r0g128b255' ) ;
Set_Custom_Property('BL.BEAN', 1, 'SET_PROPERTIES', 'MenuBar,Tahoma,B,14,r255g128b0,r200g255b150' ) ;
Set_Custom_Property('BL.BEAN', 1, 'SET_PROPERTIES', 'MenuOption,Tahoma,B,14,r0g185b90,r255g255b150' ) ;
Set_Custom_Property('BL.BEAN', 1, 'SET_PROPERTIES', 'Status,Tahoma,B,12,r255g255b255,r0g185b90' ) ;
Set_Custom_Property('BL.BEAN', 1, 'SET_PROPERTIES', 'Window,Tahoma,B,14' )
   


Start the decoration

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

 


The sample dialog

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


par Oracle Forms community publié dans : Bean - general
ajouter un commentaire commentaires (1)    recommander
Jeudi 10 mai 2007
Purpose

Here is a PJC that allows doing some basic operations on a Text Item.
You can apply styles on the selected sub-text and also view the HTML result in a browser window.
It is a "light" component that does not render the HTML result itself, but has the benefit to stay a simple PJC (no Java Bean).

     Basic embeded text

A popup menu is attached to both single and multi-line Text Items.
Select a part of the text, then right-click to display the popup menu.



The Java code

     EmbededTextField.java     EmbededTextArea.java


The implementation class of the
PJCs

     oracle.forms.fd.EmbedeTextField  for a single-line Text Item

     oracle.forms.fd.EmbedeTextArea  for a multi-line Text Item


The methods you can set

  • . Set the case

Set_Custom_Property( 'BL.BEAN', 1, 'CASE', 'case' ) ;

Where case can b:

    • - UPPER
    • - LOWER
 

 

  • . Set the style

Set_Custom_Property( 'BL.BEAN', 1, 'STYLE', 'style' ) ;

Where style can b:

    • - BOLD
    • - ITALIC
    • - UNDERLINE

 


The methods you can call


  • Get the cursor location in the Text Item

char := Get_Custom_Property( 'BL.BEAN', 1, 'GET_CARET_POSITION' ) ;

The first position is zero (0).

  • Get the selection range

char := Get_Custom_Property( 'BL.BEAN', 1, 'GET_RANGE_SELECTION' ) ;

that returns a comma delimited string : start_position,end_position

The first position is zero (0).



The sample dialog

     . Download the embededtext.zip file

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

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

par Oracle Forms community publié dans : Bean - general
ajouter un commentaire commentaires (0)    recommander
Mardi 1 mai 2007

Purpose

Here is a Java bean that allows querying a POP3 server

POP3 reader

It uses the commons-net-1.4.1.jar JAR file from the Jakarta project.
http://jakarta.apache.org/site/downloads/downloads_commons-net.cgi .

This bean does not use all the functionnalities of the org.apache.commons.net.pop3 classes.
See the documentation provided on the original site to get all availables methods.


The Java code

     POP3Reader.java



The implementation class of the Bean Item

     oracle.forms.fd.POP3Reader


The methods you can call



Set the login information and get the messages

Set_Custom_Property( 'BL.BEAN', 1, 'SET_LOGIN_INFO', 'login_info' );

login_info is : POP3 server name, username, password


e.g. :
LC$Log := 'pop3.free.fr,me@free.fr,my_password' ;
Set_Custom_Property( 'BL.BEAN', 1, 'SET_LOGIN_INFO', LC$Log ) ;
   


Clear the message list

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

Set the maximum length of the message body retrieved

Set_Custom_Property( 'BL.BEAN', 1, 'SET_MAX_LENGTH', 'max_length' );

login_info is : POP3 server name, username, password
</