0% found this document useful (0 votes)
117 views6 pages

Oracle Forms - Javabean: A Java Multi-Choice Alert Box

This document describes a Javabean component that displays a multi-choice alert box in Oracle Forms. The Javabean allows setting the alert title, text, option list, and delimiter from Forms properties. It returns the selected option as a string. The document provides instructions on configuring Forms and using the bean in a sample form to display an alert dialog box.

Uploaded by

sssseeeelllleeee
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
117 views6 pages

Oracle Forms - Javabean: A Java Multi-Choice Alert Box

This document describes a Javabean component that displays a multi-choice alert box in Oracle Forms. The Javabean allows setting the alert title, text, option list, and delimiter from Forms properties. It returns the selected option as a string. The document provides instructions on configuring Forms and using the bean in a sample form to display an alert dialog box.

Uploaded by

sssseeeelllleeee
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Big alert - Francois Degrelle

Oracle Forms Javabean


A java multi-choice alert box
Home page

1. Purpose
This is a Javabean component that allow to display an Alert box with many options

f.degrelle@free.fr - http://fdegrelle.over-blog.com/

Big alert - Francois Degrelle

f.degrelle@free.fr - http://fdegrelle.over-blog.com/

Big alert - Francois Degrelle

2. The Javabean
package oracle.forms.fd; import import import import import import import import java.util.StringTokenizer; oracle.forms.handler.IHandler; oracle.forms.properties.ID; oracle.forms.ui.VBean; javax.swing.JOptionPane; javax.swing.SwingUtilities; javax.swing.UIManager; javax.swing.plaf.metal.MetalLookAndFeel;

/** * A javabean multi choice alert for Oracle Forms * * @author Francois Degrelle * @version 1.0 */ public class BigAlert extends VBean { static static static static static static static private private private private private private String String String String String String int title = "" ; text = "" ; result = "" ; list = "" ; OptionList[] = new String[100]; sDelimiter = "|" ; icon = JOptionPane.QUESTION_MESSAGE ;

IHandler mHandler; static final ID pSetTitle static final ID pSetText static final ID pSetList static final ID pSetDelim static final ID pGetString

= = = = =

ID.registerProperty("SETTITLE"); ID.registerProperty("SETTEXT"); ID.registerProperty("SETLIST"); ID.registerProperty("SETDELIM"); ID.registerProperty("GETSTRING");

public BigAlert() { super(); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); SwingUtilities.updateComponentTreeUI(this); } catch (Exception ex) { ex.printStackTrace(); } } public void init(IHandler handler) { super.init(handler); mHandler = handler; } /** * Set the properties from Forms **/ public boolean setProperty(ID id, Object value) { if (id == pSetTitle) { /** Set the title **/ title = (String)value ; return true; } else if (id == pSetList) { /** Set the list of choices **/ int i = 0 ; list = (String)value ; StringTokenizer st = new StringTokenizer(list,sDelimiter); while (st.hasMoreTokens()) { OptionList[i] = st.nextToken() ; i++ ; } return true; } else if (id == pSetText) { /** Set the message and display the dialog box **/ text = (String)value ; result = ShowAlert(); return true; } else if (id == pSetDelim) { /** Set the list delimiter **/ sDelimiter = (String)value ; f.degrelle@free.fr - http://fdegrelle.over-blog.com/

Big alert - Francois Degrelle return true; } else { return true; } } /** * Get the result string from Forms **/ public Object getProperty(ID pId) { if (pId == pGetString) { return "" + result ; } else { return super.getProperty(pId); } } // getProperty() /** * Display the Alert box */ public static String ShowAlert() { String sReturn = (String)JOptionPane.showInputDialog( null, text, title, JOptionPane.QUESTION_MESSAGE, null, OptionList, OptionList[0]); if( sReturn == null ) return "" ; else return sReturn ; }

3. Forms configuration
Copy the bigalert.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,,bigalert.jar

4. How to implement this bean in your own form


Open your form Add a Javabean component to any block Set its Implementation class property to : oracle.forms.fd.BigAlert

5. The properties that can be sent to the bean

f.degrelle@free.fr - http://fdegrelle.over-blog.com/

Big alert - Francois Degrelle

The title of the alert box


Set_Custom_Property( BLOCK.BEAN_ITEM, SETTITLE, the_title ) ;

The choices list of the alert box


Set_Custom_Property( BLOCK.BEAN_ITEM, SETLIST, the_list ) ;

The values must be separated with the delimiter character ( Alt+124 by default)

The list delimiter


Set_Custom_Property( BLOCK.BEAN_ITEM, SETDELIM, char_delimiter ) ;

By default, the delimiter is | in the jar file

The text of the alert box


Set_Custom_Property( BLOCK.BEAN_ITEM, SETTEXT, the_text ) ;

6. The properties that can be read from the bean

The returned string


:BLK.ITEM := Get_Custom_Property( ' BLOCK.BEAN_ITEM', 1, 'GETSTRING' ) ;

7. The sample dialog


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

This dialog allows to enter the title, the question and the option list of the alert box The code that shows the alert dialog box is located in the When-Button-Pressed trigger
-- Set the title -Set_Custom_Property( 'CTRL.DIALOG', 1, 'SETTITLE', :CTRL.TITLE ) ; -- Set the option list -Set_Custom_Property( 'CTRL.DIALOG', 1, 'SETLIST', :CTRL.LIST ) ; -- Set the text and show the input dialog box -Set_Custom_Property( 'CTRL.DIALOG', 1, 'SETTEXT', :CTRL.QUESTION ) ; -- Get the input string -:CTRL.TEXT := Get_Custom_Property( 'CTRL.DIALOG', 1, 'GETSTRING' ) ;
f.degrelle@free.fr - http://fdegrelle.over-blog.com/

Big alert - Francois Degrelle

f.degrelle@free.fr - http://fdegrelle.over-blog.com/

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy