ilog.views.appframe.util
Class IlvResourceBundleManager

java.lang.Object
  extended by java.util.ResourceBundle
      extended by ilog.views.appframe.util.IlvResourceBundleManager

public class IlvResourceBundleManager
extends ResourceBundle

Defines resource bundles that manage resource bundles.


Field Summary
protected  Locale locale
          Stores the locale this manager provides resources for.
 
Fields inherited from class java.util.ResourceBundle
parent
 
Constructor Summary
IlvResourceBundleManager()
          Constructs a new IlvResourceBundleManager.
 
Method Summary
 void addResourceBundle(ResourceBundle bundle)
          Adds the specified resource bundle to the list of resource bundles managed by this object.
 ResourceBundle addResourcePropertyFile(String propertyFile)
          Adds the specified resource bundle to the list of resource bundles managed by this object.
protected  ClassLoader getClassLoader()
          Returns the class loader used by the resource manager for locating resource bundles.
 String getFormattedString(String format, Object[] params)
          Returns the string resulting from the formatting of the specified format with the parameters contained in the params array of objects.
 ImageIcon getImageIcon(String filename)
          Returns the image icon with the specified filename.
 Enumeration getKeys()
          Returns an enumeration of the resource keys handled by this resource manager.
 Locale getLocale()
          Returns the locale that this resource bundle manager provides resources for.
protected  Object handleGetObject(String key)
          Returns the resource object for the specified key.
 ResourceBundle removeResourceBundle(ResourceBundle bundle)
          Removes the specified resource bundle from the list of resource bundles managed by this resource bundle manager.
 ResourceBundle removeResourcePropertyFile(String propertyFile)
          Removes the specified property file from the list of property files managed by this object.
 void setLocale(Locale locale)
          Sets the locale that the resource bundle manager will provide resources for.
 void setURLResolver(IlvURLResolverManager urlResolver)
          Specifies the URL resolver manager used for finding resource property files.
 
Methods inherited from class java.util.ResourceBundle
getBundle, getBundle, getBundle, getObject, getString, getStringArray, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

locale

protected Locale locale
Stores the locale this manager provides resources for.

See Also:
getLocale(), setLocale(java.util.Locale)
Constructor Detail

IlvResourceBundleManager

public IlvResourceBundleManager()
Constructs a new IlvResourceBundleManager. The newly created resource bundle does not contain any resource bundles by default.

Method Detail

getKeys

public Enumeration getKeys()
Returns an enumeration of the resource keys handled by this resource manager.

Specified by:
getKeys in class ResourceBundle
Returns:
An enumeration of the keys of the resources contained in all the resource bundles managed by this object.

handleGetObject

protected Object handleGetObject(String key)
Returns the resource object for the specified key.

Specified by:
handleGetObject in class ResourceBundle
Parameters:
key - The key of the resource to return the value from.
Returns:
The resource with the specified key; null if no resource is specified with this key.

getLocale

public Locale getLocale()
Returns the locale that this resource bundle manager provides resources for.

Overrides:
getLocale in class ResourceBundle
Returns:
The locale of this resource bundle manager.
See Also:
setLocale(java.util.Locale)

setLocale

public void setLocale(Locale locale)
Sets the locale that the resource bundle manager will provide resources for.

Parameters:
locale - The new locale of the resource bundle manager.
See Also:
getLocale()

addResourceBundle

public void addResourceBundle(ResourceBundle bundle)
Adds the specified resource bundle to the list of resource bundles managed by this object.

Parameters:
bundle - The resource bundle to add.

addResourcePropertyFile

public ResourceBundle addResourcePropertyFile(String propertyFile)
Adds the specified resource bundle to the list of resource bundles managed by this object.

Parameters:
propertyFile - The property file to create a resource bundle from.
Returns:
The newly created resource bundle that corresponds to the specified property file and the current locale or null if no resource bundle could be created.
See Also:
removeResourcePropertyFile(java.lang.String), removeResourceBundle(java.util.ResourceBundle)

removeResourcePropertyFile

public ResourceBundle removeResourcePropertyFile(String propertyFile)
Removes the specified property file from the list of property files managed by this object.

Parameters:
propertyFile - The property file to remove.
Returns:
The resource bundle corresponding to the specified propertyFile and the current locale or null if the property file was not added to the manager.
See Also:
addResourcePropertyFile(java.lang.String), removeResourceBundle(java.util.ResourceBundle)

removeResourceBundle

public ResourceBundle removeResourceBundle(ResourceBundle bundle)
Removes the specified resource bundle from the list of resource bundles managed by this resource bundle manager.

Returns:
The removed bundle or null if the specified resource bundle has not previously been added to this manager.
See Also:
addResourceBundle(java.util.ResourceBundle)

getFormattedString

public String getFormattedString(String format,
                                 Object[] params)
Returns the string resulting from the formatting of the specified format with the parameters contained in the params array of objects.

See the documentation of the java.text.MessageFormat class for the details of the format protocol.

Parameters:
format - The key of the string resource containing the format of the string to return.
params - The array of parameters used for the formatting.
Returns:
The formatted string.

setURLResolver

public void setURLResolver(IlvURLResolverManager urlResolver)
Specifies the URL resolver manager used for finding resource property files.

Parameters:
urlResolver - The URL resolver.
See Also:
getImageIcon(java.lang.String)

getImageIcon

public ImageIcon getImageIcon(String filename)
Returns the image icon with the specified filename. Determines first whether the specified filename is a key to a string resource that defines a file name. In this case, the specified string is set to the string resource value.

Then, a URL is created from this file name using the URL resolver associated with this resource bundle manager. If no URL can be resolved from the file name, null will be returned. Otherwise, an icon is created from this URL and returned.

If an image icon with the same file name has already been requested from this resource bundle manager, the same image icon is returned.

Parameters:
filename - The file name or resource key of the image icon to return.
Returns:
The image icon corresponding to the specified file name; null otherwise.
See Also:
setURLResolver(ilog.views.appframe.util.IlvURLResolverManager)

getClassLoader

protected ClassLoader getClassLoader()
Returns the class loader used by the resource manager for locating resource bundles.



Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.   . All Rights Reserved.