All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.webrunner.bab.Util

java.lang.Object
   |
   +----com.ibm.webrunner.bab.Util

public class Util
extends Object
This provides utility methods to display message dialogs, loading resource files,etc. All the methods on this class are static.

Modification(s) History :
06/17/98 - created

Version:
0.1

Constructor Index

 o Util()

Method Index

 o getResString(ResourceBundle, String, boolean)
Returns a string value from the resource given a key.
 o getResStringArray(ResourceBundle, String, boolean)
Returns String array from the resource given a key.
 o invokeAndWait(Runnable)
This basically is a wrapper for SwingUtilities.invokeAndWait().
 o loadResourceFile(String, Locale, boolean)
Loads a resource file and returns the bundle.
 o runDialog(Component)
Runs a dialog in event dispatcher thread.

Constructors

 o Util
 public Util()

Methods

 o loadResourceFile
 public static ResourceBundle loadResourceFile(String resFile,
                                               Locale locale,
                                               boolean notify)
Loads a resource file and returns the bundle. The resource file name can be either a property resource file or a list resource file. This can be used to load resource file independent of the platform (Netscape, Sun, Micorosoft) and independent of resource file type ( property or List Resource)

Parameters:
resFile - Resource file name with package name and without extension
locale - Locale to use, can be null to indicate current locale
notify - if set to true, pops up a message dialog notifying the user of any problems.
Returns:
resource bundle
 o getResString
 public static final String getResString(ResourceBundle res,
                                         String key,
                                         boolean notify)
Returns a string value from the resource given a key. If an exception is thrown by the underlaying system (MissingResourceException) then null is returned. If the parameter notify is set to true then a message dialog pops up notifying the user that the expected resource couldn't be found.

 o getResStringArray
 public static final String[] getResStringArray(ResourceBundle res,
                                                String key,
                                                boolean notify)
Returns String array from the resource given a key. If an exception is thrown by the underlaying system (MissingResourceException) then null is returned. If the parameter notify is set to true then a message dialog pops up notifying the user that the expected resource couldn't be found.

ex: myStrArray=Open, Open an Existing file, images/open.gif Each string must be separated by a comma.

 o runDialog
 public static void runDialog(Component comp)
Runs a dialog in event dispatcher thread. If the parameter is either Window or JInternalFrame then calls show() otherwise calls setVisible( true). Uses Util.invokeAndWait

 o invokeAndWait
 public static void invokeAndWait(Runnable obj)
This basically is a wrapper for SwingUtilities.invokeAndWait(). This checks to see if we are in the event dispatcher thread already, if so simply calls run on the object, otherwise runs it through SwingUtilities.invokeAndWait. Brings up an exception message dialog in case of any exceptions


All Packages  Class Hierarchy  This Package  Previous  Next  Index