Mardi 13 mai 2008

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

par Oracle Forms community publié dans : PJC - Text items
ajouter un commentaire commentaires (0)    recommander
Vendredi 15 février 2008

Purpose

Here is a Pluggable Java Component that allows to have non rectangular buttons.

Because it uses the Gradient features, it needs, at least the Sun java plugin 1.4
It won't run against JInitiator

You can have shapes described by polygon coordinate pairs, and also button made by a single letter, a word or even, by a complete sentence.


Amazing Button



The Java code

     amazingbutton.java



The implementation class of the Push Button Item

     oracle.forms.fd.AmazingButton


The methods you can set

Because it is a PJC that extends VButton, you can use the standard Set_Item_Property() built-in to set the standard button's properties.



Draw a circle button - SET_CIRCLE

Set_Custom_Property( 'BL.BT', 1, 'SET_CIRCLE','');

 

Draw a losange button - SET_LOSANGE

Set_Custom_Property( 'BL.BT', 1, 'SET_LOSANGE','');


 

Draw a polygon button - SET_POLYGON

Set_Custom_Property( 'BL.BT', 1, 'SET_POLYGON','x,y[,x,y[,...]]');

e.g.
Set_Custom_Property( 'BL.BT', 1, 'SET_POLYGON','24,0,47,34,47,58,38,58,24,37,10,58,1,58,0,33,24,1');

 

Draw a text button - SET_TEXT

Set_Custom_Property( 'BL.BT', 1, 'SET_TEXT','text[,font_name[,font_weight[,font_size]]]');

e.g.
Set_Custom_Property( 'BL.BT', 1, 'SET_TEXT','The text,Tahoma,B,45');

 

 

Set the text shadow color - SET_SHADOW_COLOR

Set_Custom_Property( 'BL.BT', 1, 'SET_TEXT_SHADOW','rgb_color');

default color is grey (r160g160b160)

e.g.
Set_Custom_Property( 'BL.BT', 1, 'SET_TEXT_SHADOW','r129g25b222');

 

 

Set the text shadow shift - SET_SHADOW_SHIFT

Set_Custom_Property( 'BL.BT', 1, 'SET_SHADOW_SHIFT','x_shift,y_shift');

e.g.
Set_Custom_Property( 'BL.BT', 1, 'SET_TEXT_SHADOW','-5,-4');


When no given x=4 and y=3.

If you want to hide the shadow, provide 0,0

 

  

Set the text position - SET_TEXT_POSITION

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

e.g.
Set_Custom_Property( 'BL.BT', 1, 'SET_TEXT_POSITION','left');

 

  

Set the text x,y position - SET_TEXT_AT

Set_Custom_Property( 'BL.BT', 1, 'SET_TEXT_AT','x_pos,y_pos');

e.g.
Set_Custom_Property( 'BL.BT', 1, 'SET_TEXT_AT','10,10');

 

 

 

Set the gradient colors - SET_GRADIENT

Set_Custom_Property( 'BL.BT', 1, 'SET_GRADIENT','rgb_color,rgb_color');

e.g.
Set_Custom_Property( 'BL.BT', 1, 'SET_GRADIENT','r230g154b117,r230g78b0');


 

Set the border color - SET_BORDER_COLOR

Set_Custom_Property( 'BL.BT', 1, 'SET_BORDER_COLOR','rgb_color');

e.g.
Set_Custom_Property( 'BL.BT', 1, 'SET_BORDER_COLOR','r225g50b30');


 

Set the rotation angle - SET_ROTATION

Set_Custom_Property( 'BL.BT', 1, 'SET_ROTATION','angle');

e.g.
Set_Custom_Property( 'BL.BT', 1, 'SET_ROTATION','90');


 

Scale the shape to fit the button's size - SCALE

Set_Custom_Property( 'BL.BT', 1, 'SCALE','true | false');

If not used, the shape is scaled by default.

e.g.
-- don't scale the shape --
Set_Custom_Property( 'BL.BT', 1, 'SCALE','false');


 

Draw the button's bounding box - DRAW_BORDER

Set_Custom_Property( 'BL.BT', 1, 'DRAW_BORDER','true | false');

e.g.
Set_Custom_Property( 'BL.BT', 1, 'DRAW_BORDER','true');


 

Draw all buttons' bounding boxes - DRAW_BORDER_ALL

Set_Custom_Property( 'BL.BT', 1, 'DRAW_BORDER_ALL','true | false');

e.g.
Set_Custom_Property( 'BL.BT', 1, 'DRAW_BORDER_ALL','true');


 

 

Draw the shape's bounding box - DRAW_CLIP_BORDER

Set_Custom_Property( 'BL.BT', 1, 'DRAW_CLIP_BORDER','true | false');

