wicket.resource.loader
Class WicketBundleStringResourceLoader
java.lang.Object
wicket.resource.loader.AbstractStringResourceLoader
wicket.resource.loader.WicketBundleStringResourceLoader
- All Implemented Interfaces:
- IStringResourceLoader
public class WicketBundleStringResourceLoader
- extends AbstractStringResourceLoader
Wicket's default string resource loaders are NOT behaving like Java Bundles
in the sense that once a proper properties files has been found but it does
not contain the key you are looking for, Wicket will not continue iterating
over the remaing properties file for the same class to check any of these
contain the key.
The reason why Java's BundleResource can not be used is because with Wicket
the locale, the style and the variation must be evaluated as well.
This ResourceLoader is a all in one. It first tries to resolve through the
class that is given with all the possible style and location variations.
Then if still not found it will fall back on the Applications class and tries
to load the resources through that one.
E.g.
1) Application_myskin_fi.properties
message1=AAAAAAAAA
2) Application_myskin.properties
message2=BBBBBBBB
3) Application.properties
message3=CCCCCCC
Component.getString("message3") should correctly read from file 3.
TODO Post 1.2: This should become Wicket's default behavior
- Author:
- Marco Geier, Juergen Donnerstag, Johan Compagner
|
Method Summary |
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 class, key, locale
and style. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
WicketBundleStringResourceLoader
public WicketBundleStringResourceLoader(Application application,
java.lang.Class clazz)
- Create and initialise the resource loader.
- Parameters:
application - The application that this resource loader is associated withclazz -
WicketBundleStringResourceLoader
public WicketBundleStringResourceLoader(Application application)
- Create and initialise the resource loader.
- Parameters:
application - The application that this resource loader is associated with
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 class:
AbstractStringResourceLoader
- Get the string resource for the given combination of class, key, locale
and style. The information is obtained from a resource bundle associated
with the provided Class (or one of its super classes).
- Specified by:
loadStringResource in interface IStringResourceLoader- Overrides:
loadStringResource in class AbstractStringResourceLoader
- Parameters:
clazz - The Class to find resources to be loadedkey - The key to obtain the string forlocale - The locale identifying the resource set to select the strings
fromstyle - The (optional) style identifying the resource set to select
the strings from (see Session)
- Returns:
- The string resource value or null if resource not found
- See Also:
ClassStringResourceLoader.loadStringResource(java.lang.Class,
java.lang.String, java.util.Locale, java.lang.String)
Copyright © 2004-2007 Wicket developers. All Rights Reserved.