org.apache.myfaces.trinidadinternal.share.nls
Class LocaleContextImpl

java.lang.Object
  extended by org.apache.myfaces.trinidad.context.LocaleContext
      extended by org.apache.myfaces.trinidadinternal.share.nls.LocaleContextImpl
Direct Known Subclasses:
MutableLocaleContext

public class LocaleContextImpl
extends org.apache.myfaces.trinidad.context.LocaleContext

Context for locale-specific operations and properties. All of the properties should initially default to those of the base Locale, while allowing the locale-specific properties to be overridden.

It is expected that additional properties will be added to this class over time in order to support overriding the date and number formats.

Clients should never subclass this class.

Version:
$Name: $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/share/nls/LocaleContext.java#0 $) $Date: 10-nov-2005.19:00:03 $
Author:
The Oracle ADF Faces Team

Constructor Summary
LocaleContextImpl(java.util.Locale locale)
          Creates a LocaleContext based off of the specified Locale.
LocaleContextImpl(java.util.Locale formattingLocale, java.util.Locale translationLocale)
          Creates a LocaleContext based off of the specified Locale and using a different Locale for translations.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Override of Object.equals().
 java.util.ResourceBundle getBundle(java.lang.String baseBundleName)
          Returns the resource bundle with the specified name, for this translation locale.
 DateFormatContext getDateFormatContext()
          Returns the DateFormatContext containing all date format parameters, falling back on defaults when getDateFormatContextImpl returns null;
protected  DateFormatContext getDateFormatContextImpl()
          Returns the DateFormatContext containing all date format parameters.
 DecimalFormatContext getDecimalFormatContext()
          Returns the DecimalFormatContext containing all number format parameters, falling back on defaults when getDecimalFormatContextImpl returns null;
protected  DecimalFormatContext getDecimalFormatContextImpl()
          Returns the DecimalFormatContext containing all number format parameters.
 char getDecimalSeparator()
          Returns the character used as a decimal separator.
 java.lang.String getFormattingIANALocaleString()
          Returns the Locale in IANA String format.
 java.util.Locale getFormattingLocale()
          Returns the locale that should be used for formatting.
 char getGroupingSeparator()
          Returns the character used to separate number groups.
 int getReadingDirection()
          Returns the reading direction that should be used for rendering.
 java.util.TimeZone getTimeZone()
          Returns the TimeZone that the user is running in.
 java.lang.String getTranslationIANALocaleString()
          Returns the translation Locale in IANA String format.
 java.util.Locale getTranslationLocale()
          Returns the locale that should be used for translations.
 int getTwoDigitYearStart()
          Returns the year offset for parsing years with only two digits.
 int hashCode()
          Override of Object.hashCode().
 boolean isRightToLeft()
           
 void setReadingDirection(int newReadingDirection)
          Deprecated. use MutableLocaleContext.setReadingDirection() instead
 void setTimeZone(java.util.TimeZone newTimeZone)
          Deprecated. use MutableLocaleContext.setTimeZone() instead
 java.lang.String toString()
          Override of Object.toString().
 
Methods inherited from class org.apache.myfaces.trinidad.context.LocaleContext
getIANALocaleString, getLocale
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LocaleContextImpl

public LocaleContextImpl(java.util.Locale locale)
Creates a LocaleContext based off of the specified Locale.


LocaleContextImpl

public LocaleContextImpl(java.util.Locale formattingLocale,
                         java.util.Locale translationLocale)
Creates a LocaleContext based off of the specified Locale and using a different Locale for translations. Applications that only provide translations for a subset of the Locales provided by subcomponents can use the translation Locale to force subcomponents to only use translations in a language supported by the application.

Parameters:
formattingLocale - Locale providing default formatting behavior for the LocaleContext. If not specified, the defualt Locale is used.
translationLocale - Locale to use for translations. If not specified, the formattingLocale is used.
Method Detail

getTranslationLocale

public java.util.Locale getTranslationLocale()
Returns the locale that should be used for translations.

Specified by:
getTranslationLocale in class org.apache.myfaces.trinidad.context.LocaleContext

getFormattingLocale

public java.util.Locale getFormattingLocale()
Returns the locale that should be used for formatting.

