Wednesday, 17 February 2010

Implement Forms look and feel


First download the zip file from this site on Sources&doc.
Depending of the Forms version you use, copy the corresponding JAR file to  your /forms/java folder.
You also have to add the JAR file name to the archive tag of your /forms/server/formsweb.cfg configuration file.
...
archive=frmall.jar,laf_1012.jar
...

note:
We update the archive tag and not the archive_jini because this tool uses methods available in the 1.4 JRE, so it won't run with the Jinitiator.


Copy the forms.css file on your server, there is a parameter in forms PM$CSS_FILENAME where you specify where the css file is.

To implement in existing forms use LAF_JDAPI tool.
 
To implement in new modules you must use the template form:

In the /fmb folder of the zip file, you would find a template named LAF_TEMPLATE.fmb.
While you are building a brand new module from scratch, it is best to create the new module from this template, by using the File → New → Forms using template... Forms Builder menu option.
Every component needed to use the LAF features will be incorporated.

The /css sub-folder contains the current forms.css template CSS file.

There are several places you can indicate the location of this file.
The PM$CSS_FILENAME Forms parameter is one of them.
If you create a new module from the LAF_TEMPLATE.fmb file or if you use the GRP_LAF laf.olb Object Library group, it would be present in your module.
You can also indicate the full path directly in the
PKG_Look_And_Feel.Open_Css() laf.pll's function.

The /pll folder that contains the laf.pll PL/SQL library.
It is required to attach this library to your Forms modules, if you want to use the CSS feature like painting the canvas or the blocks.

The /scripts folder contains some scripts to maintain the Database
objects:
PKG_LAF.sql
PKG_DB_LAF_LOV.sql
 
Example of plsql code of when-timer-expired form trigger:

