Class LocaleComboBox

All Implemented Interfaces:
AttachNotifier, BlurNotifier<ComboBox<Locale>>, DetachNotifier, Focusable<ComboBox<Locale>>, FocusNotifier<ComboBox<Locale>>, HasAriaLabel, HasElement, HasEnabled, HasHelper, HasLabel, HasPlaceholder, HasSize, HasStyle, HasTheme, HasValidation, HasValue<AbstractField.ComponentValueChangeEvent<ComboBox<Locale>,Locale>,Locale>, HasValueAndElement<AbstractField.ComponentValueChangeEvent<ComboBox<Locale>,Locale>,Locale>, HasAllowedCharPattern, HasAutoOpen, HasClearButton, HasClientValidation, HasOverlayClassName, HasPrefix, HasThemeVariant<ComboBoxVariant>, HasTooltip, HasValidationProperties, InputField<AbstractField.ComponentValueChangeEvent<ComboBox<Locale>,Locale>,Locale>, HasValidator<Locale>, HasDataView<Locale,String,ComboBoxDataView<Locale>>, HasLazyDataView<Locale,String,ComboBoxLazyDataView<Locale>>, HasListDataView<Locale,ComboBoxListDataView<Locale>>, Serializable

@NpmPackage(value="flag-icons", version="7.2.3") @CssImport("flag-icons/css/flag-icons.min.css") @CssImport("./styles/locale-combo-box.css") public class LocaleComboBox extends ComboBox<Locale>
Vaadin ComboBox extension that allows to choose between multiple locales.
Author:
Tomas Peiretti / Flowing Code
See Also:
  • Constructor Details

    • LocaleComboBox

      public LocaleComboBox()
      Creates a new instance of LocaleComboBox.
    • LocaleComboBox

      public LocaleComboBox(Collection<Locale> locales)
      Creates a new instance of LocaleComboBox with the desired locales
      Parameters:
      locales - the Collection of Locale to include in the combobox
  • Method Details

    • setDisplayMode

      public void setDisplayMode(LocaleComboBox.DisplayMode displayMode)
      Sets the display mode of the LocaleComboBox.
      Parameters:
      displayMode - the display mode to use
      See Also:
    • setDisplayLocale

      public void setDisplayLocale(Locale displayLocale)
      Sets the locale used for formatting Locale names when LocaleComboBox.DisplayMode.CUSTOM mode is active.

      This locale determines how Locale names are formatted when LocaleComboBox.DisplayMode.CUSTOM is selected as the display mode. If the display mode is any other than LocaleComboBox.DisplayMode.CUSTOM, this setting is ignored.

      Parameters:
      displayLocale - the Locale to use for formatting.
    • hasFlags

      public boolean hasFlags()
      Returns the current flag display status.
      Returns:
      true if flags are displayed alongside the locale names, false otherwise
    • setHasFlags

      public void setHasFlags(boolean hasFlags)
      Sets whether flags should be displayed alongside locale names.

      This method updates the internal state to reflect whether flags should be displayed and updates the rendering based on the new state.

      Parameters:
      hasFlags - A boolean indicating whether flags should be displayed or not.