Specified by:
getFormattingLocale in class org.apache.myfaces.trinidad.context.LocaleContext

getFormattingIANALocaleString

public java.lang.String getFormattingIANALocaleString()
Returns the Locale in IANA String format.

Specified by:
getFormattingIANALocaleString in class org.apache.myfaces.trinidad.context.LocaleContext

getTranslationIANALocaleString

public java.lang.String getTranslationIANALocaleString()
Returns the translation Locale in IANA String format.

Specified by:
getTranslationIANALocaleString in class org.apache.myfaces.trinidad.context.LocaleContext

isRightToLeft

public boolean isRightToLeft()
Specified by:
isRightToLeft in class org.apache.myfaces.trinidad.context.LocaleContext

getReadingDirection

public int getReadingDirection()
Returns the reading direction that should be used for rendering.

Returns:
a reading direction from org.apache.myfaces.trinidadinternal.util.nls.LocaleUtils. This method will never return LocaleUtils.DIRECTION_DEFAULT.

See Also:
setReadingDirection(int), LocaleUtils

setReadingDirection

@Deprecated
public void setReadingDirection(int newReadingDirection)
Deprecated. use MutableLocaleContext.setReadingDirection() instead

Sets the new reading direction to be one of the reading directions defined in org.apache.myfaces.trinidadinternal.util.nls.LocaleUtils.

See Also:
MutableLocaleContext

getTimeZone

public java.util.TimeZone getTimeZone()
Returns the TimeZone that the user is running in.

Specified by:
getTimeZone in class org.apache.myfaces.trinidad.context.LocaleContext

setTimeZone

@Deprecated
public void setTimeZone(java.util.TimeZone newTimeZone)
Deprecated. use MutableLocaleContext.setTimeZone() instead

Sets the TimeZone that the user is running in. Setting this value to null will set the TimeZone to the default TimeZone.

See Also:
MutableLocaleContext

toString

public java.lang.String toString()
Override of Object.toString().

Overrides:
toString in class java.lang.Object

getBundle

public java.util.ResourceBundle getBundle(java.lang.String baseBundleName)
                                   throws java.util.MissingResourceException
Returns the resource bundle with the specified name, for this translation locale.

As the LocaleContext maintains a cache of found ResourceBundles, this is much faster than using ResourceBundle.getBundle

Specified by:
getBundle in class org.apache.myfaces.trinidad.context.LocaleContext
Throws:
java.util.MissingResourceException
See Also:
ResourceBundle.getBundle(java.lang.String)

getTwoDigitYearStart

public int getTwoDigitYearStart()
Returns the year offset for parsing years with only two digits.

Specified by:
getTwoDigitYearStart in class org.apache.myfaces.trinidad.context.LocaleContext

getGroupingSeparator

public char getGroupingSeparator()
Returns the character used to separate number groups. If zero (NUL), the default separator for the Locale will be used.

Specified by:
getGroupingSeparator in class org.apache.myfaces.trinidad.context.LocaleContext

getDecimalSeparator

public char getDecimalSeparator()
Returns the character used as a decimal separator. If zero (NUL), the default separator for the Locale will be used.

Specified by:
getDecimalSeparator in class org.apache.myfaces.trinidad.context.LocaleContext

getDateFormatContext

public final DateFormatContext getDateFormatContext()
Returns the DateFormatContext containing all date format parameters, falling back on defaults when getDateFormatContextImpl returns null;


getDecimalFormatContext

public final DecimalFormatContext getDecimalFormatContext()
Returns the DecimalFormatContext containing all number format parameters, falling back on defaults when getDecimalFormatContextImpl returns null;


hashCode

public int hashCode()
Override of Object.hashCode().

Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Override of Object.equals().

Overrides:
equals in class java.lang.Object

getDateFormatContextImpl

protected DateFormatContext getDateFormatContextImpl()
Returns the DateFormatContext containing all date format parameters. If this method returns null, getDateFormatContext will use the default value instead.


getDecimalFormatContextImpl

protected DecimalFormatContext getDecimalFormatContextImpl()
Returns the DecimalFormatContext containing all number format parameters. If this method returns null, getDecimalFormatContext will use the default value instead.



Copyright © 2001-2007 Apache Software Foundation. All Rights Reserved.