e.g.
Set_Custom_Property( 'BL.BT', 1, 'DRAW_CLIP_BORDER','true');


 

Draw all shapes' bounding boxes - DRAW_CLIP_BORDER_ALL

Set_Custom_Property( 'BL.BT', 1, 'DRAW_CLIP_BORDER_ALL','true | false');

e.g.
Set_Custom_Property( 'BL.BT', 1, 'DRAW_CLIP_BORDER_ALL','true');



 

Set a bevel background - SET_RELIEF

Set_Custom_Property( 'BL.BT', 1, 'SET_RELIEF','true | false');

e.g.
Set_Custom_Property( 'BL.BT', 1, 'SET_RELIEF','true');



 

Set a bevel background on every button - SET_RELIEF_ALL

Set_Custom_Property( 'BL.BT', 1, 'SET_RELIEF_ALL','true | false');

e.g.
Set_Custom_Property( 'BL.BT', 1, 'SET_RELIEF_ALL','true');



 

 

Set the Text button shadow thickness - SET_TEXT_THICKNESS

Set_Custom_Property( 'BL.BT', 1, 'SET_TEXT_THICKNESS','horizontal_thickness,vertical_thickness');

e.g.
Set_Custom_Property( 'BL.BT', 1, 'SET_TEXT_THICKNESS','6,6');




The sample dialog


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

 

par Oracle Forms community publié dans : PJC - Buttons
ajouter un commentaire commentaires (0)    recommander
Mercredi 6 février 2008

Purpose

Here is a Java Bean that allows to manage an "auto completion" Swing JComboBox.



Key Pressed



The Java code

     CBAutoCompletion.java     ComboBoxCompletion.java



The implementation class of the Bean Item

     oracle.forms.fd.ComboBoxCompletion


 

The methods you can set



Init the ComboBox values

