|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.alee.managers.language.LanguageManager
public final class LanguageManager
This manager allows you to quickly setup changeable lanugage onto different components and to listen to application-wide language change events. Language could be either loaded from structured xml files or added directly from the application by adding Dictionary type objects into this manager.
Be aware of the fact that all equal key-language pairs will be merged and collected into a global data map. The original list of dictionaries will be preserved and will not be modified, but all translation will be taken from global data map.
Field Summary | |
---|---|
static java.lang.String |
DEFAULT
Default WebLaF language. |
static javax.swing.ImageIcon |
other
Unknown language icon. |
Fields inherited from interface com.alee.managers.language.LanguageConstants |
---|
ARABIC, ENGLISH, FRENCH, GERMAN, POLISH, PORTUGUESE, RUSSIAN, SPANISH |
Constructor Summary | |
---|---|
LanguageManager()
|
Method Summary | |
---|---|
static Dictionary |
addDictionary(java.lang.Class nearClass,
java.lang.String resource)
Adds new language dictionary into LanguageManager. |
static Dictionary |
addDictionary(Dictionary dictionary)
Adds new language dictionary into LanguageManager. |
static Dictionary |
addDictionary(java.io.File file)
Adds new language dictionary into LanguageManager. |
static Dictionary |
addDictionary(java.lang.String path)
Adds new language dictionary into LanguageManager. |
static Dictionary |
addDictionary(java.net.URL url)
Adds new language dictionary into LanguageManager. |
static void |
addLanguageKeyListener(java.lang.String key,
LanguageKeyListener listener)
|
static void |
addLanguageListener(LanguageListener listener)
|
static void |
addSupportedLanguage(java.lang.String language)
|
static void |
addSupportedLanguage(java.lang.String language,
Dictionary dictionary)
|
static void |
changeOrientation()
|
static void |
clearDictionaries()
Removes all added dictionaries including WebLaF ones. |
static void |
clearSupportedLanguages()
|
static java.lang.String |
combineWithContainerKeys(java.awt.Component component,
java.lang.String key)
Language container methods |
static java.lang.String |
get(java.awt.Component component,
java.lang.String key)
Component value request methods |
static java.lang.String |
get(java.lang.String key)
Value request methods |
static java.lang.String |
getComponentKey(java.awt.Component component)
|
static java.lang.String |
getDefaultLanguageKey()
Default system language key |
static TooltipType |
getDefaultTooltipType()
Default tooltip type |
static java.util.List<Dictionary> |
getDictionaries()
Loaded dictionaries |
static Dictionary |
getDictionary(java.lang.String id)
Returns dictionary for the specified ID or null if it was not found. |
static Dictionary |
getGlobalDictionary()
Global dictionary that aggregates all added dictionaries, records and values |
static java.lang.String |
getLanguage()
Language methods |
static java.lang.String |
getLanguageContainerKey(java.awt.Container container)
|
static javax.swing.ImageIcon |
getLanguageIcon(java.lang.String language)
Language icon |
static java.util.Map<java.lang.String,java.util.List<LanguageKeyListener>> |
getLanguageKeyListeners()
Language key listeners operations |
static java.util.List<LanguageListener> |
getLanguageListeners()
Language listeners operations |
static LanguageUpdater |
getLanguageUpdater(java.awt.Component component)
|
static java.lang.Character |
getMnemonic(java.awt.Component component,
java.lang.String key)
|
static java.lang.Character |
getMnemonic(java.lang.String key)
|
static Value |
getNotNullValue(java.awt.Component component,
java.lang.String key)
|
static Value |
getNotNullValue(java.awt.Component component,
java.lang.String key,
java.lang.String additionalKey)
|
static Value |
getNotNullValue(java.lang.String key)
|
static java.awt.ComponentOrientation |
getOppositeOrientation()
Returns orientation opposite to current global component orientation. |
static java.awt.ComponentOrientation |
getOrientation()
|
static java.util.List<java.lang.String> |
getSupportedLanguages()
Supported languages |
static java.util.List<java.lang.String> |
getSupportedLanguages(Dictionary dictionary)
Returns list of languages supported by the specified dictionary. |
static java.util.List<java.lang.String> |
getSupportedLanguages(java.lang.String dictionaryId)
Returns list of languages supported by the dictionary with the specified ID. |
static java.lang.String |
getSystemLanguageKey()
|
static Value |
getValue(java.awt.Component component,
java.lang.String key)
|
static Value |
getValue(java.awt.Component component,
java.lang.String key,
java.lang.String additionalKey)
|
static Value |
getValue(java.lang.String key)
|
static void |
initialize()
Initializes LanguageManager settings. |
static boolean |
isCurrentLanguage(java.lang.String language)
|
static boolean |
isDictionaryAdded(Dictionary dictionary)
Returns whether specified dictionary is added or not. |
static boolean |
isDictionaryAdded(java.lang.String id)
Returns whether dictionary with the specified ID is added or not. |
static boolean |
isLeftToRight()
Global default orientation |
static boolean |
isRegisteredComponent(java.awt.Component component)
|
static void |
loadDefaultDictionary()
Loads default WebLaF dictionary. |
static Dictionary |
loadDictionary(java.lang.Class nearClass,
java.lang.String resource)
Loads dictionary from xml |
static Dictionary |
loadDictionary(java.io.File file)
|
static Dictionary |
loadDictionary(java.lang.String path)
|
static Dictionary |
loadDictionary(java.net.URL url)
|
static void |
registerComponent(java.awt.Component component,
java.lang.String key,
java.lang.Object... data)
Components registration |
static void |
registerLanguageContainer(java.awt.Container container,
java.lang.String key)
|
static void |
registerLanguageUpdater(java.awt.Component component,
LanguageUpdater updater)
|
static void |
registerLanguageUpdater(LanguageUpdater updater)
Components language updaters registration |
static Dictionary |
removeDictionary(Dictionary dictionary)
Removes dictionary from LanguageManager. |
static Dictionary |
removeDictionary(java.lang.String id)
Removes dictionary from LanguageManager. |
static void |
removeLanguageKeyListener(LanguageKeyListener listener)
|
static void |
removeLanguageKeyListeners(java.lang.String key)
|
static void |
removeLanguageListener(LanguageListener listener)
|
static void |
removeSupportedLanguage(java.lang.String language)
|
static void |
setDefaultTooltipType(TooltipType defaultTooltipType)
|
static void |
setLanguage(java.lang.String language)
|
static javax.swing.ImageIcon |
setLanguageIcon(java.lang.String language,
javax.swing.ImageIcon icon)
Sets icon for the specified language. |
static void |
setOrientation(boolean leftToRight)
|
static void |
setOrientation(java.awt.ComponentOrientation orientation)
|
static void |
setSupportedLanguages(java.util.Collection<java.lang.String> supportedLanguages)
|
static void |
setSupportedLanguages(java.lang.String... supportedLanguages)
|
static void |
unregisterComponent(java.awt.Component component)
|
static void |
unregisterLanguageContainer(java.awt.Container container)
|
static void |
unregisterLanguageUpdater(java.awt.Component component)
|
static void |
unregisterLanguageUpdater(LanguageUpdater updater)
|
static void |
updateAllComponents()
Components language update methods |
static void |
updateAllComponents(java.util.List<java.lang.String> keys)
|
static void |
updateComponent(java.awt.Component component,
java.lang.Object... data)
|
static void |
updateComponent(java.awt.Component component,
java.lang.String key,
java.lang.Object... data)
|
static void |
updateComponentsTree(java.awt.Component component)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final javax.swing.ImageIcon other
public static java.lang.String DEFAULT
Constructor Detail |
---|
public LanguageManager()
Method Detail |
---|
public static void initialize()
public static void loadDefaultDictionary()
public static java.util.List<java.lang.String> getSupportedLanguages()
public static void setSupportedLanguages(java.util.Collection<java.lang.String> supportedLanguages)
public static void setSupportedLanguages(java.lang.String... supportedLanguages)
public static void addSupportedLanguage(java.lang.String language)
public static void addSupportedLanguage(java.lang.String language, Dictionary dictionary)
public static void removeSupportedLanguage(java.lang.String language)
public static void clearSupportedLanguages()
public static void registerComponent(java.awt.Component component, java.lang.String key, java.lang.Object... data)
public static void updateComponentsTree(java.awt.Component component)
public static void unregisterComponent(java.awt.Component component)
public static boolean isRegisteredComponent(java.awt.Component component)
public static java.lang.String getComponentKey(java.awt.Component component)
public static void registerLanguageUpdater(LanguageUpdater updater)
public static void unregisterLanguageUpdater(LanguageUpdater updater)
public static void registerLanguageUpdater(java.awt.Component component, LanguageUpdater updater)
public static void unregisterLanguageUpdater(java.awt.Component component)
public static LanguageUpdater getLanguageUpdater(java.awt.Component component)
public static void updateAllComponents()
public static void updateAllComponents(java.util.List<java.lang.String> keys)
public static void updateComponent(java.awt.Component component, java.lang.Object... data)
public static void updateComponent(java.awt.Component component, java.lang.String key, java.lang.Object... data)
public static javax.swing.ImageIcon getLanguageIcon(java.lang.String language)
public static javax.swing.ImageIcon setLanguageIcon(java.lang.String language, javax.swing.ImageIcon icon)
language
- language to set icon foricon
- language icon
public static TooltipType getDefaultTooltipType()
public static void setDefaultTooltipType(TooltipType defaultTooltipType)
public static java.lang.String getLanguage()
public static boolean isCurrentLanguage(java.lang.String language)
public static void setLanguage(java.lang.String language)
public static boolean isLeftToRight()
public static java.awt.ComponentOrientation getOrientation()
public static java.awt.ComponentOrientation getOppositeOrientation()
public static void setOrientation(boolean leftToRight)
public static void setOrientation(java.awt.ComponentOrientation orientation)
public static void changeOrientation()
public static Dictionary getGlobalDictionary()
public static java.util.List<Dictionary> getDictionaries()
public static Dictionary loadDictionary(java.lang.Class nearClass, java.lang.String resource)
public static Dictionary loadDictionary(java.net.URL url)
public static Dictionary loadDictionary(java.lang.String path)
public static Dictionary loadDictionary(java.io.File file)
public static Dictionary addDictionary(java.lang.Class nearClass, java.lang.String resource)
nearClass
- class to look near for the dictionary fileresource
- path to dictionary file
public static Dictionary addDictionary(java.net.URL url)
url
- dictionary file url
public static Dictionary addDictionary(java.lang.String path)
path
- path to dictionary file
public static Dictionary addDictionary(java.io.File file)
file
- dictionary file
public static Dictionary addDictionary(Dictionary dictionary)
dictionary
- dictionary to add
public static Dictionary removeDictionary(java.lang.String id)
id
- ID of the dictionary to remove
public static Dictionary removeDictionary(Dictionary dictionary)
dictionary
- dictionary to remove
public static boolean isDictionaryAdded(Dictionary dictionary)
dictionary
- dictionary to look for
public static boolean isDictionaryAdded(java.lang.String id)
id
- ID of the dictionary to look for
public static Dictionary getDictionary(java.lang.String id)
id
- ID of the dictionary to look for
public static void clearDictionaries()
loadDefaultDictionary()
public static java.util.List<java.lang.String> getSupportedLanguages(java.lang.String dictionaryId)
dictionaryId
- dictionary ID
public static java.util.List<java.lang.String> getSupportedLanguages(Dictionary dictionary)
dictionary
- dictionary
public static java.lang.String get(java.lang.String key)
public static java.lang.Character getMnemonic(java.lang.String key)
public static Value getValue(java.lang.String key)
public static Value getNotNullValue(java.lang.String key)
public static java.lang.String get(java.awt.Component component, java.lang.String key)
public static java.lang.Character getMnemonic(java.awt.Component component, java.lang.String key)
public static Value getValue(java.awt.Component component, java.lang.String key)
public static Value getNotNullValue(java.awt.Component component, java.lang.String key)
public static Value getValue(java.awt.Component component, java.lang.String key, java.lang.String additionalKey)
public static Value getNotNullValue(java.awt.Component component, java.lang.String key, java.lang.String additionalKey)
public static java.lang.String combineWithContainerKeys(java.awt.Component component, java.lang.String key)
public static void registerLanguageContainer(java.awt.Container container, java.lang.String key)
public static void unregisterLanguageContainer(java.awt.Container container)
public static java.lang.String getLanguageContainerKey(java.awt.Container container)
public static java.lang.String getDefaultLanguageKey()
public static java.lang.String getSystemLanguageKey()
public static java.util.List<LanguageListener> getLanguageListeners()
public static void addLanguageListener(LanguageListener listener)
public static void removeLanguageListener(LanguageListener listener)
public static java.util.Map<java.lang.String,java.util.List<LanguageKeyListener>> getLanguageKeyListeners()
public static void addLanguageKeyListener(java.lang.String key, LanguageKeyListener listener)
public static void removeLanguageKeyListener(LanguageKeyListener listener)
public static void removeLanguageKeyListeners(java.lang.String key)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |