Package org.jdesktop.swingx.renderer
Class LocalizableStringValue
- java.lang.Object
-
- org.jdesktop.swingx.renderer.LocalizableStringValue
-
- All Implemented Interfaces:
Serializable
,StringValue
public class LocalizableStringValue extends Object implements StringValue
A StringValue which looks up localized String representations for objects.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description LocalizableStringValue(Map<Object,String> lookup)
Instantiates a LocaleStringValue which looks up localized String representations for items in the map using the JComponent defaultLocale.LocalizableStringValue(Map<Object,String> lookup, Locale locale)
Instantiates a LocaleStringValue which looks up localized String representations for items in the map using the given Locale.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Locale
getLocale()
Returns the Locale to use for lookup, guaranteed to be not null.String
getString(Object value)
Returns a string representation of the given value.void
setLocale(Locale locale)
Sets the Locale to use for lookup of localized string representation.
-
-
-
Constructor Detail
-
LocalizableStringValue
public LocalizableStringValue(Map<Object,String> lookup)
Instantiates a LocaleStringValue which looks up localized String representations for items in the map using the JComponent defaultLocale.- Parameters:
lookup
- a map containing Entries of objects and a string key to look up its string representation in the UIManager
-
LocalizableStringValue
public LocalizableStringValue(Map<Object,String> lookup, Locale locale)
Instantiates a LocaleStringValue which looks up localized String representations for items in the map using the given Locale.- Parameters:
lookup
- a map containing Entries of objects and a string key to look up its string representation in the UIManagerlocale
- the locale to lookup the localized strings, may be null to denote using JComponent.defaultLocale
-
-
Method Detail
-
getString
public String getString(Object value)
Description copied from interface:StringValue
Returns a string representation of the given value.PENDING JW: forgot - why not null return guaranteed?
- Specified by:
getString
in interfaceStringValue
- Parameters:
value
- the object to present as a string- Returns:
- a string representation of the given value, guaranteed to be not null
-
setLocale
public final void setLocale(Locale locale)
Sets the Locale to use for lookup of localized string representation.- Parameters:
locale
- the locale to lookup the localized strings, may be null to denote using Locale's default.
-
getLocale
public Locale getLocale()
Returns the Locale to use for lookup, guaranteed to be not null. If the initial setting had been null, returns current Locale's default.- Returns:
- the Locale used for lookup.
-
-