23 mars 2006
4
23
/03
/mars
/2006
18:40
After reading the article about the input dialog box, someone asked me if it was possible to have a multi-lines input box.
So, this is the version 1.1 of the input dialog box
Here is the Java code and the JAR file
To use the single line input box use the following:
Set_Custom_Property( 'BL.BEAN', 1, 'SETTEXT', 'question text' ) ;
To use the multi lines input box use the following:
Set_Custom_Property( 'BL.BEAN', 1, 'SETTEXTMULTI', 'question text' ) ;
Published by Oracle Forms community
-
dans
Bean - JoptionPane
2 février 2006
4
02
/02
/février
/2006
16:05
Purpose
This is a Javabean component that allow to enter a value from an input dialog box
The java code
package oracle.forms.fd; import oracle.forms.handler.IHandler; import oracle.forms.properties.ID; import oracle.forms.ui.VBean; import javax.swing.JOptionPane; /** * A javabean input dialog box for Oracle Forms * * @author Francois Degrelle * @version 1.0 */ public class InputDialog extends VBean { static String title = "" ; static String text = "" ; static String result = "" ; static int icon = JOptionPane.QUESTION_MESSAGE ; private IHandler mHandler; private static final ID pSetTitle = ID.registerProperty("SETTITLE"); private static final ID pSetText = ID.registerProperty("SETTEXT"); private static final ID pGetString = ID.registerProperty("GETSTRING"); public InputDialog() { 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 == pSetText) { /** Set the message and display the dialog box **/ text = (String)value ; result = ShowDialog(); 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 dialog box */ public static String ShowDialog() { String sReturn = "" ; sReturn = JOptionPane.showInputDialog(null, text, title, icon); if( sReturn == null ) return "" ; else return sReturn ; } } |
Forms configuration
- Copy the inputdialog.jar file in the /forms/java directory
- Sign the inputdialog.jar file with your own certificate
- Edit the /forms/server/formsweb.cfg file to add the jar file to the archive_jinit variable
archive_jini=f90all_jinit.jar,……,inputdialog.jar
Implementation Class property
oracle.forms.fd.InputDialog
Properties that can be set
Set the title of the message box
Set_Custom_Property( ‘BLOCK.BEAN_ITEM’, ‘SETTITLE’, ‘the_title’ ) ;
Set the text of the message box
Set_Custom_Property( ‘BLOCK.BEAN_ITEM’, ‘SETTEXT’, ‘the_text’ ) ;
Properties that can be read
The returned string
:BLK.ITEM := Get_Custom_Property( ' BLOCK.BEAN_ITEM', 1, 'GETSTRING' ) ;
The sample dialog
- Download the inputdialog.zip file
- Unzip the inputdialog.zip file
- Copy the inputdialog.jar file in your /forms/java/ directory
- Edit your /forms/server/formsweb.cfg file
- Open the inputdialog.fmb module (Oracle Forms 9.0.2)
- Compile all and run the module
Published by Oracle Forms community
-
dans
Bean - JoptionPane
2 février 2006
4
02
/02
/février
/2006
12:32
Purpose
The Show_Alert() Forms built-in allows to display any message in a popup modal window.
This built-in is limited to a maximum of 255 characters displayed.
This limitation cannot allow to display huge messages like trace/log message.
This is a Javabean component that allow to display messages with thousands of characters
The java code
package oracle.forms.fd; import oracle.forms.handler.IHandler; import oracle.forms.properties.ID; import oracle.forms.ui.CustomEvent; import oracle.forms.ui.VBean; import javax.swing.JOptionPane; /** * A dialog box for Forms that allow to output 1 up to 32767 characters * * @author Francois Degrelle * @version 1.0 */ public class ShowMessage extends VBean { static String title = "" ; static String text = "" ; static String icone = "" ; static int max = 150 ; static int icon = JOptionPane.INFORMATION_MESSAGE ; private IHandler mHandler; private static final ID pSetTitle = ID.registerProperty("SETTITLE"); private static final ID pSetText = ID.registerProperty("SETTEXT"); private static final ID pSetIcon = ID.registerProperty("SETICON"); private static final ID pSetSize = ID.registerProperty("SETLINESIZE"); private static final ID pShow = ID.registerProperty("SHOW"); private static final ID pClear = ID.registerProperty("CLEAR"); public ShowMessage() { super(); } 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 == pSetText) { /** Set the message **/ text += (String)value ; return true; } else if (id == pClear) { /** Clear the text **/ text = "" ; return true; } else if (id == pSetSize) { /** Set max line size **/ max = new Integer((String)value).intValue() ; return true; } else if (id == pSetIcon) { /** Set the dialog box icon **/ icone = (String)value ; if( icone.equals("I") ) icon = JOptionPane.INFORMATION_MESSAGE ; else if( icone.equals("E") ) icon = JOptionPane.ERROR_MESSAGE ; else if( icone.equals("P") ) icon = JOptionPane.PLAIN_MESSAGE ; else if( icone.equals("W") ) icon = JOptionPane.WARNING_MESSAGE ; return true; } else if (id == pShow) { /** Display the dialog box **/ text = Wrap_Text( text ) ; ShowDialog(); return true; } else { return true; } } /** * Display the dialog box */ public static void ShowDialog() { JOptionPane.showMessageDialog(null, text, title, icon); } /** * Wrap the text if lines are too long */ private String Wrap_Text( String sText ) { String sWraped = "" ; String s1 = sText ; String s2 = "" ; int l, x = 0 ; l = s1.length() ; if( l <= max ) sWraped = s1 ; else { while( l > 0 ) { x = s1.indexOf("n") ; if( (x > 0) && (x <= max)) { sWraped += s1.substring(0,x) ; s1 = s1.substring(x) ; } else { s2 = s1.substring(0, max-1) ; sWraped += s2 + "n" ; s1 = s1.substring(max-1) ; } l = s1.length() ; if( l <= max ) { sWraped += s1 ; l = 0 ; } } } return sWraped ; } } |
Forms configuration
- Copy the showmessage.jar file in the /forms/java directory
- Sign the showmessage.jar file with your own certificate
- Edit the /forms/server/formsweb.cfg file to add the jar file to the archive_jinit variable
archive_jini=f90all_jinit.jar,……,showmessage.jar
Implementation Class property
oracle.forms.fd.ShowMessage
Properties that can be set
Clear the text
Set_Custom_Property( ‘BLOCK.BEAN_ITEM’, ‘CLEAR’, ‘’ ) ;
Set the title of the message box
Set_Custom_Property( ‘BLOCK.BEAN_ITEM’, ‘SETTITLE’, ‘the_title’ ) ;
Set the icon style
Set_Custom_Property( ‘BLOCK.BEAN_ITEM’, ‘SETICON’, ‘icon_type’ ) ;
Where icon_type could be:
- I Information
- E Error
- P Plain (no icon)
- W Warning
Set the maximum length of a line
Set_Custom_Property( ‘BLOCK.BEAN_ITEM’, ‘SETLINESIZE’, ‘max_size’ ) ;
Set the text of the message box
Set_Custom_Property( ‘BLOCK.BEAN_ITEM’, ‘SETTEXT’, ‘the_text’ ) ;
Display the message box
Set_Custom_Property( ‘BLOCK.BEAN_ITEM’, ‘SHOW’, ‘’ ) ;
The sample dialog
- Download the showmessage.zip file
- Unzip the showmessage.zip file
- Copy the showmessage.jar file in your /forms/java/ directory
- Edit your /forms/server/formsweb.cfg file
- Open the showmessage.fmb module (Oracle Forms 9.0.2)
- Compile all and run the module
Published by Oracle Forms community
-
dans
Bean - JoptionPane