Class RegularExpressionField
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.AbstractField<CustomField<T>,T>
com.vaadin.flow.component.customfield.CustomField<RegularExpression>
com.flowingcode.vaadin.addons.regex.RegularExpressionField
- All Implemented Interfaces:
AttachNotifier,BlurNotifier<CustomField<RegularExpression>>,DetachNotifier,Focusable<CustomField<RegularExpression>>,FocusNotifier<CustomField<RegularExpression>>,HasElement,HasEnabled,HasHelper,HasLabel,HasSize,HasStyle,HasTheme,HasValidation,HasValue<AbstractField.ComponentValueChangeEvent<CustomField<RegularExpression>,,RegularExpression>, RegularExpression> HasValueAndElement<AbstractField.ComponentValueChangeEvent<CustomField<RegularExpression>,,RegularExpression>, RegularExpression> HasTooltip,HasValidationProperties,InputField<AbstractField.ComponentValueChangeEvent<CustomField<RegularExpression>,,RegularExpression>, RegularExpression> Serializable
A component for creating and testing regular expressions in real-time.
Features:
- Dropdown selection of predefined pattern types:
STARTS_WITH,ENDS_WITH,CONTAINS. - An
ADVANCEDmode for custom regular expressions. - Text input field for defining the pattern.
- Real-time validation of words in the list when in advanced mode.
- Author:
- Javier Godoy
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.vaadin.flow.component.AbstractField
AbstractField.ComponentValueChangeEvent<C extends Component,V extends Object> Nested classes/interfaces inherited from interface com.vaadin.flow.component.BlurNotifier
BlurNotifier.BlurEvent<C extends Component>Nested classes/interfaces inherited from interface com.vaadin.flow.component.FocusNotifier
FocusNotifier.FocusEvent<C extends Component>Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasValue
HasValue.ValueChangeEvent<V extends Object>, HasValue.ValueChangeListener<E extends HasValue.ValueChangeEvent<?>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected RegularExpressionbooleanbooleanChecks whether the test field is enabled.voidsetOperator(RegularExpressionOperator operator) Sets the regular expression operator for this component.protected voidsetPresentationValue(RegularExpression newPresentationValue) voidsetTestFieldEnabled(boolean enabled) Enables or disables the test field based on the given flag.voidsetTestStrings(String... strings) Sets the test strings for validation using a variable-length argument array.voidsetTestStrings(Collection<String> strings) Sets the test strings for validation using a collection.Methods inherited from class com.vaadin.flow.component.customfield.CustomField
add, addThemeVariants, getLabel, onAttach, 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, focus, 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
isEnabled, setEnabledMethods 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, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, 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, 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, setReadOnly, setRequiredIndicatorVisible
-
Constructor Details
-
RegularExpressionField
public RegularExpressionField()Creates a new instance ofRegularExpressionField.
-
-
Method Details
-
generateModelValue
- Specified by:
generateModelValuein classCustomField<RegularExpression>
-
setPresentationValue
- Specified by:
setPresentationValuein classCustomField<RegularExpression>
-
isInvalid
public boolean isInvalid() -
setTestFieldEnabled
public void setTestFieldEnabled(boolean enabled) Enables or disables the test field based on the given flag.If enabled, the test field is visible only when the selected operator is
RegularExpressionOperator.ADVANCED.- Parameters:
enabled-trueto enable the test field,falseto disable it
-
isTestFieldEnabled
public boolean isTestFieldEnabled()Checks whether the test field is enabled.- Returns:
trueif the test field is enabled, otherwisefalse
-
setOperator
Sets the regular expression operator for this component.- Parameters:
operator- theRegularExpressionOperatorto set
-
setTestStrings
Sets the test strings for validation using a variable-length argument array. The provided strings will be set as selectable test cases in the test field.- Parameters:
strings- the test strings to set
-
setTestStrings
Sets the test strings for validation using a collection. The provided strings will be set as selectable test cases in the test field.- Parameters:
strings- the collection of test strings to set
-