org.yasl.arch.resources
Interface YASLResourceManager

All Known Implementing Classes:
YASLResourceManagerImpl

public interface YASLResourceManager

Methods for managing the loading of images and items from resource bundles.


Method Summary
 String getDefaultBundle()
          Returns the default bundle for the application's resource manager.
 Locale getLocale()
          Returns the current Locale being used by this resource manager.
 String getString(String bundle, String key)
          Loads a String associated with the passed key from the named resource bundle.
 String getString(String bundle, String key, Locale locale)
          Loads a String associated with the passed key from the named resource bundle based on the passed Locale.
 String getString(String bundle, String key, Locale locale, ClassLoader classLoader)
          Loads a String associated with the passed key from the named resource bundle based on the passed Locale.
 ImageIcon loadImageIcon(String iconName)
          Loads an image as an ImageIcon.
 ImageIcon loadImageIcon(String iconName, ClassLoader classLoader)
          Loads an image as an ImageIcon.
 ImageIcon loadImageIcon(String bundle, String key)
          Loads an image as an ImageIcon after getting the fully qualified package name from a resource bundle.
 ImageIcon loadImageIcon(String bundle, String key, Locale locale)
          Loads an image as an ImageIcon after getting the fully qualified package name from a resource bundle based on the passed Locale.
 void setLocale(Locale locale)
          Sets the Locale to be used by this resource manager.
 

Method Detail

getDefaultBundle

public String getDefaultBundle()
Returns the default bundle for the application's resource manager.

Returns:
String

getLocale

public Locale getLocale()
Returns the current Locale being used by this resource manager.

Returns:
Locale

setLocale

public void setLocale(Locale locale)
Sets the Locale to be used by this resource manager.

Parameters:
locale - Locale

loadImageIcon

public 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

Note that this method assumes the ClassLoader to be used for loading the image is the same as the ClassLoader for the implementation class. If you are loading an image from a jar file that was loaded at runtime, you will need to use the signature that takes a ClassLoader argument.

Parameters:
iconName - String
Returns:
ImageIcon

loadImageIcon

public 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

This method also takes a ClassLoader. If you are trying to load images from a jar that was not on the initial classpath, you must pass in the classloader for the jar file.

Parameters:
iconName - String
classLoader - ClassLoader
Returns:
ImageIcon

loadImageIcon

public ImageIcon loadImageIcon(String bundle,
                               String key)
Loads an image as an ImageIcon after getting the fully qualified package name from a resource bundle.

Parameters:
bundle - String
key - String
Returns:
ImageIcon

loadImageIcon

public ImageIcon loadImageIcon(String bundle,
                               String key,
                               Locale locale)
Loads an image as an ImageIcon after getting the fully qualified package name from a resource bundle based on the passed Locale.

Parameters:
bundle - String
key - String
locale - Locale
Returns:
ImageIcon

getString

public String getString(String bundle,
                        String key)
Loads a String associated with the passed key from the named resource bundle.

Parameters:
bundle - String
key - String
Returns:
String

getString

public String getString(String bundle,
                        String key,
                        Locale locale)
Loads a String associated with the passed key from the named resource bundle based on the passed Locale.

Parameters:
bundle - String
key - String
locale - Locale
Returns:
String

getString

public String getString(String bundle,
                        String key,
                        Locale locale,
                        ClassLoader classLoader)
Loads a String associated with the passed key from the named resource bundle based on the passed Locale.

This method also takes a ClassLoader. If you are trying to load strings from a properties file in a jar that was not on the initial classpath, you must pass in the classloader for the jar file.

Parameters:
bundle - String
key - String
locale - Locale
classLoader - ClassLoader
Returns:
String