Class LocaleService

  • All Implemented Interfaces:
    Serializable

    public class LocaleService
    extends Object
    implements Serializable
    Server side service which handles locale and the transmission of locale date to the client side LocaleService.
    Since:
    7.1
    Author:
    Vaadin Ltd
    See Also:
    Serialized Form
    • Constructor Detail

      • LocaleService

        public LocaleService​(UI ui,
                             UIState.LocaleServiceState state)
        Creates a LocaleService bound to the given UI.
        Parameters:
        ui - The UI which owns the LocaleService
        Since:
        7.1
    • Method Detail

      • getUI

        public UI getUI()
        Retrieves the UI this service is bound to.
        Returns:
        the UI for this service
        Since:
        7.1
      • addLocale

        public void addLocale​(Locale locale)
        Adds a locale to be sent to the client (browser) for date and time entry etc. All locale specific information is derived from server-side Locale instances and sent to the client when needed, eliminating the need to use the Locale class and all the framework behind it on the client.
        Parameters:
        locale - The locale which is required on the client side
      • createLocaleData

        protected UIState.LocaleData createLocaleData​(Locale locale)
        Creates a LocaleData instance for transportation to the client.
        Parameters:
        locale - The locale for which to create a LocaleData object
        Returns:
        A LocaleData object with information about the given locale
        Since:
        7.1