Class SuperTextField

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.textfield.TextFieldBase<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.HasPrefix, com.vaadin.flow.component.shared.HasSuffix, com.vaadin.flow.component.shared.HasThemeVariant<com.vaadin.flow.component.textfield.TextFieldVariant>, com.vaadin.flow.component.shared.HasTooltip, com.vaadin.flow.component.shared.HasValidationProperties, 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, HasTextInputMode, WithClearButtonMixin<SuperTextField>, WithHelperMixin<SuperTextField>, WithHelperPositionableMixin<SuperTextField>, WithIdMixin<SuperTextField>, WithLabelMixin<SuperTextField>, WithLabelPositionableMixin<SuperTextField>, WithPlaceholderMixin<SuperTextField>, WithReceivingSelectionEventsFromClientMixin<SuperTextField>, WithRequiredMixin<SuperTextField>, WithTextInputModeMixin<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>, WithTextInputModeMixin<SuperTextField>
An extension of TextField with some useful (hopefully) features.
Since:
2020-05-29
Author:
miki
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 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

    Fields inherited from interface com.vaadin.flow.data.value.HasValueChangeMode

    DEFAULT_CHANGE_TIMEOUT
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    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, 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

    Modifier and Type
    Method
    Description
    com.vaadin.flow.shared.Registration
    Adds the listener.
    Returns the current text input mode of this object.
    boolean
     
    boolean
    Check if client will inform server on selection change.
    void
    modifyText(String replacement, int from, int to)
    Modifies the text at given coordinates.
    protected void
    onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
     
    protected void
    onDetach(com.vaadin.flow.component.DetachEvent detachEvent)
     
    void
    select(int from, int to)
    Selects text starting from index from (inclusive) and ending at index to (exclusive).
    void
    Selects entire text in the component.
    void
    Removes the current selection and selects no text.
    void
    setClearButtonVisible(boolean clearButtonVisible)
     
    void
    setReceivingSelectionEventsFromClient(boolean receivingSelectionEventsFromClient)
    Configures sending events by the client-side component.
    void
    Changes the text input mode of this object.

    Methods inherited from class com.vaadin.flow.component.textfield.TextField

    addValidationStatusChangeListener, getDefaultValidator, getEmptyValue, getMaxLength, getMinLength, getPattern, getValue, setMaxLength, setMinLength, setPattern, setRequired, setRequiredIndicatorVisible, setValue, validate

    Methods inherited from class com.vaadin.flow.component.textfield.TextFieldBase

    addToInput, addToPrefix, addToSuffix, getPlaceholder, getTitle, getValueChangeMode, getValueChangeTimeout, isAutofocus, isAutoselect, isRequired, setAutofocus, setAutoselect, setPlaceholder, setTitle, setValueChangeMode, setValueChangeTimeout

    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, removeFromParent, scrollIntoView, 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 com.vaadin.flow.component.AttachNotifier

    addAttachListener

    Methods inherited from interface com.vaadin.flow.component.BlurNotifier

    addBlurListener

    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.DetachNotifier

    addDetachListener

    Methods inherited from interface com.vaadin.flow.component.Focusable

    addFocusShortcut, blur, focus, getTabIndex, setTabIndex

    Methods inherited from interface com.vaadin.flow.component.FocusNotifier

    addFocusListener

    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.HasElement

    getElement

    Methods inherited from interface com.vaadin.flow.component.HasEnabled

    isEnabled, setEnabled

    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.HasId

    getId, setId

    Methods inherited from interface com.vaadin.flow.component.HasLabel

    getLabel, setLabel

    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.shared.HasPrefix

    getPrefixComponent, setPrefixComponent

    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.shared.HasSuffix

    getSuffixComponent, setSuffixComponent

    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.HasThemeVariant

    addThemeVariants, removeThemeVariants

    Methods inherited from interface com.vaadin.flow.component.shared.HasTooltip

    getTooltip, setTooltipText

    Methods inherited from interface com.vaadin.flow.component.shared.HasValidationProperties

    getErrorMessage, isInvalid, setErrorMessage, setInvalid

    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.InputNotifier

    addInputListener

    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.WithTextInputModeMixin

    withTextInputMode

    Methods inherited from interface org.vaadin.miki.markers.WithTooltipMixin

    withTooltipText

    Methods inherited from interface org.vaadin.miki.markers.WithValueMixin

    withValue
  • Constructor Details

    • SuperTextField

      public SuperTextField()
    • SuperTextField

      public SuperTextField(String label)
    • SuperTextField

      public SuperTextField(String label, String placeholder)
    • SuperTextField

      public SuperTextField(String label, String initialValue, String placeholder)
    • 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)
    • SuperTextField

      public 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)
  • Method Details

    • onAttach

      protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
      Overrides:
      onAttach in class com.vaadin.flow.component.textfield.TextField
    • onDetach

      protected void onDetach(com.vaadin.flow.component.DetachEvent detachEvent)
      Overrides:
      onDetach in class com.vaadin.flow.component.Component
    • addTextSelectionListener

      public com.vaadin.flow.shared.Registration addTextSelectionListener(TextSelectionListener<SuperTextField> listener)
      Description copied from interface: TextSelectionNotifier
      Adds the listener.
      Specified by:
      addTextSelectionListener in interface TextSelectionNotifier<SuperTextField>
      Parameters:
      listener - A listener to add.
      Returns:
      A Registration that can be used to stop listening to the event.
    • selectAll

      public void selectAll()
      Description copied from interface: CanSelectText
      Selects entire text in the component.
      Specified by:
      selectAll in interface CanSelectText
    • selectNone

      public void selectNone()
      Description copied from interface: CanSelectText
      Removes the current selection and selects no text.
      Specified by:
      selectNone in interface CanSelectText
    • select

      public void select(int from, int to)
      Description copied from interface: CanSelectText
      Selects text starting from index from (inclusive) and ending at index to (exclusive).
      Specified by:
      select in interface CanSelectText
      Parameters:
      from - Starting index (inclusive).
      to - Ending index (exclusive).
    • isReceivingSelectionEventsFromClient

      public boolean isReceivingSelectionEventsFromClient()
      Description copied from interface: CanReceiveSelectionEventsFromClient
      Check if client will inform server on selection change. Note: this feature is by default turned off.
      Specified by:
      isReceivingSelectionEventsFromClient in interface CanReceiveSelectionEventsFromClient
      Returns:
      When true, each selection change in the client-side component will result in this component broadcasting a TextSelectionEvent.
    • setReceivingSelectionEventsFromClient

      public void setReceivingSelectionEventsFromClient(boolean receivingSelectionEventsFromClient)
      Description copied from interface: CanReceiveSelectionEventsFromClient
      Configures sending events by the client-side component. Note: this feature is by default turned off.
      Specified by:
      setReceivingSelectionEventsFromClient in interface CanReceiveSelectionEventsFromClient
      Parameters:
      receivingSelectionEventsFromClient - When false, selecting text in client-side component will not send an event to server-side component. When true, it will.
    • modifyText

      public void modifyText(String replacement, int from, int to)
      Description copied from interface: CanModifyText
      Modifies the text at given coordinates.
      Specified by:
      modifyText in interface CanModifyText
      Parameters:
      replacement - Text to put.
      from - The starting index of what to replace.
      to - The end index of what to replace.
    • setTextInputMode

      public void setTextInputMode(TextInputMode inputMode)
      Description copied from interface: HasTextInputMode
      Changes the text input mode of this object.
      Specified by:
      setTextInputMode in interface HasTextInputMode
      Parameters:
      inputMode - New input mode. Can be null.
    • getTextInputMode

      public TextInputMode getTextInputMode()
      Description copied from interface: HasTextInputMode
      Returns the current text input mode of this object.
      Specified by:
      getTextInputMode in interface HasTextInputMode
      Returns:
      A TextInputMode, or null if none has been set.
    • setClearButtonVisible

      public void setClearButtonVisible(boolean clearButtonVisible)
      Specified by:
      setClearButtonVisible in interface com.vaadin.flow.component.shared.HasClearButton
    • isClearButtonVisible

      public boolean isClearButtonVisible()
      Specified by:
      isClearButtonVisible in interface com.vaadin.flow.component.shared.HasClearButton