com.ibm.portal.model
Interface LocalizedContext


public interface LocalizedContext

A helper object which allows to retrieve titles and descriptions for resources implementing the Localized interface. The object performs language range matching as described in RFC2616 to determine the best fitting language to use for display purposes.
The language ranges to be considered are determined by how the context object is retrieved. For details, see LocalizedContextHome and its sub-interfaces.

Since:
6.1.0
See Also:
PortletLocalizedContext, PortalLocalizedContextHome, PortletLocalizedContextHome

Method Summary
 java.util.Locale getDefaultLocale()
          Returns the default locale as defined by portal
 java.lang.String getDescription(Localized aLocalized)
          Returns a fitting description of the given localized instance based on the information the context was created with.
 java.util.Locale getPreferredLocale(java.lang.Iterable<java.util.Locale> anIterable)
          Returns a preferred locale based on the information the context was created with.
 java.util.Locale getPreferredLocale(java.util.Iterator<java.util.Locale> anIterator)
          Returns a preferred locale based on the information the context was created with.
 java.util.Locale getPreferredLocale(ListModel<java.util.Locale> aLocaleList)
          Returns a preferred locale based on the information the context was created with.
 java.util.List<java.util.Locale> getPreferredLocales(java.lang.Iterable<java.util.Locale> anIterable)
          Returns a read-only list of preferred locales (in descending order) based on the information the context was created with.
 java.util.List<java.util.Locale> getPreferredLocales(java.util.Iterator<java.util.Locale> anIterator)
          Returns a read-only list of preferred locales (in descending order) based on the information the context was created with.
 java.util.List<java.util.Locale> getPreferredLocales(ListModel<java.util.Locale> aLocaleList)
          Returns a read-only list of preferred locales (in descending order) based on the information the context was created with.
 java.util.Locale getPreferredSupportedLocale()
          Returns a preferred locale based on the information the context was created with.
 java.util.List<java.util.Locale> getPreferredSupportedLocales()
          Returns a read-only list of preferred locales (in descending order) based on the information the context was created with.
 java.util.ResourceBundle getResourceBundle(java.lang.String baseName)
          Gets a resource bundle using the specified base name based on the information the context was created with.
 java.util.ResourceBundle getResourceBundle(java.lang.String baseName, java.lang.ClassLoader loader)
          Gets a resource bundle using the specified base name based on the information the context was created with.
 IterableListModel<java.util.Locale> getSupportedLocales()
          Provides easy access ot the list of supported locales
 java.lang.String getTitle(Localized aLocalized)
          Returns a fitting title of the given localized instance based on the information the context was created with.
 

Method Detail

getDefaultLocale

java.util.Locale getDefaultLocale()
Returns the default locale as defined by portal

Returns:
the default locale, not null

getDescription

java.lang.String getDescription(Localized aLocalized)
Returns a fitting description of the given localized instance based on the information the context was created with.

Parameters:
aLocalized - the localized providing the titles to choose from, not null
Returns:
a description string, not null, but may be an empty string

getPreferredLocale

java.util.Locale getPreferredLocale(java.lang.Iterable<java.util.Locale> anIterable)
Returns a preferred locale based on the information the context was created with. The preferred locale is one of the input locales.

Parameters:
anIterable - providing the input locales to choose from, not null. The order of locales in the iterator is not relevant.
Returns:
the preferred locale in the given context, or null. In case of ambiguous matches, the locale that came first in the input iterator will be used.

getPreferredLocale

java.util.Locale getPreferredLocale(java.util.Iterator<java.util.Locale> anIterator)
Returns a preferred locale based on the information the context was created with. The preferred locale is one of the input locales.

Parameters:
anIterator - providing the input locales to choose from, not null.
Returns:
the preferred locale in the given context, or null. In case of ambiguous matches, the locale that came first in the input iterator will be used.

getPreferredLocale

java.util.Locale getPreferredLocale(ListModel<java.util.Locale> aLocaleList)
Returns a preferred locale based on the information the context was created with.

Parameters:
aLocaleList - providing the input locales to choose from, not null
Returns:
the preferred locale in the given context, or null. In case of ambiguous matches, the locale that came first in the input iterator will be used.

getPreferredLocales

java.util.List<java.util.Locale> getPreferredLocales(java.lang.Iterable<java.util.Locale> anIterable)
Returns a read-only list of preferred locales (in descending order) based on the information the context was created with. The preferred locales are taken from the input locales.

Parameters:
anIterable - providing the input locales to choose from, not null. The order of locales in the iterator is not relevant.
Returns:
a list with preferred locales, never null, but may be empty. In case of ambiguous matches, the locale order of the input list is kept.

getPreferredLocales

java.util.List<java.util.Locale> getPreferredLocales(java.util.Iterator<java.util.Locale> anIterator)
Returns a read-only list of preferred locales (in descending order) based on the information the context was created with. The preferred locales are taken from the input locales.

Parameters:
anIterator - providing the input locales to choose from, not null. The order of locales in the iterator is not relevant.
Returns:
a list with preferred locales, never null, but may be empty. In case of ambiguous matches, the locale order of the input list is kept.

getPreferredLocales

java.util.List<java.util.Locale> getPreferredLocales(ListModel<java.util.Locale> aLocaleList)
Returns a read-only list of preferred locales (in descending order) based on the information the context was created with.

Parameters:
aLocaleList - providing the input locales to choose from, not null
Returns:
a list with preferred locales, never null, but may be empty. In case of ambiguous matches, the locale order of the input list is kept.

getPreferredSupportedLocale

java.util.Locale getPreferredSupportedLocale()
Returns a preferred locale based on the information the context was created with. The preferred locale is one of the supported locales

Returns:
the preferred locale in the given context, or null. In case of ambiguous matches, the locale that came first in the input iterator will be used.

getPreferredSupportedLocales

java.util.List<java.util.Locale> getPreferredSupportedLocales()
Returns a read-only list of preferred locales (in descending order) based on the information the context was created with. The preferred locales is the list of supported locales

Returns:
a list with preferred locales, never null, but may be empty. In case of ambiguous matches, the locale order of the supported locales list is kept.

getResourceBundle

java.util.ResourceBundle getResourceBundle(java.lang.String baseName)
Gets a resource bundle using the specified base name based on the information the context was created with. This class uses the class loader of the current thread to load the resource bundle.

Parameters:
baseName - the base name of the resource bundle, a fully qualified class name
Returns:
a resource bundle for the given base name and the default locale
Throws:
java.util.MissingResourceException - if no resource bundle for the specified base name can be found

getResourceBundle

java.util.ResourceBundle getResourceBundle(java.lang.String baseName,
                                           java.lang.ClassLoader loader)
Gets a resource bundle using the specified base name based on the information the context was created with.

Parameters:
baseName - the base name of the resource bundle, a fully qualified class name
loader - the class loader from which to load the resource bundle
Returns:
a resource bundle for the given base name and the default locale
Throws:
java.util.MissingResourceException - if no resource bundle for the specified base name can be found

getSupportedLocales

IterableListModel<java.util.Locale> getSupportedLocales()
Provides easy access ot the list of supported locales

Returns:
a list of the supported locales

getTitle

java.lang.String getTitle(Localized aLocalized)
Returns a fitting title of the given localized instance based on the information the context was created with.

Parameters:
aLocalized - the localized providing the titles to choose from, not null
Returns:
a title string, not null, but may be an empty string