Class LocaleComboBox
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.AbstractField<C,T>
com.vaadin.flow.component.AbstractSinglePropertyField<TComponent,TValue>
com.vaadin.flow.component.combobox.ComboBoxBase<ComboBox<T>,T,T>
com.vaadin.flow.component.combobox.ComboBox<Locale>
com.flowingcode.vaadin.addons.localecombobox.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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumRepresents the built-in display modes for locale names in theLocaleComboBoxcomponent.Nested classes/interfaces inherited from class com.vaadin.flow.component.combobox.ComboBox
ComboBox.FetchItemsCallback<T extends Object>, ComboBox.ItemFilter<T extends Object>Nested classes/interfaces inherited from class com.vaadin.flow.component.combobox.ComboBoxBase
ComboBoxBase.CustomValueSetEvent<TComponent extends ComboBoxBase<TComponent,?, ?>> Nested classes/interfaces inherited from class com.vaadin.flow.component.AbstractField
AbstractField.ComponentValueChangeEvent<C extends Component,V extends Object> Nested classes/interfaces inherited from interface com.vaadin.flow.component.BlurNotifier
BlurNotifier.BlurEvent<C extends Component>Nested classes/interfaces inherited from interface com.vaadin.flow.component.FocusNotifier
FocusNotifier.FocusEvent<C extends Component>Nested classes/interfaces inherited from interface com.vaadin.flow.component.shared.HasClientValidation
HasClientValidation.ClientValidatedEventNested classes/interfaces inherited from interface com.vaadin.flow.component.HasValue
HasValue.ValueChangeEvent<V extends Object>, HasValue.ValueChangeListener<E extends HasValue.ValueChangeEvent<?>> -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance ofLocaleComboBox.LocaleComboBox(Collection<Locale> locales) Creates a new instance ofLocaleComboBoxwith the desired locales -
Method Summary
Modifier and TypeMethodDescriptionbooleanhasFlags()Returns the current flag display status.voidsetDisplayLocale(Locale displayLocale) Sets the locale used for formatting Locale names whenLocaleComboBox.DisplayMode.CUSTOMmode is active.voidsetDisplayMode(LocaleComboBox.DisplayMode displayMode) Sets the display mode of the LocaleComboBox.voidsetHasFlags(boolean hasFlags) Sets whether flags should be displayed alongside locale names.Methods inherited from class com.vaadin.flow.component.combobox.ComboBox
getEmptyValue, getPattern, isSelected, refreshValue, setOverlayWidth, setOverlayWidth, setPatternMethods inherited from class com.vaadin.flow.component.combobox.ComboBoxBase
addCustomValueSetListener, generateLabel, getAriaLabel, getAriaLabelledBy, getDataCommunicator, getDataController, getDataGenerator, getDataProvider, getFilter, getGenericDataView, getItemLabelGenerator, getKeyMapper, getLazyDataView, getListDataView, getPageSize, getRenderManager, isAllowCustomValue, isAutofocus, isOpened, isRequired, onAttach, onDetach, runBeforeClientResponse, setAllowCustomValue, setAriaLabel, setAriaLabelledBy, setAutofocus, setDataProvider, setDataProvider, setFilter, setItemLabelGenerator, setItems, setItems, setItems, setItems, setItems, setItems, setItems, setItems, setItems, setItems, setItems, setItemsWithFilterConverter, setItemsWithFilterConverter, setManualValidation, setOpened, setPageSize, setRenderer, setRequired, setValue, validateMethods inherited from class com.vaadin.flow.component.AbstractSinglePropertyField
getSynchronizationRegistration, hasValidValue, setPresentationValue, setSynchronizedEventMethods inherited from class com.vaadin.flow.component.AbstractField
addValueChangeListener, getValue, isEmpty, setModelValue, valueEqualsMethods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.BlurNotifier
addBlurListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.Focusable
addFocusShortcut, blur, focus, getTabIndex, setTabIndexMethods inherited from interface com.vaadin.flow.component.FocusNotifier
addFocusListenerMethods inherited from interface com.vaadin.flow.component.shared.HasAllowedCharPattern
getAllowedCharPattern, setAllowedCharPatternMethods inherited from interface com.vaadin.flow.component.shared.HasAutoOpen
isAutoOpen, setAutoOpenMethods inherited from interface com.vaadin.flow.component.shared.HasClearButton
isClearButtonVisible, setClearButtonVisibleMethods inherited from interface com.vaadin.flow.component.shared.HasClientValidation
addClientValidatedEventListenerMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.component.HasHelper
getHelperComponent, getHelperText, setHelperComponent, setHelperTextMethods inherited from interface com.vaadin.flow.data.provider.HasListDataView
setItemsMethods inherited from interface com.vaadin.flow.component.shared.HasOverlayClassName
getOverlayClassName, setOverlayClassNameMethods inherited from interface com.vaadin.flow.component.HasPlaceholder
getPlaceholder, setPlaceholderMethods inherited from interface com.vaadin.flow.component.shared.HasPrefix
getPrefixComponent, setPrefixComponentMethods inherited from interface com.vaadin.flow.component.HasSize
getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeNameMethods inherited from interface com.vaadin.flow.component.shared.HasThemeVariant
addThemeVariants, removeThemeVariantsMethods inherited from interface com.vaadin.flow.component.shared.HasTooltip
getTooltip, setTooltipTextMethods inherited from interface com.vaadin.flow.component.shared.HasValidationProperties
getErrorMessage, isInvalid, setErrorMessage, setInvalidMethods inherited from interface com.vaadin.flow.data.binder.HasValidator
addValidationStatusChangeListener, getDefaultValidatorMethods inherited from interface com.vaadin.flow.component.HasValue
addValueChangeListener, clear, getOptionalValue, getValue, isEmptyMethods inherited from interface com.vaadin.flow.component.HasValueAndElement
isReadOnly, isRequiredIndicatorVisible, setReadOnly, setRequiredIndicatorVisible
-
Constructor Details
-
LocaleComboBox
public LocaleComboBox()Creates a new instance ofLocaleComboBox. -
LocaleComboBox
Creates a new instance ofLocaleComboBoxwith the desired locales- Parameters:
locales- theCollectionofLocaleto include in the combobox
-
-
Method Details
-
setDisplayMode
Sets the display mode of the LocaleComboBox.- Parameters:
displayMode- the display mode to use- See Also:
-
setDisplayLocale
Sets the locale used for formatting Locale names whenLocaleComboBox.DisplayMode.CUSTOMmode is active.This locale determines how Locale names are formatted when
LocaleComboBox.DisplayMode.CUSTOMis selected as the display mode. If the display mode is any other thanLocaleComboBox.DisplayMode.CUSTOM, this setting is ignored.- Parameters:
displayLocale- theLocaleto use for formatting.
-
hasFlags
public boolean hasFlags()Returns the current flag display status.- Returns:
trueif flags are displayed alongside the locale names,falseotherwise
-
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- Abooleanindicating whether flags should be displayed or not.
-