T - The type of the field valueV - The type of the single option valueS - The type of the field extending from this classpublic abstract class AbstractSelect<T,V,S extends AbstractSelect<T,V,S>> extends AbstractValueBox<S,elemental2.dom.HTMLElement,T>
| Modifier and Type | Class and Description |
|---|---|
static interface |
AbstractSelect.CloseMenuHandler<V>
A function for implementing logic that will be executed whenever the select dropdown is closed
|
static class |
AbstractSelect.DropDownPositionDown
A
DropDownPosition that opens the select dropdown menu always down |
static class |
AbstractSelect.DropDownPositionUp
A
DropDownPosition that opens the select dropdown menu always up |
static interface |
AbstractSelect.OnAddOptionHandler<V>
A function for implementing logic to be executed when a new option is added on the fly using
the
setCreatable(boolean) feature |
static interface |
AbstractSelect.OptionRenderer<T>
An interface for rendering the
SelectOption |
static class |
AbstractSelect.PopupPositionTopDown<T,V,S extends AbstractSelect<T,V,S>>
A
DropDownPosition that opens the select dropdown menu up or down based on the largest
space available, the menu will show where the is more space |
static interface |
AbstractSelect.SelectionHandler<V>
A function to implement logic that will be called when the user change the selection in the
select
|
ValueBox.AutoValidate, ValueBox.AutoValidatorBasicFormElement.FieldHandler<T>BaseDominoElement.ElementHandler<T>, BaseDominoElement.ResizeHandler<T>, BaseDominoElement.StyleEditor<E extends elemental2.dom.HTMLElement,T extends org.jboss.elemento.IsElement<E>>, BaseDominoElement.WavesStylerHasChangeHandlers.ChangeHandler<V>HasValidation.Validator| Modifier and Type | Field and Description |
|---|---|
protected DominoElement<elemental2.dom.HTMLElement> |
buttonValueContainer |
protected SelectOption<V> |
noneOption |
protected LinkedList<SelectOption<V>> |
options |
protected DominoElement<elemental2.dom.HTMLElement> |
valuesContainer |
changeHandlers, changeListener, DISABLED, fieldContainer, fieldGroup, FLOATING, FOCUSED, inputContainer, inputListenerelement| Constructor and Description |
|---|
AbstractSelect()
Creates an empty select
|
AbstractSelect(List<SelectOption<V>> options)
Ceate a select with empty label and a list of initial options
|
AbstractSelect(String label)
Create an empty select with a lable
|
AbstractSelect(String label,
List<SelectOption<V>> options)
Create a select field with a label and an initial options list
|
| Modifier and Type | Method and Description |
|---|---|
S |
addGroup(SelectOptionGroup<V> group)
Adds a select options group to the dropdown menu
|
S |
addOptions(List<SelectOption<V>> options)
Adds a List of options to the select dropdown menu
|
S |
addSelectionHandler(AbstractSelect.SelectionHandler<V> selectionHandler) |
S |
appendChild(SelectOption<V> option)
Adds an option to the select dropdown menu
|
S |
appendChild(SelectOption<V> option,
Consumer<DropdownAction<SelectOption<V>>> andThen) |
S |
clear(boolean silent)
Clears the field value and only triggers the change handlers if silent flag is true
|
S |
close()
Closes the select dropdown menu
|
static void |
closeAllSelects()
closes all currently opened selects dropdown menus
|
S |
closeMenu(AbstractSelect.CloseMenuHandler closeMenuHandler)
Closes the dropdown menu and call the handler
|
boolean |
containsKey(String key)
Check if the select has an option with the specified key
|
boolean |
containsValue(V value)
Check if the select has an option with the specified value
|
protected ValueBox.AutoValidator |
createAutoValidator(ValueBox.AutoValidate autoValidate)
Create an AutoValidator that will automatically validate the component when it loses focus
|
protected elemental2.dom.HTMLElement |
createInputElement(String type)
Creates an input element with the specified type
|
protected DominoElement<elemental2.dom.HTMLDivElement> |
createMandatoryAddOn()
for thes select this creates the dropdown menu arrow
|
S |
disable() |
S |
divider()
Adds a separator item between the select option in the dropdown menu
|
protected void |
doSetValue(T value) |
S |
dropdown()
force open the select dropdown menu to open down by default
|
S |
dropup()
force open the select dropdown menu to open up by default
|
S |
enable() |
DominoElement<elemental2.dom.HTMLElement> |
getButtonValueContainer() |
String |
getClearableText() |
String |
getDropDirection() |
List<String> |
getKeys() |
SelectOption<V> |
getOptionAt(int index) |
List<SelectOption<V>> |
getOptions() |
DropDownMenu |
getOptionsMenu() |
DominoElement<elemental2.dom.HTMLButtonElement> |
getSelectButton()
the select box is actually rendered with a button
|
DominoElement<elemental2.dom.HTMLLabelElement> |
getSelectLabel()
Deprecated.
|
List<V> |
getValues() |
protected void |
hidePlaceholder() |
S |
insertFirst(SelectOption<V> option)
Insert an option as the first option in the dropdown menu
|
boolean |
isAutoCloseOnSelect() |
boolean |
isClearable() |
boolean |
isClosePopOverOnOpen() |
boolean |
isCreatable() |
boolean |
isEnabled() |
boolean |
isSearchable() |
abstract boolean |
isSelected() |
protected void |
onSelection(SelectOption<V> option)
By default this will call the Selection Handlers and the Change handlers
|
S |
open()
Opens the select dropdown menu
|
S |
removeAllOptions()
Removes all options from the select dropdown menu
|
S |
removeOption(SelectOption<V> option)
Removes an option from the select dropdown menu
|
S |
removeOptions(Collection<SelectOption<V>> options)
Removes a list of options from the select dropdown menu
|
S |
removeSelectionHandler(AbstractSelect.SelectionHandler selectionHandler) |
protected abstract void |
scrollToSelectedOption()
implementation of this method will determine how the select will scroll to the selected option
when opens the dropdown menu
|
S |
select(SelectOption<V> option)
Selects the specified option if it is one of this select options
|
abstract S |
select(SelectOption<V> option,
boolean silent)
Selects the option at the specified index if exists and set its value as the select value
|
S |
selectAt(int index)
Selects the option at the specified index if exists and set its value as the select value
|
S |
selectAt(int index,
boolean silent)
Selects the option at the specified index if exists and set its value as the select value
|
S |
selectByKey(String key)
Selects an option by its key if exists
|
S |
selectByKey(String key,
boolean silent)
Selects an option by its key if exists with ability to avoid triggering change handlers
|
void |
setArrowIconSupplier(Supplier<BaseIcon<?>> arrowIconSupplier)
Sets a supplier for an icon to use as the dropdown arrow
|
S |
setAutoCloseOnSelect(boolean autoCloseOnSelect) |
S |
setClearable(boolean clearable)
Enable/Disable the none option in the field
|
S |
setClearableText(String clearableText)
sets the text display for the none option from the
setClearable(boolean) |
S |
setClosePopOverOnOpen(boolean closePopOverOnOpen)
Enable/Disable closing other popups in the screen when opens the select dropdown menu
|
S |
setCreatable(boolean creatable)
Enable/Disable on the fly option creation
|
S |
setDropPosition(DropDownPosition dropPosition)
Sets a custom dropdown position for this select
|
S |
setOnAddOptionHandler(AbstractSelect.OnAddOptionHandler<V> onAddOptionHandler)
Adds a handler that will be called whenever we add a new option to the select using the
setCreatable(boolean) feature |
S |
setOptionRenderer(AbstractSelect.OptionRenderer<V> optionRenderer)
Sets the option renderer
|
S |
setPopupWidth(int width)
Sets the dropdown menu width
|
S |
setReadOnly(boolean readOnly)
set the readonly attribute value
|
S |
setSearchable(boolean searchable)
Disable/Enable search for the select.
|
S |
setSearchFilter(DropDownMenu.SearchFilter searchFilter)
Sets a custom search filter to be used when
setSearchable(boolean) is enabled |
abstract S |
setValue(T value,
boolean silent)
Set the value with the ability to do so without triggering change handlers
|
protected void |
showPlaceholder() |
S |
value(T value)
set the filed value
|
getMaxLength, getMinLength, getMinLengthErrorMessage, isEmpty, isEmptyIgnoreSpaces, setMaxLength, setMinLength, setMinLengthErrorMessage, updateCharacterCountaddChangeHandler, addLeftAddOn, addLeftAddOn, addLeftAddOn, addOnClearHandler, addRightAddOn, addRightAddOn, addRightAddOn, allowEmptyLabel, asTableField, autoValidate, callChangeHandlers, changeLabelFloating, clear, clearInvalid, clearValue, clearValue, condense, createLabelElement, doFocus, doUnfocus, element, floating, floatLabel, focus, getAdditionalInfoContainer, getCountItem, getErrorItem, getErrorsContainer, getFieldContainer, getFieldGroup, getFieldInputContainer, getFieldStyle, getFocusColor, getHelperContainer, getHelpItem, getInputContainer, getInputElement, getLabelElement, getLabelTextElement, getLeftAddonContainer, getLeftAddOnsContainer, getMandatoryAddOn, getNotesContainer, getOnClearHandlers, getPlaceholder, getPostfix, getPostFixItem, getPrefix, getPrefixItem, getRightAddonContainer, getRightAddOnsContainer, getStringValue, getValue, hasChangeHandler, hideLabelText, invalidate, invalidate, isAddFocusColor, isAutoValidation, isFloating, isFocused, isReadOnly, linkLabelToField, nonfloating, onEnterKey, pauseChangeHandlers, pauseFocusValidation, removeChangeHandler, removeLeftAddOn, removeLeftAddOn, removeLeftAddOn, removeLeftAddOn, removeLeftAddOns, removeOnClearHandler, removeRightAddOn, removeRightAddOn, removeRightAddOn, removeRightAddOn, removeRightAddOns, resumeChangeHandlers, resumeFocusValidation, setAutoValidation, setFieldStyle, setFixErrorsPosition, setFloating, setFocusColor, setLabel, setLabel, setLabel, setLabel, setLabelTextVisible, setPauseChangeHandlers, setPlaceholder, setPostFix, setPrefix, setSpellCheck, setTableField, shouldShowPlaceholder, showLabelText, spread, unfloatLabel, unfocus, updateLabel, valueaddValidator, getErrorLabels, getErrors, getHelperText, getLabel, getName, getRequiredErrorMessage, groupBy, hasValidator, isDisabled, isFixErrorsPosition, isRequired, isShowRequiredIndicator, isValidationDisabled, makeErrorLabel, removeValidator, setHelperText, setName, setRequired, setRequired, setRequiredErrorMessage, setShowRequiredIndicator, setValidationDisabled, setValue, showErrors, ungroup, validate, withValidationDisabledadd, add, addClickListener, addCss, addCss, addEventListener, addEventListener, addEventsListener, addHideListener, addShowListener, alignCenter, alignRight, appendChild, appendChild, apply, attr, blur, childNodes, clearElement, contains, contains, contains, containsCss, css, css, cssClassByIndex, cssClassesCount, cssText, elevate, elevate, firstChild, getAttachObserver, getAttribute, getBoundingClientRect, getChildElementCount, getClickableElement, getCollapsible, getCollapsibleElement, getDetachObserver, getDominoId, getElementsCount, getElevation, getFirstChild, getId, getTextContent, getTooltip, getWavesElement, hasAttribute, hasChildNodes, hasDirectChild, hide, hideOn, id, init, insertAfter, insertAfter, insertAfter, insertAfter, insertBefore, insertBefore, insertBefore, insertBefore, insertFirst, insertFirst, insertFirst, isAttached, isCollapsed, isEmptyElement, isEqualNode, isForceHidden, isHidden, item, lastChild, length, onAttached, onDetached, onResize, pullLeft, pullRight, querySelector, querySelectorAll, remove, removeAttachObserver, removeAttribute, removeChild, removeChild, removeCss, removeCss, removeCssProperty, removeDetachObserver, removeEventListener, removeEventListener, removeHideListener, removeHideOn, removeShowListener, removeShowOn, removeTooltip, removeWaves, replaceCss, setAlignItems, setAttribute, setAttribute, setAttribute, setBackgroundColor, setBackgroundColor, setBorder, setBorderColor, setBottom, setBottom, setBoxShadow, setCollapseStrategy, setColor, setColor, setContent, setContent, setCssProperty, setCssProperty, setCursor, setCursor, setDisabled, setDisplay, setDisplay, setDropMenu, setFlex, setFloat, setFloat, setFontSize, setFontSize, setForceHidden, setHeight, setHeight, setId, setInnerHtml, setLeft, setLeft, setLineHeight, setLineHeight, setMargin, setMargin, setMarginBottom, setMarginBottom, setMarginLeft, setMarginLeft, setMarginRight, setMarginRight, setMarginTop, setMarginTop, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setOpacity, setOpacity, setOverFlow, setOverFlow, setOverFlowY, setPadding, setPadding, setPaddingBottom, setPaddingBottom, setPaddingLeft, setPaddingLeft, setPaddingRight, setPaddingRight, setPaddingTop, setPaddingTop, setPointerEvents, setPosition, setPosition, setRight, setRight, setTabIndex, setTextAlign, setTextAlign, setTextContent, setTooltip, setTooltip, setTooltip, setTooltip, setTop, setTop, setTransitionDuration, setWidth, setWidth, setZIndex, show, showOn, style, style, styler, textContent, toggleDisplay, toggleDisplay, withWaves, withWavesclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitvalidateAllisExpandedadd, add, remove, remove, removeProperty, replace, setProperty, setPropertyprotected SelectOption<V> noneOption
protected DominoElement<elemental2.dom.HTMLElement> buttonValueContainer
protected final DominoElement<elemental2.dom.HTMLElement> valuesContainer
protected LinkedList<SelectOption<V>> options
public AbstractSelect()
public AbstractSelect(String label)
label - Stringpublic AbstractSelect(String label, List<SelectOption<V>> options)
label - Stringoptions - List of SelectOptionpublic AbstractSelect(List<SelectOption<V>> options)
options - List of SelectOptionpublic void setArrowIconSupplier(Supplier<BaseIcon<?>> arrowIconSupplier)
arrowIconSupplier - Supplier for BaseIconpublic S clear(boolean silent)
ValueBoxclear in interface HasGrouping<S extends AbstractSelect<T,V,S>>clear in class ValueBox<S extends AbstractSelect<T,V,S>,elemental2.dom.HTMLElement,T>silent - boolean, if false clear the value without triggering the change handlerspublic S open()
public S close()
public S divider()
public S addGroup(SelectOptionGroup<V> group)
group - SelectOptionGrouppublic S addOptions(List<SelectOption<V>> options)
options - List of SelectOptionpublic S setPopupWidth(int width)
width - intpublic S appendChild(SelectOption<V> option)
option - SelectOptionpublic S appendChild(SelectOption<V> option, Consumer<DropdownAction<SelectOption<V>>> andThen)
public S insertFirst(SelectOption<V> option)
option - SelectOptionpublic S selectAt(int index)
index - intpublic S selectAt(int index, boolean silent)
index - intsilent - boolean, true to avoid triggering change handlerspublic SelectOption<V> getOptionAt(int index)
index - intSelectOption at the specified index if exists or else nullpublic List<SelectOption<V>> getOptions()
SelectOptions of this select componentpublic S select(SelectOption<V> option)
option - SelectOptionpublic abstract S select(SelectOption<V> option, boolean silent)
option - SelectOptionsilent - boolean, true to avoid triggering change handlerspublic abstract boolean isSelected()
protected void onSelection(SelectOption<V> option)
option - the new selected SelectOptionpublic S addSelectionHandler(AbstractSelect.SelectionHandler<V> selectionHandler)
selectionHandler - AbstractSelect.SelectionHandlerpublic S enable()
enable in interface Switchable<S extends AbstractSelect<T,V,S>>enable in class ValueBox<S extends AbstractSelect<T,V,S>,elemental2.dom.HTMLElement,T>public S disable()
disable in interface Switchable<S extends AbstractSelect<T,V,S>>disable in class ValueBox<S extends AbstractSelect<T,V,S>,elemental2.dom.HTMLElement,T>public boolean isEnabled()
isEnabled in interface Switchable<S extends AbstractSelect<T,V,S>>isEnabled in class BasicFormElement<S extends AbstractSelect<T,V,S>,T>public S dropup()
public S dropdown()
public abstract S setValue(T value, boolean silent)
value - Tsilent - boolean, true to avoid triggering change handlerspublic S removeSelectionHandler(AbstractSelect.SelectionHandler selectionHandler)
selectionHandler - AbstractSelect.SelectionHandlerpublic S removeOption(SelectOption<V> option)
option - SelectOptionpublic S removeOptions(Collection<SelectOption<V>> options)
options - collection of SelectOptionpublic S removeAllOptions()
public S setReadOnly(boolean readOnly)
setReadOnly in interface IsReadOnly<S extends AbstractSelect<T,V,S>>setReadOnly in class AbstractValueBox<S extends AbstractSelect<T,V,S>,elemental2.dom.HTMLElement,T>readOnly - boolean, if true switch the component to readonly mode, otherwise switch out
off readonly modepublic S setOptionRenderer(AbstractSelect.OptionRenderer<V> optionRenderer)
optionRenderer - the AbstractSelect.OptionRendererpublic DominoElement<elemental2.dom.HTMLButtonElement> getSelectButton()
HTMLButtonElement that is actually displaying the selected option@Deprecated public DominoElement<elemental2.dom.HTMLLabelElement> getSelectLabel()
ValueBox.getLabelElement()HTMLLabelElement of the select wrapped as DominoElementprotected ValueBox.AutoValidator createAutoValidator(ValueBox.AutoValidate autoValidate)
createAutoValidator in class ValueBox<S extends AbstractSelect<T,V,S>,elemental2.dom.HTMLElement,T>autoValidate - AutoValidateAutoValidator implementation for the select which is SelectAutoValidatorpublic List<V> getValues()
public List<String> getKeys()
public boolean containsKey(String key)
key - Stringpublic boolean containsValue(V value)
value - Vpublic S setSearchable(boolean searchable)
searchable - boolean, if true a text box will show up in the dropdown menu to search for
optionspublic S setCreatable(boolean creatable)
creatable - boolean, if true a button will show up to allow the user to create a new
select option and add it to the dropdown listpublic S setOnAddOptionHandler(AbstractSelect.OnAddOptionHandler<V> onAddOptionHandler)
setCreatable(boolean) featureonAddOptionHandler - AbstractSelect.OnAddOptionHandlerpublic S closeMenu(AbstractSelect.CloseMenuHandler closeMenuHandler)
closeMenuHandler - AbstractSelect.CloseMenuHandlerpublic boolean isSearchable()
public boolean isCreatable()
public static void closeAllSelects()
public S selectByKey(String key)
key - Stringpublic S selectByKey(String key, boolean silent)
key - Stringsilent - boolean, true to avoid triggering change handlerspublic S setClearable(boolean clearable)
clearable - boolean, if true a none option will added to the select as the first option,
when selected it actually nulls the select valuepublic boolean isClearable()
public S setClearableText(String clearableText)
setClearable(boolean)clearableText - Stringpublic String getClearableText()
setClearable(boolean) is enabledpublic String getDropDirection()
public DominoElement<elemental2.dom.HTMLElement> getButtonValueContainer()
HTMLElement that contains the button of this selectpublic S setDropPosition(DropDownPosition dropPosition)
dropPosition - DropDownPositionprotected elemental2.dom.HTMLElement createInputElement(String type)
createInputElement in class ValueBox<S extends AbstractSelect<T,V,S>,elemental2.dom.HTMLElement,T>type - String the input element typeprotected void showPlaceholder()
showPlaceholder in class ValueBox<S extends AbstractSelect<T,V,S>,elemental2.dom.HTMLElement,T>protected void hidePlaceholder()
hidePlaceholder in class ValueBox<S extends AbstractSelect<T,V,S>,elemental2.dom.HTMLElement,T>protected DominoElement<elemental2.dom.HTMLDivElement> createMandatoryAddOn()
createMandatoryAddOn in class ValueBox<S extends AbstractSelect<T,V,S>,elemental2.dom.HTMLElement,T>FlexItem that contains the mandatory addonsprotected void doSetValue(T value)
doSetValue in class ValueBox<S extends AbstractSelect<T,V,S>,elemental2.dom.HTMLElement,T>value - V the value to set for this fieldpublic S setSearchFilter(DropDownMenu.SearchFilter searchFilter)
setSearchable(boolean) is enabledsearchFilter - DropDownMenu.SearchFilterpublic DropDownMenu getOptionsMenu()
DropDownMenu of this selectpublic boolean isClosePopOverOnOpen()
public S setClosePopOverOnOpen(boolean closePopOverOnOpen)
closePopOverOnOpen - boolean, true to close other popupspublic boolean isAutoCloseOnSelect()
public S setAutoCloseOnSelect(boolean autoCloseOnSelect)
autoCloseOnSelect - boolean, if true the dropdown menu will close after selecting an
option otherwise it remains openprotected abstract void scrollToSelectedOption()
Copyright © 2019–2022 Dominokit. All rights reserved.