jbpm-form-modeler-common 1.0-SNAPSHOT

org.jbpm.formModeler.service.bb.commons.config
Class LocaleManager

java.lang.Object
  extended by org.jbpm.formModeler.service.bb.commons.config.componentsFactory.BasicFactoryElement
      extended by org.jbpm.formModeler.service.bb.commons.config.LocaleManager
All Implemented Interfaces:
Serializable, FactoryLifecycle

public class LocaleManager
extends BasicFactoryElement

Manager that holds the list of languages supported.

See Also:
Serialized Form

Constructor Summary
LocaleManager()
           
 
Method Summary
static String currentLang()
          Static getter for current lang.
static Locale currentLocale()
          Static getter for current Locale.
 Locale[] geLocales()
          Locales supported by the formModeler service
 String[] getAllLanguages()
          Get all language identifiers
 Locale[] getAllLocales()
          Locales supported by the VM
 String getCurrentEditLang()
          Get the language in which the system is editing contents.
 Locale getCurrentEditLocale()
          Current locale for editing contents
 String getCurrentLang()
          Get the current language for displaying contents
 Locale getCurrentLocale()
          Current locale for viewing contents
 String getDefaultLang()
          Get the default language for the platform
 Locale getDefaultLocale()
          Default locale for the application
 String getDefaultLocaleId()
          The default localeId for the platform installation
 String[] getInstalledLocaleIds()
          The list of locales supported.
 String[] getLangs()
          Langs supported by the formModeler service
 Locale getLocaleById(String localeId)
          Get a Locale by its id.
 String[] getPlatformAvailableLangs()
          Langs supported by the formModeler service
 Locale[] getPlatformAvailableLocales()
          Locales supported by the formModeler service
protected  String[] localeToString(Locale[] locales)
           
 Object localize(Map localizedData)
          Given a map of locale->value or language->value, it returns the appropiate value for the current locale.
static LocaleManager lookup()
           
 void setCurrentEditLang(String langId)
          Set the language in which the system is editing contents.
 void setCurrentEditLocale(Locale currentEditLocale)
           
 void setCurrentLang(String langId)
          Set the current language for displaying contents
 void setCurrentLocale(Locale currentLocale)
           
 void setDefaultLocaleId(String defaultLocale)
          The default localeId for the platform installation
 void setInstalledLocaleIds(String[] installedLocales)
          The list of locales supported.
 
Methods inherited from class org.jbpm.formModeler.service.bb.commons.config.componentsFactory.BasicFactoryElement
addPeriodicTask, addPeriodicTask, factoryLookup, getComponentAlias, getComponentDescription, getComponentName, getComponentScope, init, setComponentAlias, shutdown, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocaleManager

public LocaleManager()
Method Detail

lookup

public static LocaleManager lookup()

getInstalledLocaleIds

public String[] getInstalledLocaleIds()
The list of locales supported. return The list of locales supported.


setInstalledLocaleIds

public void setInstalledLocaleIds(String[] installedLocales)
The list of locales supported.

Parameters:
installedLocales - The list of locales supported.

getDefaultLocaleId

public String getDefaultLocaleId()
The default localeId for the platform installation

Returns:
The default localeId for the platform installation

setDefaultLocaleId

public void setDefaultLocaleId(String defaultLocale)
The default localeId for the platform installation

Parameters:
defaultLocale - The default localeId for the platform installation

getLocaleById

public Locale getLocaleById(String localeId)
Get a Locale by its id.

Parameters:
localeId -
Returns:
a Locale whose toString() equals given localeId, or null if it doesn't exist

getAllLocales

public Locale[] getAllLocales()
Locales supported by the VM

Returns:
Locales supported by the VM

getPlatformAvailableLocales

public Locale[] getPlatformAvailableLocales()
Locales supported by the formModeler service

Returns:
Locales supported by the formModeler service

geLocales

public Locale[] geLocales()
Locales supported by the formModeler service

Returns:
Locales supported by the formModeler service

getCurrentEditLocale

public Locale getCurrentEditLocale()
Current locale for editing contents

Returns:
Current locale for editing contents

setCurrentEditLocale

public void setCurrentEditLocale(Locale currentEditLocale)

getCurrentLocale

public Locale getCurrentLocale()
Current locale for viewing contents

Returns:
Current locale for viewing contents

setCurrentLocale

public void setCurrentLocale(Locale currentLocale)

getDefaultLocale

public Locale getDefaultLocale()
Default locale for the application

Returns:
Default locale for the application

localeToString

protected String[] localeToString(Locale[] locales)

getAllLanguages

public String[] getAllLanguages()
Get all language identifiers


getPlatformAvailableLangs

public String[] getPlatformAvailableLangs()
Langs supported by the formModeler service

Returns:
Langs supported by the formModeler service

getLangs

public String[] getLangs()
Langs supported by the formModeler service

Returns:
Langs supported by the formModeler service

getCurrentEditLang

public String getCurrentEditLang()
Get the language in which the system is editing contents.

Returns:
the language in which the system is editing contents.

setCurrentEditLang

public void setCurrentEditLang(String langId)
Set the language in which the system is editing contents.

Parameters:
langId - the language in which the system is editing contents.

getCurrentLang

public String getCurrentLang()
Get the current language for displaying contents

Returns:
the current language for displaying contents

setCurrentLang

public void setCurrentLang(String langId)
Set the current language for displaying contents

Parameters:
langId - the current language for displaying contents

getDefaultLang

public String getDefaultLang()
Get the default language for the platform

Returns:
the default language for the platform

localize

public Object localize(Map localizedData)
Given a map of locale->value or language->value, it returns the appropiate value for the current locale. If such value doesn't exist, it uses the default locale.

Parameters:
localizedData -
Returns:
appropiate value for given locale.

currentLocale

public static Locale currentLocale()
Static getter for current Locale. Shortcut for

LocaleManager lManager = (LocaleManager) Factory.lookup("org.jbpm.formModeler.service.LocaleManager");
return lManager.getCurrentLocale();

Returns:
current locale looked up from factory

currentLang

public static String currentLang()
Static getter for current lang. Shortcut for

LocaleManager lManager = (LocaleManager) Factory.lookup("org.jbpm.formModeler.service.LocaleManager");
return lManager.getCurrentLang();

Returns:
current lang looked up from factory

jbpm-form-modeler-common 1.0-SNAPSHOT

Copyright © 2001-2013 JBoss by Red Hat. All Rights Reserved.