C - Type of the component.T - Type of value.@Tag(value="component-select") @JsModule(value="./component-select.js") public class ComponentSelect<C extends com.vaadin.flow.component.Component & com.vaadin.flow.component.ClickNotifier<C>,T> extends AbstractComponentSelect<C,T,T,ComponentSelect<C,T>> implements WithNullValueOptionallyAllowedMixin<ComponentSelect<C,T>,com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<T>,T>,T>
ClickNotifiers.com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<C extends com.vaadin.flow.component.Component,V>com.vaadin.flow.component.HasValue.ValueChangeEvent<V>, com.vaadin.flow.component.HasValue.ValueChangeListener<E extends com.vaadin.flow.component.HasValue.ValueChangeEvent<?>>NO_SELECTIONLABEL_POSITION_ATTRIBUTE, LABEL_POSITION_DETAILS_ATTRIBUTEHELPER_ABOVE_THEME_VARIANT| Constructor and Description |
|---|
ComponentSelect(Supplier<L> layoutSupplier,
com.vaadin.flow.function.SerializableBiFunction<Integer,T,C> componentFactory,
com.vaadin.flow.function.SerializableBiConsumer<Integer,C> selectionModifier,
com.vaadin.flow.function.SerializableBiConsumer<Integer,C> deselectionModifier,
T... options)
Creates the select with given options.
|
ComponentSelect(Supplier<L> layoutSupplier,
com.vaadin.flow.function.SerializableBiFunction<Integer,T,C> componentFactory,
T... options)
Creates the select with given options, but without any action to perform on selection and deselection.
|
| Modifier and Type | Method and Description |
|---|---|
protected T |
generateModelValue() |
int |
getSelectedIndex()
Returns the index of the currently selected component.
|
boolean |
isNullValueAllowed()
Checks whether
null is allowed as a value of the component. |
boolean |
isSelected()
Checks if any component is selected.
|
protected boolean |
isSelected(int index)
Checks if the item at the given index is currently selected.
|
protected boolean |
itemClicked(int index)
Clicks an item at the given index.
|
void |
setNullValueAllowed(boolean allowingNullValue)
Sets allowance of
null as this component's value. |
protected void |
setPresentationValue(T t) |
void |
setSelectedIndex(int index)
Sets selection index.
|
deselect, ensureValidIndex, focus, getComponentDeselectedAction, getComponentFactory, getComponentIndex, getComponentSelectedAction, getOptions, noOp, rebuildComponents, select, setComponentDeselectedAction, setComponentFactory, setComponentSelectedAction, setItems, withComponentDeselectedAction, withComponentFactory, withComponentSelectedActionadd, getErrorMessage, getLabel, isInvalid, remove, setErrorMessage, setInvalid, setLabel, updateValueaddValueChangeListener, getEmptyValue, getValue, isEmpty, setModelValue, setValue, valueEqualsaddListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, set, setElement, setId, setVisibleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitwithNullValueAllowed, withNullValueAllowed, withoutNullValueAllowedaddValueChangeListener, clear, getEmptyValue, getOptionalValue, getValue, isEmpty, isReadOnly, isRequiredIndicatorVisible, setReadOnly, setRequiredIndicatorVisible, setValueaddClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNamewithItems, withItems, withItemswithIdwithLabelwithLabelPositiongetLabelPosition, setLabelPositionwithHelperComponent, withHelperTextgetHelperComponent, getHelperText, setHelperComponent, setHelperTextwithHelperAbove, withHelperAbove, withHelperBelowisHelperAbove, setHelperAbove, setHelperAbove, setHelperBelowwithValuegetCssSize, getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFulladdFocusShortcut, blur, getTabIndex, setTabIndex@SafeVarargs public ComponentSelect(Supplier<L> layoutSupplier, com.vaadin.flow.function.SerializableBiFunction<Integer,T,C> componentFactory, T... options)
L - Layout type.layoutSupplier - Provides layout for the component.componentFactory - A function that creates components for the options.options - Items to select from.@SafeVarargs public ComponentSelect(Supplier<L> layoutSupplier, com.vaadin.flow.function.SerializableBiFunction<Integer,T,C> componentFactory, com.vaadin.flow.function.SerializableBiConsumer<Integer,C> selectionModifier, com.vaadin.flow.function.SerializableBiConsumer<Integer,C> deselectionModifier, T... options)
L - Layout type.layoutSupplier - Provides layout for the component.componentFactory - A function that creates components for the options.selectionModifier - Action to perform on a component when it is selected.deselectionModifier - Action to perform on a component when it is deselected.options - Items to select from.public boolean isSelected()
getSelectedIndex() is different from AbstractComponentSelect.NO_SELECTION.protected boolean isSelected(int index)
AbstractComponentSelectisSelected in class AbstractComponentSelect<C extends com.vaadin.flow.component.Component & com.vaadin.flow.component.ClickNotifier<C>,T,T,ComponentSelect<C extends com.vaadin.flow.component.Component & com.vaadin.flow.component.ClickNotifier<C>,T>>index - Index of an item.true when the item is selected, false otherwise.protected boolean itemClicked(int index)
AbstractComponentSelectitemClicked in class AbstractComponentSelect<C extends com.vaadin.flow.component.Component & com.vaadin.flow.component.ClickNotifier<C>,T,T,ComponentSelect<C extends com.vaadin.flow.component.Component & com.vaadin.flow.component.ClickNotifier<C>,T>>index - Index of an item to be clicked.public void setSelectedIndex(int index)
AbstractComponentSelect.NO_SELECTION, nothing will happen.index - New index.public int getSelectedIndex()
AbstractComponentSelect.NO_SELECTION.protected T generateModelValue()
generateModelValue in class com.vaadin.flow.component.customfield.CustomField<T>protected void setPresentationValue(T t)
setPresentationValue in class com.vaadin.flow.component.customfield.CustomField<T>public boolean isNullValueAllowed()
HasNullValueOptionallyAllowednull is allowed as a value of the component.isNullValueAllowed in interface HasNullValueOptionallyAllowed<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<T>,T>,T>null is allowed as a value. Should default to false.public void setNullValueAllowed(boolean allowingNullValue)
HasNullValueOptionallyAllowednull as this component's value.setNullValueAllowed in interface HasNullValueOptionallyAllowed<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<T>,T>,T>allowingNullValue - Whether to allow null as a value.Copyright © 2023 Miki. All rights reserved.