Overblog Suivre ce blog
Editer l'article Administration Créer mon blog
7 février 2006 2 07 /02 /février /2006 10:27


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()

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

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

    public void run()
      Thread theThread = Thread.currentThread();
      while (runner == theThread)
        } catch (InterruptedException e) { }
        dispatch_event() ;
    public boolean setProperty(ID _ID, Object _args)
       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;
          return true;

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

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


Implementation Class property


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.

Synchronize ;

Partager cet article

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


sumaira 03/01/2017 06:23

hello i made a log in form when i xecute it display user name and i want that a user cannot execute a query...

inma ferrandiz 03/11/2006 13:22

Hello, we are migrating from 6i to 10g. In 6i we use mscomm32.ocx to get information from serial port. Now, in 10g we have to access to port means a java bean. ¿do you have any sample java bean that  can help to us?
Thanks in advance.

Oracle Forms community 03/11/2006 16:22

Inma,This question has nothing in relation with this Bean.You can use the email box to ask general questions (forms.pjc.bean@free.fr)At this moment this site does not have any Java Bean that deal with the serial port.Sun has provided the Java Communications API  you can download here : http://java.sun.com/products/javacomm/Regards,Francois