public class LocalizableStringValue extends Object implements StringValue
| Constructor and 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.
|
LocalizableStringValue(Map<Object,String> lookup,
String prefix)
Instantiates a LocaleStringValue which looks up localized String
representations for items in the map using the JComponent defaultLocale.
|
LocalizableStringValue(Map<Object,String> lookup,
String prefix,
Locale locale)
Instantiates a LocaleStringValue which looks up localized String
representations for items in the map using the given Locale.
|
| Modifier and Type | Method and Description |
|---|---|
protected String |
getFallbackString(Object value)
Returns the fallback string representation.
|
protected String |
getKey(Object value)
Returns the key for the given value.
|
Locale |
getLocale()
Returns the Locale to use for lookup, guaranteed to be not null.
|
protected String |
getLocalizedString(String key)
Returns the localized value for the given key or null if not
found.
|
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.
|
public LocalizableStringValue(Map<Object,String> lookup)
lookup - a map containing Entries of objects and a string key to
look up its string representation in the UIManagerpublic LocalizableStringValue(Map<Object,String> lookup, Locale locale)
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.defaultLocalepublic LocalizableStringValue(Map<Object,String> lookup, String prefix)
lookup - a map containing Entries of objects and a string key to
look up its string representation in the UIManagerprefix - a common prefix for all string keys in the map, may be null
to denote that the keys should be use as arepublic LocalizableStringValue(Map<Object,String> lookup, String prefix, Locale locale)
lookup - a map containing Entries of objects and a string key to
look up its string representation in the UIManagerprefix - a common prefix for all string keys in the map, may be null
to denote that the keys should be use as arelocale - the locale to lookup the localized strings, may be null to
denote using JComponent.defaultLocalepublic String getString(Object value)
StringValuePENDING JW: forgot - why not null return guaranteed?
getString in interface StringValuevalue - the object to present as a stringprotected String getKey(Object value)
value - the value to find the key forprotected String getFallbackString(Object value)
This implementation returns toString.
value - the object to return a string representation for.protected String getLocalizedString(String key)
This implementation queries the UIManagerExt.
key - the key to search a value forpublic final void setLocale(Locale locale)
locale - the locale to lookup the localized strings, may be null to
denote using Locale's default.public Locale getLocale()
Copyright © 2019. All rights reserved.