Package org.vaadin.miki.superfields.text
Class SuperTextField
- java.lang.Object
-
- com.vaadin.flow.component.Component
-
- com.vaadin.flow.component.AbstractField<C,T>
-
- com.vaadin.flow.component.AbstractSinglePropertyField<R,T>
-
- com.vaadin.flow.component.textfield.GeneratedVaadinTextField<com.vaadin.flow.component.textfield.TextField,String>
-
- com.vaadin.flow.component.textfield.TextField
-
- org.vaadin.miki.superfields.text.SuperTextField
-
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.BlurNotifier<com.vaadin.flow.component.textfield.TextField>,com.vaadin.flow.component.CompositionNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.Focusable<com.vaadin.flow.component.textfield.TextField>,com.vaadin.flow.component.FocusNotifier<com.vaadin.flow.component.textfield.TextField>,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.textfield.TextField,String>,String>,com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.textfield.TextField,String>,String>,com.vaadin.flow.component.InputNotifier,com.vaadin.flow.component.KeyNotifier,com.vaadin.flow.component.shared.HasAllowedCharPattern,com.vaadin.flow.component.shared.HasClearButton,com.vaadin.flow.component.shared.HasClientValidation,com.vaadin.flow.component.shared.HasThemeVariant<com.vaadin.flow.component.textfield.TextFieldVariant>,com.vaadin.flow.component.shared.HasTooltip,com.vaadin.flow.component.textfield.HasAutocapitalize,com.vaadin.flow.component.textfield.HasAutocomplete,com.vaadin.flow.component.textfield.HasAutocorrect,com.vaadin.flow.component.textfield.HasPrefixAndSuffix,com.vaadin.flow.data.binder.HasValidator<String>,com.vaadin.flow.data.value.HasValueChangeMode,Serializable,TextSelectionNotifier<SuperTextField>,CanModifyText,CanReceiveSelectionEventsFromClient,CanSelectText,HasHelperPositionable,HasId,HasLabelPositionable,HasPlaceholder,HasRequired,WithClearButtonMixin<SuperTextField>,WithHelperMixin<SuperTextField>,WithHelperPositionableMixin<SuperTextField>,WithIdMixin<SuperTextField>,WithLabelMixin<SuperTextField>,WithLabelPositionableMixin<SuperTextField>,WithPlaceholderMixin<SuperTextField>,WithReceivingSelectionEventsFromClientMixin<SuperTextField>,WithRequiredMixin<SuperTextField>,WithTooltipMixin<SuperTextField>,WithValueMixin<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.textfield.TextField,String>,String,SuperTextField>
@Tag("super-text-field") @JsModule("./super-text-field.js") @CssImport(value="./styles/label-positions.css", themeFor="super-text-field") public class SuperTextField extends com.vaadin.flow.component.textfield.TextField implements CanSelectText, TextSelectionNotifier<SuperTextField>, CanModifyText, WithRequiredMixin<SuperTextField>, WithLabelPositionableMixin<SuperTextField>, WithIdMixin<SuperTextField>, WithLabelMixin<SuperTextField>, WithPlaceholderMixin<SuperTextField>, WithValueMixin<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.textfield.TextField,String>,String,SuperTextField>, WithHelperMixin<SuperTextField>, WithHelperPositionableMixin<SuperTextField>, WithReceivingSelectionEventsFromClientMixin<SuperTextField>, WithClearButtonMixin<SuperTextField>, WithTooltipMixin<SuperTextField>An extension ofTextFieldwith some useful (hopefully) features.- Since:
- 2020-05-29
- Author:
- miki
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.vaadin.flow.component.textfield.GeneratedVaadinTextField
com.vaadin.flow.component.textfield.GeneratedVaadinTextField.ChangeEvent<R extends com.vaadin.flow.component.textfield.GeneratedVaadinTextField<R,?>>, com.vaadin.flow.component.textfield.GeneratedVaadinTextField.InvalidChangeEvent<R extends com.vaadin.flow.component.textfield.GeneratedVaadinTextField<R,?>>
-
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 extends Object>
-
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.shared.HasClientValidation
com.vaadin.flow.component.shared.HasClientValidation.ClientValidatedEvent
-
Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasValue
com.vaadin.flow.component.HasValue.ValueChangeEvent<V extends Object>, 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.HasAutocapitalize
AUTOCAPITALIZE_ATTRIBUTE
-
Fields inherited from interface com.vaadin.flow.component.textfield.HasAutocomplete
AUTOCOMPLETE_ATTRIBUTE
-
Fields inherited from interface com.vaadin.flow.component.textfield.HasAutocorrect
AUTOCORRECT_ATTRIBUTE
-
Fields inherited from interface org.vaadin.miki.markers.HasHelperPositionable
HELPER_ABOVE_THEME_VARIANT
-
Fields inherited from interface org.vaadin.miki.markers.HasLabelPositionable
LABEL_POSITION_ATTRIBUTE, LABEL_POSITION_DETAILS_ATTRIBUTE
-
-
Constructor Summary
Constructors Constructor Description SuperTextField()SuperTextField(com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.textfield.TextField,String>> listener)SuperTextField(String label)SuperTextField(String label, com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.textfield.TextField,String>> listener)SuperTextField(String label, String placeholder)SuperTextField(String label, String initialValue, com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.textfield.TextField,String>> listener)SuperTextField(String label, String initialValue, String placeholder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.vaadin.flow.shared.RegistrationaddTextSelectionListener(TextSelectionListener<SuperTextField> listener)Adds the listener.booleanisClearButtonVisible()booleanisReceivingSelectionEventsFromClient()Check if client will inform server on selection change.voidmodifyText(String replacement, int from, int to)Modifies the text at given coordinates.protected voidonAttach(com.vaadin.flow.component.AttachEvent attachEvent)protected voidonDetach(com.vaadin.flow.component.DetachEvent detachEvent)voidselect(int from, int to)Selects text starting from indexfrom(inclusive) and ending at indexto(exclusive).voidselectAll()Selects entire text in the component.voidselectNone()Removes the current selection and selects no text.voidsetClearButtonVisible(boolean clearButtonVisible)voidsetReceivingSelectionEventsFromClient(boolean receivingSelectionEventsFromClient)Configures sending events by the client-side component.-
Methods inherited from class com.vaadin.flow.component.textfield.TextField
addThemeVariants, addValidationStatusChangeListener, getDefaultValidator, getEmptyValue, getErrorMessage, getLabel, getMaxLength, getMinLength, getPattern, getPlaceholder, getTitle, getValue, getValueChangeMode, getValueChangeTimeout, isAutofocus, isAutoselect, isFeatureFlagEnabled, isInvalid, isPreventInvalidInput, isRequired, removeThemeVariants, setAutofocus, setAutoselect, setErrorMessage, setInvalid, setLabel, setMaxLength, setMinLength, setPattern, setPlaceholder, setPreventInvalidInput, setRequired, setRequiredIndicatorVisible, setTitle, setValue, setValueChangeMode, setValueChangeTimeout, validate
-
Methods inherited from class com.vaadin.flow.component.textfield.GeneratedVaadinTextField
addChangeListener, addInvalidChangeListener, addToInput, addToPrefix, addToSuffix, checkValidity, getAutocapitalizeString, getAutocompleteString, getAutocorrectString, getErrorMessageString, getLabelString, getListString, getMaxlengthDouble, getMinlengthDouble, getNameString, getPatternString, getPlaceholderString, getTitleString, isAutofocusBoolean, isAutoselectBoolean, isDisabledBoolean, isInvalidBoolean, isPreventInvalidInputBoolean, isReadonlyBoolean, isRequiredBoolean, remove, removeAll, setAutocapitalize, setAutocomplete, setAutocorrect, setDisabled, setList, setMaxlength, setMinlength, setName, setReadonly
-
Methods inherited from class com.vaadin.flow.component.AbstractSinglePropertyField
getSynchronizationRegistration, hasValidValue, setPresentationValue, setSynchronizedEvent
-
Methods inherited from class com.vaadin.flow.component.AbstractField
addValueChangeListener, isEmpty, setModelValue, valueEquals
-
Methods 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, scrollIntoView, set, setElement, setId, setVisible
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.vaadin.miki.markers.CanModifyText
modifyText, modifyText
-
Methods inherited from interface com.vaadin.flow.component.CompositionNotifier
addCompositionEndListener, addCompositionStartListener, addCompositionUpdateListener
-
Methods inherited from interface com.vaadin.flow.component.Focusable
addFocusShortcut, blur, focus, getTabIndex, setTabIndex
-
Methods inherited from interface com.vaadin.flow.component.shared.HasAllowedCharPattern
getAllowedCharPattern, setAllowedCharPattern
-
Methods inherited from interface com.vaadin.flow.component.textfield.HasAutocapitalize
getAutocapitalize, setAutocapitalize
-
Methods inherited from interface com.vaadin.flow.component.textfield.HasAutocomplete
getAutocomplete, setAutocomplete
-
Methods inherited from interface com.vaadin.flow.component.textfield.HasAutocorrect
isAutocorrect, setAutocorrect
-
Methods inherited from interface com.vaadin.flow.component.shared.HasClientValidation
addClientValidatedEventListener
-
Methods inherited from interface com.vaadin.flow.component.HasHelper
getHelperComponent, getHelperText, setHelperComponent, setHelperText
-
Methods inherited from interface org.vaadin.miki.markers.HasHelperPositionable
isHelperAbove, setHelperAbove, setHelperAbove, setHelperBelow
-
Methods inherited from interface org.vaadin.miki.markers.HasLabelPositionable
getLabelPosition, setLabelPosition
-
Methods inherited from interface org.vaadin.miki.markers.HasPlaceholder
getPlaceholder, setPlaceholder
-
Methods inherited from interface com.vaadin.flow.component.textfield.HasPrefixAndSuffix
getPrefixComponent, getSuffixComponent, setPrefixComponent, setSuffixComponent
-
Methods inherited from interface org.vaadin.miki.markers.HasRequired
isRequired, setRequired
-
Methods 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, setWidthFull
-
Methods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Methods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeName
-
Methods inherited from interface com.vaadin.flow.component.shared.HasTooltip
getTooltip, setTooltipText
-
Methods inherited from interface com.vaadin.flow.component.HasValue
addValueChangeListener, clear, getEmptyValue, getOptionalValue, getValue, isEmpty, setValue
-
Methods inherited from interface com.vaadin.flow.component.HasValueAndElement
isReadOnly, isRequiredIndicatorVisible, setReadOnly
-
Methods inherited from interface com.vaadin.flow.component.KeyNotifier
addKeyDownListener, addKeyDownListener, addKeyPressListener, addKeyPressListener, addKeyUpListener, addKeyUpListener
-
Methods inherited from interface org.vaadin.miki.markers.WithClearButtonMixin
withClearButtonVisible
-
Methods inherited from interface org.vaadin.miki.markers.WithHelperMixin
withHelperComponent, withHelperText
-
Methods inherited from interface org.vaadin.miki.markers.WithHelperPositionableMixin
withHelperAbove, withHelperAbove, withHelperBelow
-
Methods inherited from interface org.vaadin.miki.markers.WithIdMixin
withId
-
Methods inherited from interface org.vaadin.miki.markers.WithLabelMixin
withLabel
-
Methods inherited from interface org.vaadin.miki.markers.WithLabelPositionableMixin
withLabelPosition
-
Methods inherited from interface org.vaadin.miki.markers.WithPlaceholderMixin
withPlaceholder
-
Methods inherited from interface org.vaadin.miki.markers.WithReceivingSelectionEventsFromClientMixin
withReceivingSelectionEventsFromClient
-
Methods inherited from interface org.vaadin.miki.markers.WithRequiredMixin
withoutRequired, withRequired, withRequired
-
Methods inherited from interface org.vaadin.miki.markers.WithTooltipMixin
withTooltipText
-
Methods inherited from interface org.vaadin.miki.markers.WithValueMixin
withValue
-
-
-
-
Constructor Detail
-
SuperTextField
public SuperTextField()
-
SuperTextField
public SuperTextField(String label)
-
SuperTextField
public SuperTextField(com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.textfield.TextField,String>> listener)
-
SuperTextField
public SuperTextField(String label, com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.textfield.TextField,String>> listener)
-
-
Method Detail
-
onAttach
protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
- Overrides:
onAttachin classcom.vaadin.flow.component.textfield.TextField
-
onDetach
protected void onDetach(com.vaadin.flow.component.DetachEvent detachEvent)
- Overrides:
onDetachin classcom.vaadin.flow.component.Component
-
addTextSelectionListener
public com.vaadin.flow.shared.Registration addTextSelectionListener(TextSelectionListener<SuperTextField> listener)
Description copied from interface:TextSelectionNotifierAdds the listener.- Specified by:
addTextSelectionListenerin interfaceTextSelectionNotifier<SuperTextField>- Parameters:
listener- A listener to add.- Returns:
- A
Registrationthat can be used to stop listening to the event.
-
selectAll
public void selectAll()
Description copied from interface:CanSelectTextSelects entire text in the component.- Specified by:
selectAllin interfaceCanSelectText
-
selectNone
public void selectNone()
Description copied from interface:CanSelectTextRemoves the current selection and selects no text.- Specified by:
selectNonein interfaceCanSelectText
-
select
public void select(int from, int to)Description copied from interface:CanSelectTextSelects text starting from indexfrom(inclusive) and ending at indexto(exclusive).- Specified by:
selectin interfaceCanSelectText- Parameters:
from- Starting index (inclusive).to- Ending index (exclusive).
-
isReceivingSelectionEventsFromClient
public boolean isReceivingSelectionEventsFromClient()
Description copied from interface:CanReceiveSelectionEventsFromClientCheck if client will inform server on selection change. Note: this feature is by default turned off.- Specified by:
isReceivingSelectionEventsFromClientin interfaceCanReceiveSelectionEventsFromClient- Returns:
- When
true, each selection change in the client-side component will result in this component broadcasting aTextSelectionEvent.
-
setReceivingSelectionEventsFromClient
public void setReceivingSelectionEventsFromClient(boolean receivingSelectionEventsFromClient)
Description copied from interface:CanReceiveSelectionEventsFromClientConfigures sending events by the client-side component. Note: this feature is by default turned off.- Specified by:
setReceivingSelectionEventsFromClientin interfaceCanReceiveSelectionEventsFromClient- Parameters:
receivingSelectionEventsFromClient- Whenfalse, selecting text in client-side component will not send an event to server-side component. Whentrue, it will.
-
modifyText
public void modifyText(String replacement, int from, int to)
Description copied from interface:CanModifyTextModifies the text at given coordinates.- Specified by:
modifyTextin interfaceCanModifyText- Parameters:
replacement- Text to put.from- The starting index of what to replace.to- The end index of what to replace.
-
setClearButtonVisible
public void setClearButtonVisible(boolean clearButtonVisible)
- Specified by:
setClearButtonVisiblein interfacecom.vaadin.flow.component.shared.HasClearButton
-
isClearButtonVisible
public boolean isClearButtonVisible()
- Specified by:
isClearButtonVisiblein interfacecom.vaadin.flow.component.shared.HasClearButton
-
-