Bean - general

Mardi 7 février 2006 2 07 /02 /2006 10:27
Purpose

This is a Javabean component that allows to replace the internal Oracle Forms’ timer


Bean Timer

The java code


package oracle.forms.demo;

import oracle.forms.handler.IHandler;
import oracle.forms.ui.CustomEvent;
import oracle.forms.properties.ID;
import oracle.forms.ui.VBean;

import oracle.forms.engine.Main;
import oracle.forms.engine.*;
import oracle.forms.handler.*;

public class Timer extends VBean implements Runnable
{
    static Thread runner ;
    static int seconds = 0 ;
    static IHandler mHandler;
    protected static final ID TIMEREXPIRED   = ID.registerProperty("TimerExpired");
    protected static final ID pInitTimer     = ID.registerProperty("initTimer");
    protected static final ID pStartTimer    = ID.registerProperty("Start");
    protected static final ID pStopTimer     = ID.registerProperty("Stop");

    public Timer()
    {
      super();
    }

    public void init(IHandler handler)
    {
      super.init(handler);
      mHandler = handler;
      System.out.println("*** oracle.forms.demo.Timer Init ***") ;
    }     

    private void startTimer()
    {
      if (runner == null )
      {
        runner = new Thread(this);
        runner.start();
      }
    }
   
    private static void stopTimer()
    {
      if (runner != null )
      {
        runner = null;
      }
    }   

    public void run()
    {
      Thread theThread = Thread.currentThread();
      while (runner == theThread)
      {
        try{
        Thread.sleep(seconds);
        } catch (InterruptedException e) { }
        dispatch_event() ;
      }
    }   
   
    public boolean setProperty(ID _ID, Object _args)
    {
     if(_ID==pInitTimer)
     {
       System.out.println("milliseconds=" + (String)_args) ;      
       seconds = new Integer((String)_args).intValue() ;
       return true;      
      }

     else if (_ID == pStartTimer)
     {
        System.out.println("Start") ;      
        startTimer() ;
        return true;
     }

     else if (_ID == pStopTimer)
      {
        stopTimer() ;
        return true;
      }    
     else
        {
          return true;
        }     
    }

    public void dispatch_event()
    {
        CustomEvent ce = new CustomEvent(mHandler, TIMEREXPIRED);
        dispatchCustomEvent(ce);
    }
}


Forms configuration
  • . Copy the bean_timer.jar file in the /forms/java directory
  • . Edit the /forms/server/formsweb.cfg file to add the jar file to the archive_jini variable

archive_jini=
f90all_jinit.jar,……,bean_timer.jar


Implementation Class property

    oracle.forms.demo.Timer



Properties that can be set

The frequency of expiration

set_custom_property( 'BLOC3.BEAN_ITEM', 1, 'initTimer', 'number_of_milliseconds');


Start the timer

set_custom_property( 'BLOCK.BEAN', 1, 'Start', '');


Stop the timer


set_custom_property( 'BLOCK.BEAN', 1, 'Stop', '');


The sample dialog

  • . Download the beantimer.zip file
  • . Unzip the beantimer.zip file
  • . Copy the beantimer.jar file in your /forms/java/ directory
  • . Edit your /forms/server/formsweb.cfg file
  • . Open the bean_timer.fmb module (Oracle Forms 9.0.2)
  • . Compile all and run the module

This dialog allows to enter the frequency of the timer, start (showing the time in real-time) and stop the timer. 
The code that captures the java event is located in the WHEN-CUSTOM-ITEM-EVENT trigger of the bean item.



When-Custom-Item-Event
:BLOCK2.HEURE := SYSDATE ;
Synchronize ;

Par Oracle Forms community - Publié dans : Bean - general
Ecrire un commentaire - Voir les 1 commentaires - Recommander
Jeudi 9 février 2006 4 09 /02 /2006 15:54

Purpose

This is a Javabean component that displays a JTable inside/outside of a Forms module.
It allows saving the data modified through the JTable into the database.



JTable inside

JTable inside




The java code


FJTable.java


