Tree PREV CLASS NEXT CLASS SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD com.ibm.portal.model
Interface LocalizedContext
- All Superinterfaces:
- java.lang.Iterable<java.util.Locale>, IterableListModel<java.util.Locale>, ListModel<java.util.Locale>, LocaleCapable
- All Known Subinterfaces:
- PortletLocalizedContext
public interface LocalizedContext- extends IterableListModel<java.util.Locale>, LocaleCapable
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.The computation of the preferred locale will find the best match between the ordered set of locales that LocalizedContext was created on and the locales passed in to the getPreferredLocale[s] method. If exactly one match is found it will be returned. If more than one equivalent matches are found, then they will be returned in the same order as in the input sequence. If no match is found: (a) if the LocalizedContext sequence contains the root locale, then all locales from the input sequence are returned. If (b) the LocalizedContext does not contain the root locale then the empty list will be returned.
- Since:
- 6.1.0
- See Also:
- PortletLocalizedContext, PortalLocalizedContextHome, PortletLocalizedContextHome
Method Summary java.util.Locale getDefaultLocale()
Deprecated. use LocalizedContextHome.getDefaultLocale() insteadjava.lang.String getDescription(Localized aLocalized)
Deprecated. use getLocalizedDescription(Localized) insteadjava.util.Map.Entry<java.util.Locale,? extends java.util.Comparator<? super java.lang.String>> getLocalizedComparator()
Return the comparator based on the current contextjava.util.Map.Entry<java.util.Locale,java.lang.String> getLocalizedDescription(Localized aLocalized)
Return a fitting description of the given localized instance based on the information the context was created with.java.util.Map.Entry<java.util.Locale,java.lang.String> getLocalizedString(java.lang.String key, java.util.ResourceBundle bundle)
Return the localized translation for the string in a resource bundlejava.util.Map.Entry<java.util.Locale,java.lang.String> getLocalizedTitle(Localized aLocalized)
Return a fitting title 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)
Return a preferred locale based on the information the context was created with.java.util.Locale getPreferredLocale(IterableListModel<java.util.Locale> aLocaleList)
Return a preferred locale based on the information the context was created with.java.util.Locale getPreferredLocale(java.util.Iterator<java.util.Locale> anIterator)
Return a preferred locale based on the information the context was created with.java.util.Locale getPreferredLocale(ListModel<java.util.Locale> aLocaleList)
Return 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)
Return 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(IterableListModel<java.util.Locale> aLocaleList)
Return 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)
Return 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)
Return a read-only list of preferred locales (in descending order) based on the information the context was created with.java.util.Locale getPreferredSupportedLocale()
Return a preferred locale based on the information the context was created with.java.util.List<java.util.Locale> getPreferredSupportedLocales()
Return 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()
Deprecated. user LocalizedContextHome.getSupportedLocales() insteadjava.lang.String getTitle(Localized aLocalized)
Deprecated. use getLocalizedTitle(Localized) insteadjava.util.Iterator<java.util.Locale> iterator()
Return an iterator over all locales that this context is based on.
<T extends Localized>
SortedLocalized<? extends T>sort(java.util.Iterator<? extends T> aList)
Sorts a sequence of localized objects.
<T extends Localized>
SortedLocalized<? extends T>sort(java.util.Iterator<? extends T> aList, LocalizedContextHome.ComparatorFactory aCmp)
Sorts a sequence of localized objects.java.util.Locale[] toArray()
Return the ordered list of locales that this context is based on as an array
Method Detail getDefaultLocale
@Deprecated java.util.Locale getDefaultLocale()
- Deprecated. use LocalizedContextHome.getDefaultLocale() instead
- Returns the default locale as defined by portal
- Returns:
- the default locale, not null
getDescription
@Deprecated java.lang.String getDescription(Localized aLocalized)
- Deprecated. use getLocalizedDescription(Localized) instead
- 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
getLocalizedComparator
java.util.Map.Entry<java.util.Locale,? extends java.util.Comparator<? super java.lang.String>> getLocalizedComparator()
- Returns the comparator based on the current context
- Returns:
- the comparator or null if no comparator could be determined
- Since:
- 8.5
getLocalizedDescription
java.util.Map.Entry<java.util.Locale,java.lang.String> getLocalizedDescription(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. Neither key nor value are null, but the value may be an empty string
- Since:
- 6.1.0.3
getLocalizedString
java.util.Map.Entry<java.util.Locale,java.lang.String> getLocalizedString(java.lang.String key, java.util.ResourceBundle bundle)
- Returns the localized translation for the string in a resource bundle
- Parameters:
- key - key in the bundle
- bundle - the bundle
- Returns:
- the localized translation or null if none exists
- Since:
- 8.0
getLocalizedTitle
java.util.Map.Entry<java.util.Locale,java.lang.String> getLocalizedTitle(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. Neither key nor value are null, but the value may be an empty string
- Since:
- 6.1.0.3
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(IterableListModel<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.
- Since:
- 8.0
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(IterableListModel<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.
- Since:
- 8.0
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
@Deprecated IterableListModel<java.util.Locale> getSupportedLocales()
- Deprecated. user LocalizedContextHome.getSupportedLocales() instead
- Provides easy access to the list of supported locales
- Specified by:
- getSupportedLocales in interface LocaleCapable
- Returns:
- a list of the supported locales
getTitle
@Deprecated java.lang.String getTitle(Localized aLocalized)
- Deprecated. use getLocalizedTitle(Localized) instead
- 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
iterator
java.util.Iterator<java.util.Locale> iterator()
- Returns an iterator over all locales that this context is based on. The locales are sorted in their order of importance.
- Specified by:
- iterator in interface java.lang.Iterable<java.util.Locale>
- Specified by:
- iterator in interface IterableListModel<java.util.Locale>
- Specified by:
- iterator in interface ListModel<java.util.Locale>
- Returns:
- The iterator, not null
- Since:
- 6.1.0.3
sort
<T extends Localized> SortedLocalized<? extends T> sort(java.util.Iterator<? extends T> aList)
- Sorts a sequence of localized objects. The objects are organized into locale fall-back groups and each group is ordered by the locale specific collator for each group.
- Parameters:
- aList - the sequence of objects to sort, not null
- Returns:
- the sort result, not null
- Since:
- 8.0
sort
<T extends Localized> SortedLocalized<? extends T> sort(java.util.Iterator<? extends T> aList, LocalizedContextHome.ComparatorFactory aCmp)
- Sorts a sequence of localized objects. The objects are organized into locale fall-back groups and each group is ordered by the locale specific collator for each group.
- Parameters:
- aList - the sequence of objects to sort, not null
- aCmp - the factory that generates comparators per locale, not null
- Returns:
- the sort result, not null
- Since:
- 8.0
- See Also:
- LocalizedContextHome.getDefaultCollators()
toArray
java.util.Locale[] toArray()
- Returns the ordered list of locales that this context is based on as an array
- Returns:
- the list of locales, not null
- Since:
- 6.1.0.3
Tree PREV CLASS NEXT CLASS SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD