Javadoc hosting sponsored by DD Poker and Donohoe Digital LLC.

org.apache.wicket.resource.loader
Class PackageStringResourceLoader

java.lang.Object
  extended by org.apache.wicket.resource.loader.PackageStringResourceLoader
All Implemented Interfaces:
IStringResourceLoader

public class PackageStringResourceLoader
extends java.lang.Object
implements IStringResourceLoader

This is one of Wicket's default string resource loaders.

The package based string resource loader attempts to find the resource from a bundle that corresponds to the supplied component objects package or one of its parent packages.

The search order for resources is component object package towards root package.

This implementation is fully aware of both locale and style values when trying to obtain the appropriate resources.

Author:
Juergen Donnerstag

Constructor Summary
PackageStringResourceLoader()
          Create and initialize the resource loader.
 
Method Summary
 java.lang.String getFilename()
          Gets the properties file filename (without extension)
 java.lang.String loadStringResource(java.lang.Class clazz, java.lang.String key, java.util.Locale locale, java.lang.String style)
          Get the string resource for the given combination of component class, resource key, locale and style.
 java.lang.String loadStringResource(Component component, java.lang.String key)
          Get the string resource for the given combination of component and resource key.
 void setFilename(java.lang.String filename)
          Sets the properties filename (without extension)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PackageStringResourceLoader

public PackageStringResourceLoader()
Create and initialize the resource loader.

Method Detail

loadStringResource

public java.lang.String loadStringResource(java.lang.Class clazz,
                                           java.lang.String key,
                                           java.util.Locale locale,
                                           java.lang.String style)
Description copied from interface: IStringResourceLoader
Get the string resource for the given combination of component class, resource key, locale and style. The component class provided is used to allow implementation of component specific resource loading (e.g. per page or per reusable component). The key should be a String containing a lookup key into a resource bundle. The locale should contain the locale of the current operation so that the appropriate set of resources can be selected. The style allows the set of resources to select to be varied by skin/brand.

Specified by:
loadStringResource in interface IStringResourceLoader
Parameters:
clazz - The class to get the string resource for
key - The key should be a String containing a lookup key into a resource bundle
locale - The locale should contain the locale of the current operation so that the appropriate set of resources can be selected
style - The style identifying the resource set to select the strings from (see Session)
Returns:
The string resource value or null if the resource could not be loaded by this loader
See Also:
IStringResourceLoader.loadStringResource(java.lang.Class, java.lang.String, java.util.Locale, java.lang.String)

loadStringResource

public java.lang.String loadStringResource(Component component,
                                           java.lang.String key)
Description copied from interface: IStringResourceLoader
Get the string resource for the given combination of component and resource key. The component provided is used to allow implementation of component specific resource loading (e.g. per page or per reusable component). The key should be a String containing a lookup key into a resource bundle. The Locale and the style will be taken from the Component provided.

Specified by:
loadStringResource in interface IStringResourceLoader
Parameters:
component - The component to get the string resource for
key - The key should be a String containing a lookup key into a resource bundle
Returns:
The string resource value or null if the resource could not be loaded by this loader
See Also:
IStringResourceLoader.loadStringResource(org.apache.wicket.Component, java.lang.String)

getFilename

public java.lang.String getFilename()
Gets the properties file filename (without extension)

Returns:
filename

setFilename

public void setFilename(java.lang.String filename)
Sets the properties filename (without extension)

Parameters:
filename - filename


Copyright © 2004-2008 Apache Software Foundation. All Rights Reserved.