org.yasl.util
Class YASLResourceBundleHelper

java.lang.Object
  extended byorg.yasl.util.YASLResourceBundleHelper

public class YASLResourceBundleHelper
extends Object

Version:
1.0
Author:
Jeff Chapman

Method Summary
static String getStringFromBundle(String bundle, String messageId)
          Returns the string mapped to messageId from the resource bundle.
static String getStringFromBundle(String bundle, String messageId, ClassLoader classLoader)
          Returns the string mapped to messageId from the resource bundle.
static String getStringFromBundle(String bundle, String messageId, Locale locale)
          Returns the string mapped to messageId from the resource bundle.
static String getStringFromBundle(String bundle, String messageId, Locale locale, ClassLoader classLoader)
          Returns the string mapped to messageId from the resource bundle.
static ImageIcon loadImageIcon(String iconName)
          Loads an image as an ImageIcon.
static ImageIcon loadImageIcon(String iconName, ClassLoader classLoader)
          Loads an image as an ImageIcon.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getStringFromBundle

public static String getStringFromBundle(String bundle,
                                         String messageId)
Returns the string mapped to messageId from the resource bundle. The bundle should be fully qualified. For example: org.yasl.testapp.resources.yaslTestAppGuiStrings

If the resource bundle or messageId do not exist, the method will return ???bundle??? or ???messageId???.

Parameters:
bundle - String
messageId - String
Returns:
String mapped to messageId

getStringFromBundle

public static String getStringFromBundle(String bundle,
                                         String messageId,
                                         Locale locale)
Returns the string mapped to messageId from the resource bundle. The bundle should be fully qualified. For example: org.yasl.testapp.resources.yaslTestAppGuiStrings

If the resource bundle or messageId do not exist, the method will return ???bundle??? or ???messageId???.

Parameters:
bundle - String
messageId - String
locale - Locale
Returns:
String mapped to messageId

getStringFromBundle

public static String getStringFromBundle(String bundle,
                                         String messageId,
                                         ClassLoader classLoader)
Returns the string mapped to messageId from the resource bundle. The bundle should be fully qualified. For example: org.yasl.testapp.resources.yaslTestAppGuiStrings

If the resource bundle or messageId do not exist, the method will return ???bundle??? or ???messageId???.

Parameters:
bundle - String
messageId - String
classLoader - ClassLoader
Returns:
String mapped to messageId

getStringFromBundle

public static String getStringFromBundle(String bundle,
                                         String messageId,
                                         Locale locale,
                                         ClassLoader classLoader)
Returns the string mapped to messageId from the resource bundle. The bundle should be fully qualified. For example: org.yasl.testapp.resources.yaslTestAppGuiStrings

If the resource bundle or messageId do not exist, the method will return ???bundle??? or ???messageId???.

Parameters:
bundle - String
messageId - String
locale - Locale
classLoader - ClassLoader
Returns:
String mapped to messageId

loadImageIcon

public static ImageIcon loadImageIcon(String iconName)
Loads an image as an ImageIcon. Pass in image name with fully qualified package name. For example, /org/myapp/images/someicon.gif

Will return null when there are problems loading the image.

Parameters:
iconName - String
Returns:
ImageIcon

loadImageIcon

public static ImageIcon loadImageIcon(String iconName,
                                      ClassLoader classLoader)
Loads an image as an ImageIcon. Pass in image name with fully qualified package name. For example, /org/myapp/images/someicon.gif

Will return null when there are problems loading the image.

This method should be used if the class loader for the resource is different from that used for the YASLResourceBundleHelper class. For example, if a resource is dynamically loaded from a jar file.

Parameters:
iconName - String
classLoader - ClassLoader
Returns:
ImageIcon