-- Single value list --
Get_Custom_Property('BLOCK.ITEM',1,'
INIT','value[,value[,...]]');


e.g.:
-- initialise the ComboBox values --
Set_Custom_Property('BL.BEAN',1,'INIT','Ester,Jordi,Jordina,Jorge,Sergi');  
 


-- Twin value list (code+value) --

Get_Custom_Property('BLOCK.ITEM',1,'
INIT_TWIN','code,value[,code,value[,...]]');
code(stored value) is provided, then after value (displayed)


e.g.:
-- initialise the ComboBox values --
Set_Custom_Property('BL.BEAN',1,'INIT_TWIN','v1,Ester,v2,Jordi,v3,Jordina,v4,Jorge,v5,Sergi'); 
 

This method must be the first called.

If you need to incorporate NULL values in the list, use the equivalent INIT_NULL and INIT_TWIN_NULL methods.

To set the focus on the NULL value, use the SELECT_INDEX,'1' or SELECT_CODE,'' methods.

 

 

Set the Font

Get_Custom_Property('BLOCK.ITEM',1,'SET_FONT','font_name[,font_weight[,font_size]]);

font_weight could be one of the following:


P  : Plain
B  : Bold
I : Italic
BI : Bold+Italic


e.g.:
-- set the font --
Set_Custom_Property('BL.BEAN',1,'SET_FONT','Arial,B,12');
 



Enable/disable the combobox

Get_Custom_Property('BLOCK.ITEM',1,'SET_ENABLED','true | false');


e.g.:
-- disable the ComboBox --
Set_Custom_Property('BL.BEAN',1,'SET_ENABLED,'false'); 
 

 


Show/hide the ComboBox values

Get_Custom_Property('BLOCK.ITEM',1,'SET_VISIBLE','true | false');


e.g.:
-- hide the ComboBox --
Set_Custom_Property('BL.BEAN',1,'SET_VISIBLE,'false'); 
 

 

 

Set the starting index (by position)

Get_Custom_Property('BLOCK.ITEM',1,'SELECT_INDEX','index_num');


e.g.:
-- set focus on the 3rd option --
Set_Custom_Property('BL.BEAN',1,'SELECT_INDEX','3'); 
 

 

Set the starting index (by code)

Get_Custom_Property('BLOCK.ITEM',1,'SELECT_CODE','code');


e.g.:
-- set focus on the 3rd option --
Set_Custom_Property('BL.BEAN',1,'SELECT_CODE','v2'); 
 

 

Set the starting index (by value) twin value list only

Get_Custom_Property('BLOCK.ITEM',1,'SELECT_VALUE','value);


e.g.:
-- set focus on the 3rd option --
Set_Custom_Property('BL.BEAN',1,'SELECT_VALUE','Jordi'); 
 

 

 

The event raised by the bean

SELECTION_CHANGED

Each time the end user change the current value of the combobox, a message is send to Forms.

You can get this message in the When-Custom-Item-Event trigger of the Bean Item:
The index number is read from the SELECTION_INDEX list parameter
The code is read from the SELECTION_CODE list parameter
The value is read from the SELECTION_VALUE list parameter

 

DECLARE
    eventName varchar2(30) := :system.custom_item_event;
    eventValues ParamList;
    eventValueType number;
    LC$Index  varchar2(10);
    LC$Code  varchar2(1000);
    LC$Value  varchar2(1000);
BEGIN
   IF (eventName='SELECTION_CHANGED') THEN
      eventValues := get_parameter_list(:system.custom_item_event_parameters);
      get_parameter_attr(eventValues,'SELECTION_INDEX',eventValueType, LC$Index);
      get_parameter_attr(eventValues,'SELECTION_Code',eventValueType, LC$Code);
      get_parameter_attr(eventValues,'SELECTION_VALUE',eventValueType, LC$Value);
    
      -- display the current selction --
      :BL.SELECT := '[' || LC$Index || '] (' || LC$Code || ') ' || LC$Value ;

   END IF;
END;

 

 




The sample dialog


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

     The JAR file has to be signed.

 

par Oracle Forms community publié dans : Bean - general
ajouter un commentaire commentaires (0)    recommander
Vendredi 25 janvier 2008

Purpose

Here is a Java Bean that allows to get some client machine information.


Key Pressed



The Java code

     ClientInfos.java



The implementation class of the Bean Item

     oracle.forms.fd.ClientInfos


The methods you can get



Get all client information

Get_Custom_Property('BLOCK.ITEM',1,'GET_CLIENT_INFOS');


e.g.:
-- get all information --
:BL.INFOS := Get_Custom_Property('BL.BEAN', 1, 'GET_CLIENT_INFOS' ) ;
 



Get a particular client information

Get_Custom_Property('BLOCK.ITEM',1,'property');

where property could be one of the following:


OPERATING : Operating System
ARCHITECTURE : architecture
OSVERSION : OS version
IP : IP address
MAC : MAC address
JAVAVERSION : Java version
JAVAVENDOR : Java vendor
JAVAVENDORURL : Java vendor URL
JAVAHOME : Java vendor home page
JAVAVMSPECIFICATIONVERSION : Virtual machine version
JAVAVMSPECIFICATIONVENDOR : Virtual machine vendor
JAVAVMSPECIFICATIONNAME : Virtual machine name
USERNAME : user name
USERHOME : user home


e.g.:
-- get MAC address --
:BL.INFOS := Get_Custom_Property('BL.BEAN', 1, 'MAC' ) ;
 


 

 





The sample dialog


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

     The JAR file has to be signed.

 

par Oracle Forms community publié dans : Bean - general
ajouter un commentaire commentaires (0)    recommander
Vendredi 25 janvier 2008

Purpose

Here is a Java Bean that allows sending back to the Forms application each key pressed in any Text Item.



Key Pressed



The Java code

     keypressed.java



The implementation class of the Bean Item

     oracle.forms.fd.KeyPressed


The methods you can call




Initialize the bean

Set_Custom_Property('BLOCK.ITEM',1,'INIT','');

This method must be called in the When-New-Form-Instance. It is used to search for every Text Items in the Forms to attach to them a key listener.

e.g.:
-- Init the bean --
Set_Custom_Property( 'BL.BEAN', 1, 'INIT', '' ) ;
 

 



The event fired by the JavaBean


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>/forms/java directory
     . Edit your /forms/server/formsweb.cfg file to add the keypressed.jar .
     . Open the KEYPRESSED.fmb module (Oracle Forms 9.0.2)
     . Compile all and run the module

par Oracle Forms community publié dans : Bean - Text items
ajouter un commentaire commentaires (0)    recommander
Vendredi 21 décembre 2007

Purpose

Here is a Java bean that allows to choose a date from a Java swing calendar.

The Java calendar itself is from Kai Toedter - Released under GNU Lesser General Public License - www.toedter.com

It needs the Sun Java plugin to run (won't run with JInitiator).

(the JInitiator 1.3.28 compatible version is downlodable at the end of the article)



JCalendar

Just double-click a day in the calendar to send an event to Forms with the date parameters.



The Java code

     JCalendar.java



The implementation class of the Bean Item

     oracle.forms.fd.JCalendar


The properties you can set



Set some properties

Set_Custom_Property('BL.BEAN', 1, 'SET_PROPERTY', 'property_name,property_value');

property_name can be one of the following:

  • title : set the frame title
  • background : set the background color
  • foreground : set the foreground color
  • decorationforeground : set the decoration foreground color (Sun plugin only)
  • sundayforeground : set the sunday foreground color (Sun plugin only)
  • weekdayforeground : set the week day foreground color (Sun plugin only)
  • date : set the starting date (year,month,day) (Sun plugin only)
  • locale : set a new Locale
  • plasticLAF : set the PlasticLAF Look & Feel
  • log : set the trace to the Java console (true | false)

colors are sent with the following format : rXgXbX where x must be between 0 and 255

e.g. :
Set_Custom_Property('BL.BEAN',1, 'SET_PROPERTY','plasticLAF,true');
Set_Custom_Property('BL.BEAN',1, 'SET_PROPERTY','log,true');
Set_Custom_Property('BL.BEAN',1, 'SET_PROPERTY','title,Choose...');
Set_Custom_Property('BL.BEAN',1, 'SET_PROPERTY','locale,US');
Set_Custom_Property('BL.BEAN',1, 'SET_PROPERTY','foreground,r128g50b50');

Set_Custom_Property('BL.BEAN',1, 'SET_PROPERTY','date,2007,12,25');


Show the calendar


Set_Custom_Property('BL.BEAN', 1, 'SHOW_CALENDAR', '[x_position,y_position]');

 

 

If x_position and y_position are given, the calendar will be shown at this position (top-left corner).

e.g:
-- show calendar --
Set_Custom_Property('BL.BEAN',1, 'SHOW_CALENDAR','');

-- show calendar at position 50,50 --
Set_Custom_Property('BL.BEAN',1, 'SHOW_CALENDAR','50,50');

 

The event received from the Bean

CALENDAR_EVENT


this event tells Forms that a date has been chosen in the calendar.
You can get it in a WHEN-CUSTOM-ITEM-EVENT event:

DECLARE
   
    eventName varchar2(30) := :system.custom_item_event;
    eventValues ParamList;
    eventValueType number;
    LC$Date   varchar2(256); -- complete date
    LC$Day    varchar2(256); -- day number (1-31)
    LC$Month  varchar2(256); -- month number (1-12)
    LC$Year   varchar2(256); -- year number
   
BEGIN
   
   IF (eventName='CALENDAR_EVENT') THEN
      eventValues := get_parameter_list(:system.custom_item_event_parameters);
      get_parameter_attr(eventValues,'CALENDAR_EVENT_DATE',eventValueType, LC$Date);
      get_parameter_attr(eventValues,'CALENDAR_EVENT_DAY',eventValueType, LC$Day);
      get_parameter_attr(eventValues,'CALENDAR_EVENT_MONTH',eventValueType, LC$Month);
      get_parameter_attr(eventValues,'CALENDAR_EVENT_YEAR',eventValueType, LC$Year);
      Clear_Message;
      Message('Selected date:'|| LC$Date || '(' || LC$Day||'/'||LC$Month||'/'||LC$Year || ')');
      Synchronize ;           
   END IF;  
   
END;



The sample dialog

     . Download the JCalendar.zip file
     . Unzip the file
     . copy the FJCalendar.jar, jcalendar-1.3.2.jar and looks-2.0.1.jar files in the <ORACLE_HOME>/forms/java directory
     . Edit your /forms/server/formsweb.cfg file to add these 3 JAR files
     . Open the JCALENDAR.fmb module (Oracle Forms 9.0.2)
     . Compile all and run the module

     the FJCalendar.jar file must be signed.
     the jar file provided in this article is already signed.


Jinitiator 1.3.28 compatible version

     . Download the JCalendarJinit.zip file
     . Unzip the file
     . copy the JCalendarJinit.jar and jcalendar.jar files in the <ORACLE_HOME>/forms/java directory
     . Edit your /forms/server/formsweb.cfg file to add these 2 JAR files

     . The Implementation Class property must be : oracle.forms.fd.JCalendarJinit

par Oracle Forms community publié dans : Bean - general
ajouter un commentaire commentaires (5)    recommander
Jeudi 20 décembre 2007

Purpose

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

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

In its third version, it does not need any JDBC connexion to handle images from/to the database
.

It uses the JRE 1.4 javax.imageio.ImageIO package, so it needs, at least the Sun Java plugin 1.4.
It won't run against JInitiator.



handleimage3



The Java code

     handleimage3.java      GetImageFileName.java



The implementation class of the Bean Item

     oracle.forms.fd.HandleImage


The methods you can call




Read an image from a file

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

e.g.:
-- read image from the file system --
Set_Custom_Property( 'BLZ.BEAN', 1, 'READIMGFILE', 'D:/image.jpg' ) ;
 

-- read image from the JAR file --
Set_Custom_Property( 'BLZ.BEAN', 1, 'READIMGFILE', '/image.jpg' ) ;

-- read image from the Internet --
Set_Custom_Property( 'BLZ.BEAN', 1, 'READIMGFILE', 'http://the_url/image.jpg' ) ;