Package com.storedobject.vaadin
Class CustomTextField<T>
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.AbstractField<com.vaadin.flow.component.customfield.CustomField<T>,T>
com.vaadin.flow.component.customfield.CustomField<T>
com.storedobject.vaadin.CustomField<T>
com.storedobject.vaadin.CustomTextField<T>
- Type Parameters:
T- Value type
- All Implemented Interfaces:
DisablePaste,HasStyle,com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.BlurNotifier<com.vaadin.flow.component.customfield.CustomField<T>>,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.Focusable<com.vaadin.flow.component.customfield.CustomField<T>>,com.vaadin.flow.component.FocusNotifier<com.vaadin.flow.component.customfield.CustomField<T>>,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasEnabled,com.vaadin.flow.component.HasHelper,com.vaadin.flow.component.HasLabel,com.vaadin.flow.component.HasSize,com.vaadin.flow.component.HasStyle,com.vaadin.flow.component.HasTheme,com.vaadin.flow.component.HasValidation,com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<T>,,T>, T> com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<T>,,T>, T> com.vaadin.flow.component.shared.HasPrefix,com.vaadin.flow.component.shared.HasSuffix,com.vaadin.flow.component.shared.HasTooltip,com.vaadin.flow.component.shared.HasValidationProperties,com.vaadin.flow.component.shared.InputField<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<T>,,T>, T> com.vaadin.flow.component.textfield.HasAutocomplete,Serializable
- Direct Known Subclasses:
AbstractQuantityField,ClassNameField,DaysField,FreeFormatField,GeolocationField,JSONField,MinutesField,MoneyField,NumericField,ObjectCodeField,SecondsField
public abstract class CustomTextField<T>
extends CustomField<T>
implements com.vaadin.flow.component.shared.HasPrefix, com.vaadin.flow.component.shared.HasSuffix, HasStyle, DisablePaste, com.vaadin.flow.component.textfield.HasAutocomplete
A "custom field" where the value is represented as a "text" using an internal text field.
- Author:
- Syam
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.vaadin.flow.component.AbstractField
com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<C extends com.vaadin.flow.component.Component,V> Nested classes/interfaces inherited from interface com.vaadin.flow.component.BlurNotifier
com.vaadin.flow.component.BlurNotifier.BlurEvent<C extends com.vaadin.flow.component.Component>Nested classes/interfaces inherited from interface com.vaadin.flow.component.FocusNotifier
com.vaadin.flow.component.FocusNotifier.FocusEvent<C extends com.vaadin.flow.component.Component>Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasValue
com.vaadin.flow.component.HasValue.ValueChangeEvent<V>, com.vaadin.flow.component.HasValue.ValueChangeListener<E extends com.vaadin.flow.component.HasValue.ValueChangeEvent<?>> -
Field Summary
Fields inherited from interface com.vaadin.flow.component.textfield.HasAutocomplete
AUTOCOMPLETE_ATTRIBUTE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAlign right.protected HasTextValueCreate the internal text field.protected voidcustomizeTextField(HasTextValue textField) Customize the internal text field.voidDisable paste feature so that Ctrl-V will not paste anything from the copy buffer.protected StringFormat the value to display it as a string.protected Tcom.vaadin.flow.component.textfield.AutocompletegetField()Get the internal text field that represents the value of the field.com.vaadin.flow.dom.ElementGet the internal element to which style will be applied.protected abstract TgetModelValue(String string) Create the model value from the string value passed.com.vaadin.flow.component.Componentcom.vaadin.flow.component.ComponentbooleanIs in auto-select mode?protected voidonAttach(com.vaadin.flow.component.AttachEvent attachEvent) voidsetAutocomplete(com.vaadin.flow.component.textfield.Autocomplete autocomplete) voidsetAutoselect(boolean autoselect) Set auto-select mode.voidsetEmptyDisplay(String emptyDisplay) Set text to be displayed when the value of the field is empty.voidsetEnabled(boolean enabled) voidvoidsetMaxHeight(String maxHeight) voidsetMaxWidth(String maxWidth) voidsetMinHeight(String minHeight) voidsetMinWidth(String minWidth) voidsetPlaceholder(String placeholder) Set text to be displayed as placeholder when the value of the field is empty.voidsetPrefixComponent(com.vaadin.flow.component.Component component) protected voidsetPresentationValue(T value) voidsetReadOnly(boolean readOnly) voidsetSuffixComponent(com.vaadin.flow.component.Component component) voidMethods inherited from class com.storedobject.vaadin.CustomField
addField, addField, focusMethods inherited from class com.vaadin.flow.component.customfield.CustomField
add, addThemeVariants, getLabel, remove, removeThemeVariants, setLabel, updateValueMethods inherited from class com.vaadin.flow.component.AbstractField
addValueChangeListener, getEmptyValue, getValue, isEmpty, setModelValue, setValue, 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, onDetach, 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, getTabIndex, setTabIndexMethods inherited from interface com.vaadin.flow.component.FocusNotifier
addFocusListenerMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabledMethods inherited from interface com.vaadin.flow.component.HasHelper
getHelperComponent, getHelperText, setHelperComponent, setHelperTextMethods inherited from interface com.vaadin.flow.component.HasSize
getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeightFull, setMaxHeight, setMaxWidth, setMinHeight, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidthFullMethods inherited from interface com.storedobject.vaadin.HasStyle
getClassName, getClassNames, getStyle, setClassNameMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, hasClassName, removeClassName, removeClassNames, 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.HasTooltip
getTooltip, setTooltipTextMethods inherited from interface com.vaadin.flow.component.HasValidation
setManualValidationMethods inherited from interface com.vaadin.flow.component.shared.HasValidationProperties
getErrorMessage, isInvalid, setErrorMessage, setInvalidMethods inherited from interface com.vaadin.flow.component.HasValue
addValueChangeListener, clear, getEmptyValue, getOptionalValue, getValue, isEmpty, setValueMethods inherited from interface com.vaadin.flow.component.HasValueAndElement
isReadOnly, isRequiredIndicatorVisible, setRequiredIndicatorVisible
-
Constructor Details
-
CustomTextField
-
-
Method Details
-
setWidth
- Specified by:
setWidthin interfacecom.vaadin.flow.component.HasSize
-
setHeight
- Specified by:
setHeightin interfacecom.vaadin.flow.component.HasSize
-
setMaxWidth
- Specified by:
setMaxWidthin interfacecom.vaadin.flow.component.HasSize
-
setMaxHeight
- Specified by:
setMaxHeightin interfacecom.vaadin.flow.component.HasSize
-
setMinWidth
- Specified by:
setMinWidthin interfacecom.vaadin.flow.component.HasSize
-
setMinHeight
- Specified by:
setMinHeightin interfacecom.vaadin.flow.component.HasSize
-
alignRight
public void alignRight()Align right. -
createField
Create the internal text field. By default, it creates aTextField.- Returns:
- Text field to be used as internal field;
-
disablePaste
public void disablePaste()Description copied from interface:DisablePasteDisable paste feature so that Ctrl-V will not paste anything from the copy buffer.- Specified by:
disablePastein interfaceDisablePaste
-
getField
Get the internal text field that represents the value of the field.- Returns:
- Internal text field.
-
customizeTextField
Customize the internal text field. This is invoked only when the text field is created.- Parameters:
textField- Internal text field
-
onAttach
protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent) - Overrides:
onAttachin classcom.vaadin.flow.component.Component
-
getModelValue
-
generateModelValue
-
setPresentationValue
-
format
-
setEmptyDisplay
Set text to be displayed when the value of the field is empty.- Parameters:
emptyDisplay- Text to be displayed
-
setPlaceholder
Set text to be displayed as placeholder when the value of the field is empty.- Parameters:
placeholder- Placeholder to be displayed
-
setPrefixComponent
public void setPrefixComponent(com.vaadin.flow.component.Component component) - Specified by:
setPrefixComponentin interfacecom.vaadin.flow.component.shared.HasPrefix
-
getPrefixComponent
public com.vaadin.flow.component.Component getPrefixComponent()- Specified by:
getPrefixComponentin interfacecom.vaadin.flow.component.shared.HasPrefix
-
setSuffixComponent
public void setSuffixComponent(com.vaadin.flow.component.Component component) - Specified by:
setSuffixComponentin interfacecom.vaadin.flow.component.shared.HasSuffix
-
getSuffixComponent
public com.vaadin.flow.component.Component getSuffixComponent()- Specified by:
getSuffixComponentin interfacecom.vaadin.flow.component.shared.HasSuffix
-
setReadOnly
public void setReadOnly(boolean readOnly) - Specified by:
setReadOnlyin interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<T>,T>, T> - Specified by:
setReadOnlyin interfacecom.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<T>,T>, T>
-
setEnabled
public void setEnabled(boolean enabled) - Specified by:
setEnabledin interfacecom.vaadin.flow.component.HasEnabled
-
setAutoselect
public void setAutoselect(boolean autoselect) Set auto-select mode.- Parameters:
autoselect- True to turn it on.
-
isAutoselect
public boolean isAutoselect()Is in auto-select mode?- Returns:
- True/false.
-
getAutocomplete
public com.vaadin.flow.component.textfield.Autocomplete getAutocomplete()- Specified by:
getAutocompletein interfacecom.vaadin.flow.component.textfield.HasAutocomplete
-
setAutocomplete
public void setAutocomplete(com.vaadin.flow.component.textfield.Autocomplete autocomplete) - Specified by:
setAutocompletein interfacecom.vaadin.flow.component.textfield.HasAutocomplete
-
getInternalElement
public com.vaadin.flow.dom.Element getInternalElement()Description copied from interface:HasStyleGet the internal element to which style will be applied.- Specified by:
getInternalElementin interfaceHasStyle- Returns:
- The internal element.
-