org.apache.tapestry.util
Class LocalizedPropertySource

java.lang.Object
  extended by org.apache.tapestry.util.DelegatingPropertySource
      extended by org.apache.tapestry.util.LocalizedPropertySource
All Implemented Interfaces:
IPropertySource

public class LocalizedPropertySource
extends DelegatingPropertySource

A PropertySource extending the DelegatingPropertySources and adding the capability of searching for localized versions of the desired property. Useful when peoperties related to localization are needed.

Since:
3.0
Version:
$Id: LocalizedPropertySource.java 243791 2004-02-19 17:38:13Z hlship $
Author:
mindbridge

Constructor Summary
LocalizedPropertySource()
          Creates a LocalizedPropertySource with the default locale
LocalizedPropertySource(IPropertySource delegate)
          Creates a LocalizedPropertySource with the default locale and the provided delegate
LocalizedPropertySource(Locale locale)
          Creates a LocalizedPropertySource with the provided locale
LocalizedPropertySource(Locale locale, IPropertySource delegate)
          Creates a LocalizedPropertySource with the provided locale and delegate
 
Method Summary
 Locale getLocale()
           
 String getPropertyValue(String propertyName)
          Examines the properties localized using the provided locale in the order of more specific to more general and returns the first that has a value.
 void setLocale(Locale locale)
           
 
Methods inherited from class org.apache.tapestry.util.DelegatingPropertySource
addSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalizedPropertySource

public LocalizedPropertySource()
Creates a LocalizedPropertySource with the default locale


LocalizedPropertySource

public LocalizedPropertySource(Locale locale)
Creates a LocalizedPropertySource with the provided locale


LocalizedPropertySource

public LocalizedPropertySource(IPropertySource delegate)
Creates a LocalizedPropertySource with the default locale and the provided delegate


LocalizedPropertySource

public LocalizedPropertySource(Locale locale,
                               IPropertySource delegate)
Creates a LocalizedPropertySource with the provided locale and delegate

Method Detail

getLocale

public Locale getLocale()
Returns:
the locale currently used

setLocale

public void setLocale(Locale locale)
Parameters:
locale - the locale currently used

getPropertyValue

public String getPropertyValue(String propertyName)
Examines the properties localized using the provided locale in the order of more specific to more general and returns the first that has a value.

Specified by:
getPropertyValue in interface IPropertySource
Overrides:
getPropertyValue in class DelegatingPropertySource
See Also:
DelegatingPropertySource.getPropertyValue(java.lang.String)