Module org.apache.wicket.core
Class InitializerStringResourceLoader
- java.lang.Object
-
- org.apache.wicket.resource.loader.ComponentStringResourceLoader
-
- org.apache.wicket.resource.loader.InitializerStringResourceLoader
-
- All Implemented Interfaces:
IStringResourceLoader
public class InitializerStringResourceLoader extends ComponentStringResourceLoader
This is one of Wicket's default string resource loaders. It is designed to let wicket extension modules contribute default resource bundles for their components.The initializer based string resource loader attempts to find the resource from a bundle that corresponds to the supplied wicket initializers.
This implementation is fully aware of both locale and style values when trying to obtain the appropriate resources.
- Author:
- Bertrand Guay-Paquet, Sven Meier
-
-
Constructor Summary
Constructors Constructor Description InitializerStringResourceLoader(List<IInitializer> initializers)
Create and initialize the resource loader.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
loadStringResource(Class<?> clazz, String key, Locale locale, String style, String variation)
Get the string resource for the given combination of component class, resource key, locale and style.String
loadStringResource(Component component, String key, Locale locale, String style, String variation)
Get the string resource for the given combination of component, resource key, locale and style.-
Methods inherited from class org.apache.wicket.resource.loader.ComponentStringResourceLoader
getPropertiesFactory, getResourcePath, isStopResourceSearch, isStopResourceSearch, newResourceNameIterator
-
-
-
-
Constructor Detail
-
InitializerStringResourceLoader
public InitializerStringResourceLoader(List<IInitializer> initializers)
Create and initialize the resource loader.- Parameters:
initializers
- initializers
-
-
Method Detail
-
loadStringResource
public String loadStringResource(Class<?> clazz, String key, Locale locale, String style, String variation)
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 interfaceIStringResourceLoader
- Overrides:
loadStringResource
in classComponentStringResourceLoader
- Parameters:
clazz
- The class to get the string resource forkey
- The key should be a String containing a lookup key into a resource bundlelocale
- The locale should contain the locale of the current operation so that the appropriate set of resources can be selectedstyle
- The style identifying the resource set to select the strings from (seeSession
)variation
- The components variation (of the style)- Returns:
- The string resource value or null if the resource could not be loaded by this loader
-
loadStringResource
public String loadStringResource(Component component, String key, Locale locale, String style, String variation)
Description copied from interface:IStringResourceLoader
Get the string resource for the given combination of component, resource key, locale and style. 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 interfaceIStringResourceLoader
- Overrides:
loadStringResource
in classComponentStringResourceLoader
- Parameters:
component
- The component to get the string resource forkey
- The key should be a String containing a lookup key into a resource bundlelocale
- Will be preset with the appropriate value. You shall ignore the component's locale.style
- Will be preset with the appropriate value. You shall ignore the component's style.variation
- Will be preset with the appropriate value. You shall ignore the component's variation.- 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, java.util.Locale, java.lang.String, java.lang.String)
-
-