Begin   

  If lower(Get_Application_Property( TIMER_NAME )) = 'laf_timer' Then
    Set_Custom_Property('LAF_BLOCK.LAF_BEAN',1,'CLEAR', '' );
      -------------------------------------
      --    form main initializations    --
      -------------------------------------
     ---------------------------------------------------------------------------
   -- global settings
   -- that could be read from the CSS file
   -- in a section of type : gui
   --
   Set_Custom_Property( 'LAF_BLOCK.LAF_BEAN', 1, 'SET_SCHEME', 'blue' ) ;
   --Set_Custom_Property( 'LAF_BLOCK.LAF_BEAN', 1, 'SET_FOCUS_BACKGROUND', 'true' ) ;
   --Set_Custom_Property( 'LAF_BLOCK.LAF_BEAN', 1, 'SET_APPLY_SCHEME', 'frame,true' ) ;
   --Set_Custom_Property( 'LAF_BLOCK.LAF_BEAN', 1, 'SET_APPLY_SCHEME', 'menu,true' ) ;
   --Set_Custom_Property( 'LAF_BLOCK.LAF_BEAN', 1, 'SET_APPLY_SCHEME', 'window,true' ) ;
   --Set_Custom_Property( 'LAF_BLOCK.LAF_BEAN', 1, 'SET_APPLY_SCHEME', 'status,true' ) ;
   -- apply those changes --
   --Set_Custom_Property( 'LAF_BLOCK.LAF_BEAN', 1, 'DRAW_GUI_ELEMENTS', '' ) ;
   ---------------------------------------------------------------------------
   -- draw the frames --
   Set_Custom_Property('LAF_BLOCK.LAF_BEAN',1,'SET_FRAME','F1,1,Buscar solicitudes,Arial,12,B,top,left') ;
   Set_Custom_Property('LAF_BLOCK.LAF_BEAN',1,'SET_FRAME_BOUNDS','F1,15,12,620,57');
   Set_Custom_Property('LAF_BLOCK.LAF_BEAN',1,'SET_FRAME_ROUND_BORDER','F1,true') ;
   Set_Custom_Property('LAF_BLOCK.LAF_BEAN',1,'SET_FRAME_BACKGROUND','F1,r255g255b255,r60g138b255') ;


  Set_Custom_Property('LAF_BLOCK.LAF_BEAN',1,'SET_FRAME','F2,1,Solicitudes,Arial,12,B,top,left') ;
  Set_Custom_Property('LAF_BLOCK.LAF_BEAN',1,'SET_FRAME_BOUNDS','F2,15,80,940,170');
  Set_Custom_Property('LAF_BLOCK.LAF_BEAN',1,'SET_FRAME_ROUND_BORDER','F2,true') ;
  Set_Custom_Property('LAF_BLOCK.LAF_BEAN',1,'SET_FRAME_BACKGROUND','F2,r255g255b255,r60g138b255') ;
 
  Set_Custom_Property('LAF_BLOCK.LAF_BEAN',1,'SET_FRAME','F3,1,Seguimiento de la Solicitud,Arial,12,B,top,left') ;
  Set_Custom_Property('LAF_BLOCK.LAF_BEAN',1,'SET_FRAME_BOUNDS','F3,160,260,590,190');
  Set_Custom_Property('LAF_BLOCK.LAF_BEAN',1,'SET_FRAME_ROUND_BORDER','F3,true') ;
  Set_Custom_Property('LAF_BLOCK.LAF_BEAN',1,'SET_FRAME_BACKGROUND','F3,r255g255b255,r60g138b255') ;
 
 
 
      If PKG_Look_And_Feel.Open_Css(:PARAMETER.PM$CSS_FILENAME) Then
   
        -- read the global GUI properties --
        PKG_LOOK_AND_FEEL.Set_GUI_Properties( '.GUIPropertiesBlue', 'LAF_BLOCK.LAF_BEAN' ) ;
     
        -- paint the canevases --
        PKG_LOOK_AND_FEEL.Paint_Canevas(:PARAMETER.PM$CANVAS, 'LAF_BLOCK.LAF_BEAN' ) ;
   
        /**/
        -- paint the blocks --
        PKG_LOOK_AND_FEEL.Paint_Block
        (
          PC$Block      => 'B1'
         ,PC$BeanName   => 'LAF_BLOCK.LAF_BEAN'
         ,PC$VA_Name    => :PARAMETER.PM$VA
         ,PC$HeadClass  => :PARAMETER.PM$HEADER
         ,PC$BodyClass  => :PARAMETER.PM$BODY
         ,PC$TitleClass => :PARAMETER.PM$TITLE
         ,PC$Title      => 'Buscar Solicitudes'
         ,PB$ScrollBar  => True
        ) ;

        /**/

      -- paint the blocks --
        PKG_LOOK_AND_FEEL.Paint_Block
        (
          PC$Block      => 'SSO'
         ,PC$BeanName   => 'LAF_BLOCK.LAF_BEAN'
         ,PC$VA_Name    => :PARAMETER.PM$VA
         ,PC$HeadClass  => :PARAMETER.PM$HEADER
         ,PC$BodyClass  => :PARAMETER.PM$BODY
         ,PC$TitleClass => null --:PARAMETER.PM$TITLE
         ,PC$Title      => null --'Solicitudes'
         ,PB$ScrollBar  => True
        ) ;       

        PKG_LOOK_AND_FEEL.Paint_Block
        (
          PC$Block      => 'SSSO'
         ,PC$BeanName   => 'LAF_BLOCK.LAF_BEAN'
         ,PC$VA_Name    => :PARAMETER.PM$VA
         ,PC$HeadClass  => :PARAMETER.PM$HEADER
         ,PC$BodyClass  => :PARAMETER.PM$BODY
         ,PC$TitleClass => null --:PARAMETER.PM$TITLE
         ,PC$Title      => null --'Solicitudes'
         ,PB$ScrollBar  => True
        ) ;       
      
        go_block('B1');
      
      End if ;


  End if ;

In parameter PM$CSS_FILENAME i have this value /opt/oracle/css/forms.css where my css file is on my oas.

And you must have this items LAF_BEAN and BEAN_LOV of block LAF_BLOCK on each canvas that you want to apply the css style.
For example if i have 2 canvas i have one block laf_block with items laf_bean and bean_lov on canvas 1, and another block laf_block2 with items laf_bean and bean_lov on canvas 2.




No comments:

Post a Comment