Dynamic frames
By francois degrelle on Friday, March 27 2015, 15:14 - PJC - Javabean - Permalink
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
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
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,FrameB,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,Framer') ;
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
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_BACKGROUND255g0b0,-,.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
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
HIDE_FRAME
Hide the given frame
Set_Custom_Property('BL.BEAN',1,'HIDE_FRAME','name
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,3rial,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