Forms configuration

  • . Copy the fjtable.jar file in the /forms/java directory
  • . Edit the /forms/server/formsweb.cfg file to add the jar file to the archive_jini variable

archive_jini=
f90all_jinit.jar,……,fjtable.jar


Implementation Class property

    oracle.forms.fd.FJTable



Properties you can set


The horitontal/vertical lines

Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_HORIZONTAL_LINE', 'true|false' ) ;
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_VERTICAL_LINE', 'true|false' ) ;


The data separator's character

Set_Custom_Property( 'BL1.JTABLE', 1, 'SETSEPARATOR', 'char_separator' ) ;

e.g.
Set_Custom_Property( 'BL1.JTABLE', 1, 'SETSEPARATOR', '^' ) ;


The table frame bounds (for seperate frame)

set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SETBOUNDS', 'x,y,w,h');


The header colors

set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SETHEADBG', 'rgb color');
set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SETHEADFG', 'rgb color');

e.g.
set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SETHEADFG', '255,0,128');


The selected area colors

set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SET_SELECTION_BACKGROUND', 'rgb color');
set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SET_SELECTION_FOREGROUND', 'rgb color');

e.g.
set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SET_SELECTION_BACKGROUND', '255,0,128');

 

The number of columns/rows of the table

Set_Custom_Property( 'BL1.JTABLE', 1, 'SETARRAYSIZE', 'cols,rows' ) ;

This method must be used first, before defining header, datas, format, etc.


The columns header

set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SETHEADER', 'col1[^coln]');

 

e.g.
set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SETHEADER', 'EmpNO^Ename^DeptID);



Set the data

set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SETDATA', 'data1[^datan]');

To seperate the data, use the separator indicated in the SETSEPARATOR() method.

 

e.g.
set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SETDATA', '1^Hello there^2000);


Set the relative cell value

set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SET_CELL_VALUE', '-sep-Row-sep-Cell-sep-data[-sep-set_focus]');

-sep- is the separator character used in the method. It must be indicated at the very first character, then after, used in the string to seperate the values.
Row is the row number (starts with 1)
Cell is the cell number (starts with 1)
set_focus (not required) set the focus to the cell if true 

e.g.
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_CELL_VALUE', '^1^3^new data' ) ;
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_CELL_VALUE', '|1|3|new data' ) ;
-- set the cell value then move the focus to this cell --
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_CELL_VALUE', '^1^3^new data^true' ) ;


Set the current cell Value

set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SET_CURRENT_CELL_VALUE', 'data');

It uses the current selected cell.

e.g.
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_CURRENT_CELL_VALUE', 'new data' ) ;


The table title (for seperate frame)

set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SETTITLE', 'the_title');

 

The default date format (java format)

Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_DATE_FORMAT', 'format' ) ;

e.g.
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_DATE_FORMAT', 'dd/MM/yyyy' ) ;

You must use a Java format compatible with the PL/SQL one to avoid insertion/update error at commit time.
Here is a When-New-Form-Instance code sample used for this purpose:

 -- Java format masks --
 :GLOBAL.LC$DJavaFormat := 'dd/MM/yyyy' ; // date format
 :GLOBAL.LC$NJavaFormat := '#0.00' ;      // numeric format
 :GLOBAL.LC$IJavaFormat := '##########' ; // integer format
 -- PL/SQL format masks --
 :GLOBAL.LC$DPLSFormat  := 'dd/mm/yyyy' ;
 :GLOBAL.LC$NPLSFormat  := '999,990.00' ;
 :GLOBAL.LC$NUMSEPARATORS := '.,' ;   

  set_application_property(PLSQL_DATE_FORMAT, :GLOBAL.LC$DPLSFormat);
  set_application_property(BUILTIN_DATE_FORMAT, :GLOBAL.LC$DPLSFormat);
  forms_ddl('ALTER SESSION SET NLS_DATE_FORMAT = '''|| :GLOBAL.LC$DPLSFormat || '''');
  forms_ddl('ALTER SESSION SET NLS_NUMERIC_CHARACTERS = '''|| :GLOBAL.LC$NUMSEPARATORS || '''');
  Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_DECIMAL_SEPARATORS', :GLOBAL.LC$NUMSEPARATORS ) ;
  Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_DATE_FORMAT', :GLOBAL.LC$DJavaFormat ) ;


The default number format (java format)

Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_NUM_FORMAT', 'format' ) ;

e.g.
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_NUM_FORMAT', '###,##0.00' ) ;


The numeric separators

Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_DECIMAL_SEPARATORS', 'decimal_character,group_character' ) ;

e.g.
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_DECIMAL_SEPARATORS', '.,' ) ;

 

The column types

Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_COLS_TYPE', 'type[,type[,...]]' ) ;

each column can have a type description, CHAR, INTEGER, NUMBER, IMAGE or DATE
If this method is not used, the default type is CHAR for every column.

e.g.
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_COLS_TYPE', 'CHAR^INTEGER^CHAR^CHAR^DATE^NUMBER' ) ;

 

The column moving property

Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_REORDER_COLUMNS', 'true|false' ) ;


e.g.
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_REORDER_COLUMNS', 'false' ) ;

 

The column resizing property

Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_RESIZE_COLUMNS', 'true|false' ) ;


e.g.
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_RESIZE_COLUMNS', 'false' ) ;

 

The row height

Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_ROW_PROPERTY', 'HEIGHT|new_size' ) ;


e.g.
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_ROW_PROPERTY', 'HEIGHT|40' ) ;

 

The cell property

Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_CELL_PROPERTY', 'column_name|property_set' ) ;

note : the columns must have been defined by the SETHEADER method, before you can use the SET_CELL_PROPERTY method.

property_set could be one of the following:

  • ENABLE : true or false
  • FORMAT : format mask (Java syntax)
  • ALIGNMENT : LEFT or CENTER or RIGHT
  • FONT : font_name | font_size | font_wheight (N, B, I, BI)
  • BG_COLOR : red_value,green_value,blue_value
  • FG_COLOR : red_value,green_value,blue_value
  • WIDTH : width_in_pixel
  • MIN_WIDTH : minimum width allowed for the column
  • MAX_WIDTH : maximum width allowed for the column
  • RESIZE : true or false
  • TITLE : new_title

Because you can have commas in the property value (in number format for instance), the separator character is | (alt-124) for this method.

e.g.
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_CELL_PROPERTY', 'MGR|ENABLE|false' ) ;
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_CELL_PROPERTY', 'SAL|FORMAT|0,000,000.00' ) ;
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_CELL_PROPERTY', 'HIREDATE|ALIGNMENT|CENTER' ) ;
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_CELL_PROPERTY', 'EMPNO|FONT|Tahoma|14|B' ) ;
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_CELL_PROPERTY', 'HIREDATE|BG_COLOR|230,230,255' ) ;
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_CELL_PROPERTY', 'EMPNO|WIDTH|50' ) ;
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_CELL_PROPERTY', 'EMPNO|MIN_WIDTH|40' ) ;
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_CELL_PROPERTY', 'EMPNO|MAX_WIDTH|100' ) ;
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_CELL_PROPERTY', 'EMPNO|TITLE|New title' ) ;
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_CELL_PROPERTY', 'EMPNO|RESIZE|false' )


The data colors

-- background color --
Set_Custom_Property( 'BL1.JTABLE', 1, 'SETDATABG', '255,255,255' ) ;
-- foreground color --
Set_Custom_Property( 'BL1.JTABLE', 1, 'SETDATAFG', '0,0,0' ) ;


The image size

Use this method to scale the images retrieved from the database.
This method has to be used before the data are fetched, so before using the Set_Data() method.

-- Image width 200 pixel and keep height aspect ratio --
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_IMAGE_SIZE', '200,-1' ) ;
-- prepare column width for images -- 
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_ROW_PROPERTY', 'HEIGHT|80' ) ;
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_CELL_PROPERTY', 'PHOTO|WIDTH|200' ) ;


Send an image to the Java Bean (JTable)

Use this method to send the content of a Blob database column, supposed to store an image.
The process is split into 3 phases:

  • prepare the Java Bean to process the image by giving its JTable coordinates (Row,Cell)
  • send the chunks of data to the Bean
  • stop the sending process

---------------------
--  send an image  --
---------------------

-- prepare the SQL order to select the required database row --
LC$Query := 'Select PHOTO From IMAGES Where PK=12';
-- query the database --
If Pkg_Read_Blob_Image.Select_Blob(LC$Query) Then
   -- set the JTable image index --
   -- e.g. Row 1, Cell 2         --
   Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_IMAGE', '[INDEX_IMAGE],1,2) ;
   Loop
      -- get image chunk from the Blob column --
      LC$Image := Pkg_Read_Blob_Image.Get_B64_Chunk ;
      If LC$Image Is Not Null Then
         -- send chunk to the Java Bean --
         Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_IMAGE', LC$Image ) ;
      Else
         -- stop the sending process --
         Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_IMAGE', '[END_IMAGE]' ) ;
         Exit ;
      End if ;
   End loop ;
End if ;
       

Needs the PKG_READ_BLOB_IMAGE given package compiled under the corresponding Oracle user.

- The Blob column is selected with the Select_Blob() package's function (the given SELECT order must retrieve one and only one row).
- The chunks of data are read from the Blob column with the Get_B64_Chunk() package's function.


The grid color

set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SETGRIDFG', '120,120,40');


The table updatable flag

set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SETUPDATE', 'true|false');


Init (reset all values)

set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'INIT', '');


Set the cell coordinate we want to get the value

set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SETCELLPOS', 'row,cell');

row and cell start with 1.


Set the row coordinate we want to get the values

set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SETROWPOS', 'row');

row starts with 1.


Show the table

set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SHOW', 'seperate_flag');

seperate_flag can be true or false

 



Properties that can be read

Get a particular cell value (located by the SETCELLPOS property)

varchar2 := get_custom_property( 'BLOCK.BEAN_ITEM', 1, 'GETCELLVAL');


Get a particular row values (located by the SETROWPOS property)

varchar2 := get_custom_property( 'BLOCK.BEAN_ITEM', 1, 'GETROWVAL');


Get the list of changed rows

varchar2 := get_custom_property( 'BLOCK.BEAN_ITEM', 1, 'GET_ROWS_CHANGED');

This list is comma delimited. you can get the tokens by using the provided Forms' PKG_TABLE.Split() function.


Events raised

A cell has been updated : POST_CHANGE
A row has been selected : NEW_RECORD_INSTANCE
A cell has been selected : NEW_ITEM_INSTANCE
Mouse clicked : WHEN-MOUSE-CLICK
Mouse doubleclicked : WHEN-MOUSE-DOUBLECLICK

You can know what cell has been edited through the TABLE_EVENT_MSG parameter:

When-Custom-Item-Event:

DECLARE
   
    eventName varchar2(30) := :system.custom_item_event;
    eventValues ParamList;
    eventValueType number;
    LC$Value  varchar2(256);
   
BEGIN
   
   IF (eventName='POST_CHANGE') THEN
      eventValues := get_parameter_list(:system.custom_item_event_parameters);
      get_parameter_attr(eventValues,'TABLE_EVENT_MSG',eventValueType, LC$Value);
      Clear_Message;
      Message('POST-CHANGE:'|| LC$Value);
      Synchronize ;           
   ElsIf (eventName='NEW_RECORD_INSTANCE') THEN
      eventValues := get_parameter_list(:system.custom_item_event_parameters);
      get_parameter_attr(eventValues,'TABLE_EVENT_MSG',eventValueType, LC$Value);
      :GLOBAL.CURRENT_ROW := LC$Value ;
      Clear_Message;
      Message('When-New-Record-Instance:'|| LC$Value);
      Synchronize ;
   ElsIf (eventName='NEW_ITEM_INSTANCE') THEN
      eventValues := get_parameter_list(:system.custom_item_event_parameters);
      get_parameter_attr(eventValues,'TABLE_EVENT_MSG',eventValueType, LC$Value);
      :GLOBAL.CURRENT_CELL := LC$Value ;
      Clear_Message;
      Message('When-New-Item-Instance:'|| LC$Value);
      Synchronize ;
   End if ;  
   If (eventName='WHEN-MOUSE-DOUBLECLICK') THEN
      eventValues := get_parameter_list(:system.custom_item_event_parameters);
      get_parameter_attr(eventValues,'TABLE_EVENT_MSG',eventValueType, LC$Value);
      Clear_Message;
      Message('When-Mouse-DoubleClick:'|| LC$Value);
      Synchronize ;                 
   ElsIf (eventName='WHEN-MOUSE-CLICK') THEN
      eventValues := get_parameter_list(:system.custom_item_event_parameters);
      get_parameter_attr(eventValues,'TABLE_EVENT_MSG',eventValueType, LC$Value);
      Clear_Message;
      Message('When-Mouse-Clicked:'|| LC$Value);
      Synchronize ;                 
   END IF;

   
END;


The sample dialog

  • Download the JTable.zip file
  • Unzip the JTable.zip file
  • Compile both PKG_READ_BLOB_IMAGE.pks and PKG_READ_BLOB_IMAGE.pkb scripts in the database
  • Copy the fjtable.jar file in your /forms/java/ directory (the JAR file must be signed)
  • Edit your /forms/server/formsweb.cfg file
  • Open the JTABLE.fmb module (Oracle Forms 9.0.2)
  • Compile all and run the module

_bug_fck
Par Oracle Forms community - Publié dans : Bean - general
Ecrire un commentaire - Voir les commentaires - Recommander
Mardi 14 février 2006 2 14 /02 /2006 18:02

Purpose

Here is a Java Bean component to read the Forms applet parameters

Applet Properties


The java code

Get the source code here


Forms configuration

Copy the appletproperties.jar file in the /forms/java directory
Edit the /forms/server/formsweb.cfg file to add the jar file to the archive_jini variable

archive_jini=f90all_jinit.jar,……,appletproperties.jar



Implementation Class property

     oracle.forms.fd.AppletProperties


Properties you can set

The parameter you want to read

Set_Custom_Property( 'BLOCK.BEAN_AREA', 1, 'SET_PARAM', 'param_name' ) ;
e.g.
Set_Custom_Property( 'BL.BEAN', 1, 'SET_PARAM', 'colorScheme' ) ;


Properties you can read

Get all the properties in a string

Varchar2 := Get_Custom_Property( 'BLOCK.BEAN_AREA', 1, 'GET_INFOS' ) ;

Get a particular property

Varchar2 := Get_Custom_Property( 'BL.BEAN', 1, 'GET_PARAM' ) ;
(assume that you have just set this property before with the SET_PARAM ID.)


The sample dialog

     . Download the appletproperties.zip file
     . Unzip the file
     . Edit your /forms/server/formsweb.cfg file
     . Open the APPLETPROPERTIES.fmb module (Oracle Forms 9.0.2)
     . Compile all and run the module






Par Oracle Forms community - Publié dans : Bean - general
Ecrire un commentaire - Voir les commentaires - Recommander
Mercredi 15 février 2006 3 15 /02 /2006 21:52
Purpose

Here is a (very) simple HTML browser.



This JavaBean component allows to browse some simple HTML pages inside the Oracle Forms frame.
It may be a good way to browse into local documents, like documentation html pages.

You can click on the hyperlinks to navigate through the content.



The Java code

Get the source code here


Forms configuration

     . Copy the htmlbrowser.jar file in the /forms/java directory
        This .jar file must be signed
     . Edit the /forms/server/formsweb.cfg file to add the jar file to the archive_jini variable

         archive_jini=f90all_jinit.jar,……,htmlbrowser.jar



Implementation Class property

     oracle.forms.fd.HtmlFrame


The properties you can set

The url to display

Set_Custom_Property( 'BLOCK.BEAN_AREA', 1, 'SETURL', 'new_url' ) ;

The HTML content to display

Set_Custom_Property( 'BLOCK.BEAN_AREA', 1, 'SETCONTENT', 'html_content' ) ;

Where html_content must be valid HTML source like : '<html><body><b>Hello there</b></body></html>'


The sample dialog

     . Download the htmlbrowser.zip file
     . Unzip the file
     . Edit your /forms/server/formsweb.cfg file
     . Open the HTML_BROWSER.fmb module (Oracle Forms 9.0.2)
     . Compile all and run the module




Par Oracle Forms community - Publié dans : Bean - general
Ecrire un commentaire - Voir les 5 commentaires - Recommander
Lundi 20 février 2006 1 20 /02 /2006 10:38
Purpose

This is a Java Bean that allows to add buttons on the current Forms canvas at runtime.

Add GUI component at runtime


The Java code

Get the source code here


Forms configuration

. Copy the additem.jar file in the /forms/java directory
. Edit the /forms/server/formsweb.cfg file to add the jar file to the archive_jini variable

         archive_jini=f90all_jinit.jar,……,additem.jar



Implementation Class property

     oracle.forms.fd.AddItem


The properties you can set

Add a button

Set_Custom_Property( 'BLOCK.BEAN_ITEM', 1, 'ADD_BUTTON', 'button_settings' ) ;

Where button_settings is :

num_button, label, action_name, pos X, pos Y, Width, Height


e.g.
Set_Custom_Property( 'BL.BEAN', 1, 'ADD_BUTTON', '1,Button 1, BT1,10,10,100,20' ) ;

Note : Notice that the Java coordinates are allways in pixels. So be careful if your form module coordinate system is set to a different setting (Points, Centimeters of Inch for example)

Set the Font

Set_Custom_Property( 'BLOCK.BEAN_ITEM', 1, 'SET_FONT', 'font_name,size' ) ;

e.g.
Set_Custom_Property( 'BL.BEAN', 1, 'SET_FONT', 'Arial,10' ) ;


Set the background and foreground colors

Set_Custom_Property( 'BLOCK.BEAN_ITEM', 1, 'SET_FG_COLOR', 'r,g,b' ) ;
Set_Custom_Property( 'BLOCK.BEAN_ITEM', 1, 'SET_BG_COLOR', 'r,g,b' ) ;


The properties you can get

Get the last pressed button's action name

Varchar2 := Get_Custom_Property( 'BLOCK.BEAN_AREA', 1, 'GET_BT_PRESSED' ) ;


The events you can raise to Forms

A button have been pressed

       BUTTONPRESSED


The sample dialog

     . Download the additem.zip file
     . Unzip the file
     . Edit your /forms/server/formsweb.cfg file
     . Open the ADD_ITEM1.fmb module (Oracle Forms 9.0.2)
     . Compile all and run the module



Par Oracle Forms community - Publié dans : Bean - general
Ecrire un commentaire - Voir les commentaires - Recommander
Dimanche 26 février 2006 7 26 /02 /2006 21:42

Purpose

This is the second part of the chapter on "how to create component at runtime".
In this chapter, let's see how to create some titled-framed text items


AddItem part II
Click here to get the full format image

On the Forms module displayed on this screenshot, all the components of the left panel are created at runtime.
The right panel allows to change the properties of each selected component.


The Java code

Get the full source code here


Implementation Class property

      oracle.forms.fd.AddItem2


Forms configuration

. Copy the additem2.jar file in the /forms/java directory
. Edit the /forms/server/formsweb.cfg file to add the jar file to the archive_jini variable

         archive_jini=f90all_jinit.jar,……,additem2.jar


The properties

Get the properties list here


The sample dialog

     . Download the additem2.zip file
     . Unzip the file
     . Edit your /forms/server/formsweb.cfg file
     . Open the FRAMEDTEXT.fmb module (Oracle Forms 9.0.2 and 10.1.2)
     . Compile all and run the module

Par Oracle Forms community - Publié dans : Bean - general
Ecrire un commentaire - Voir les commentaires - Recommander
Vendredi 3 mars 2006 5 03 /03 /2006 18:31

Purpose

Sometimes I find questions on forums on how to handle frames at runtime.
Of course, at this moment (10gR2), there is no built-in available.
This is a workaround that allows to create and handle frames at runtime.

Frame


The Java code

Get the full source code here

Implementation Class property

     oracle.forms.fd.frame

Note : The frame is not displayed inside the Forms JavaBean component, so you can set its Mouse and Keyboard navigation properties to NO.

The properties you can set

(properties with bold font are required.)

Create a new frame


Set_Custom_Property( 'BLK.BEAN', 1, 'INIT_FRAME', 'v1,...,vn' ) ;

type : line or lowered
line width : width of the line in pixels
title
font name
font size
weight :
     . N ormal
     . I talic
     . B old
     . BI bold + italic
Alignment:
     . left
     . center
     . right

The font of the title frame

Set_Custom_Property( 'BLK.BEAN', 1, 'SET_FONT', 'name[,size[,weight[,alignment]]]' ) ;

font name
font size
weight :
     . N ormal
     . I talic
     . B old
     . BI bold + italic
Alignment:
     . left
     . center
     . right


The frame title color

Set_Custom_Property( 'BLK.BEAN', 1, 'SET_FRAME_TITLE_COLOR', 'r,g,b' ) ;

The frame background color

Set_Custom_Property( 'BLK.BEAN', 1, 'SET_BACKGROUND', 'r,g,b' ) ;

The frame bounds

Set_Custom_Property( 'BLK.BEAN', 1, 'SET_BOUNDS', 'x,y,w,h' ) ;

x : x position in pixel on the canvas
y : y position in pixel on the canvas
w : width in pixel
h : height in pixel

Set the title

Set_Custom_Property( 'BLK.BEAN', 1, 'SET_TEXT', 'title[,alignment]' ) ;

title
alignment :
     . left
     . center
     . right


Hide the frame

Set_Custom_Property( 'BLK.BEAN', 1, 'HIDE', '' ) ;


Show the frame

Set_Custom_Property( 'BLK.BEAN', 1, 'SHOW', '' ) ;



The sample dialog

     . Download the frame.zip file
     . Unzip the file
     . copy the frame.jar file 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
Ecrire un commentaire - Voir les 1 commentaires - Recommander
Mardi 7 mars 2006 2 07 /03 /2006 17:03
Purpose

This is a JavaBean that allows to play sound files from the file system.

Sound JavaBean


The Java code

sound.java    soundlist.java      soundloader.java

note : the jar file must be signed


Implementation Class property

      oracle.forms.fd.Sound


The properties you can set

Set the file name to read

Set_Custom_Property( 'BLK.BEAN', 1, 'SET_FILE', 'directory,filename' ) ;


Play the sound

Set_Custom_Property( 'BLK.BEAN', 1, 'PLAY', '' ) ;


The sample dialog

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


Par Oracle Forms community - Publié dans : Bean - general
Ecrire un commentaire - Voir les commentaires - Recommander
Lundi 20 mars 2006 1 20 /03 /2006 10:18

Purpose

This JavaBean allows to find and handle the form windows (current window and MDI window).
With this handle, you can set some particular properties like the following:

   . setMovable()*
   . setClosable()*
   . setMaximizable()*
   . setMinimizable()*
   . setModal()*
   . setResizable()
   . setVisible()
   . enable()*
   . disable()*
   . setToolTipValue()*
   . setIcon()
   . setExtendedState() (only with SE 4.0)
   . setAlwaysOnTop() (only with SE 5.0)

    * You cannot apply this function on the MDI frame.

FormsFrames

How to find the frames ?

You can recursively find the different layers with the getParent() function.

      Container container = this.getParent();
      while (container!=null)
      {
        // output the object hierarchy
        System.out.println("--> "+container.getName()+" ["+container.getClass()+"]") ;
        container = container.getParent() ;
      }

The FORMSFRAMES.fmb sample module shows, in the Java console, the list of all the layers.


The application Forms window class name is oracle.forms.ui.ExtendedFrame      
The application Forms MDI window class name is oracle.ewt.swing.JBufferedFrame

Notice that in future version, this class names may change.



The Java code

     formsframe.java

     The JAR file must be signed

The properties you can set

set the frame structure info
Set_Custom_Property('BL.BEAN',1, 'INFO','' ) ;

movable()
Set_Custom_Property( 'BL.BEAN', 1, 'SET', 'MOVE,true|false' ) ;

closable()
Set_Custom_Property( 'BL.BEAN', 1, 'SET', 'CLOSE,true|false' ) ;

maximizable()
Set_Custom_Property( 'BL.BEAN', 1, 'SET', 'MAX,true|false' ) ;

minimizable()
Set_Custom_Property( 'BL.BEAN', 1, 'SET', 'MIN,true|false' ) ;

resizable()
Set_Custom_Property( 'BL.BEAN', 1, 'SET', 'SIZE,true|false' ) ;

disable()
Set_Custom_Property( 'BL.BEAN', 1, 'SET','DISABLE' ) ;  

set icon for standar or MDI frame
Set_Custom_Property( 'BL.BEAN', 1, 'SETICON','target,icon_name' ) ;

    -- Set the MDI icon --
  Set_Custom_Property('BL.BEAN',1, 'SETICON','MDI,/indxicon.gif' ) ;
  
  -- Set the internal window icon --
  Set_Custom_Property('BL.BEAN',1, 'SETICON','WIN,/oracle.gif' ) ;



maximize the MDI frame (works only with the Sun Java Plug-in JRE 1.4)
Set_Custom_Property( 'BL.BEAN', 1, 'SETMAXSIZE','true|false' ) ;

Set the window always on top (works only with the Sun Java Plug-in JRE 1.5)
Set_Custom_Property( 'BL.BEAN', 1, 'SETONTOP','true|false' ) ;

(if you want to use this property, use the formsframes5.jar file instead of the formsframes.jar)


In this demo, 2 icon files are stored in the root of the jar file (indxicon.gif and oracle.gif)


The sample dialog

     . Download the formsframes.zip file
     . Unzip the file
     . copy the formsframes.jar file in the <ORACLE_HOME>/forms/java directory
       (or the formsframes5.jar if you use the 1.5 JRE)
         the jar file must be signed
     . Edit your /forms/server/formsweb.cfg file
     . Open the FORMSFRAMES.fmb module (Oracle Forms 9.0.2)
     . Compile all and run the module

     Open the Java console to see the whole frame structure of the Forms module

Par Oracle Forms community - Publié dans : Bean - general
Ecrire un commentaire - Voir les commentaires - Recommander
Mardi 28 mars 2006 2 28 /03 /2006 10:00

Purpose

Let's have a little bit fun and break the wall with this Oracle Forms JavaBean.

The purpose of this research&development unit is only to show that the VBean class allows to do anything in an Oracle Forms application.
You are able to build a complete interface with different frames, panels, menus and actions like reading/writing files.


WallBrick Player

WallBrick Builder

This wallbrick is as simple as I am not a game expert and is probably the worst example of this kind of game you could find anywhere.
But this one allows you to create/modify your own levels.
So, the JAR file contains 2 main classes, one for building the wall (FJBuild.java) and one to play (FJBrick.java).



The java code

      get here the complete Java source code


The Implementation class properties

for the builder:
      oracle.forms.fd.FJBuild

for the player:
      oracle.forms.fd.FJBrick


The properties you can set

Set the log ON/OFF

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

Start a new game/builder

Set_Custom_Property('BL.BEAN', 1, 'START', '[configuration file's directory]' ) ;

configuration file's directory is not required. It can be used to indicate in which directory the configuration file will be created/stored.
If no indication, the configuration file is read/stored in the default user directory.

If you want to store the configuration file in the C:TEMP directory, use the following:

Set_Custom_Property('BL.BEAN', 1, 'START', 'C:TEMP' ) ;


The sample dialog

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

        WALLBRICK.fmb


Par Oracle Forms community - Publié dans : Bean - general
Ecrire un commentaire - Voir les commentaires - Recommander
Créer un blog sur over-blog.com - Contact - C.G.U. - Rémunération en droits d'auteur - Signaler un abus - Articles les plus commentés