Class IntegerField
- 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<R,T>
-
- com.vaadin.flow.component.textfield.GeneratedVaadinNumberField<C,T>
-
- com.vaadin.flow.component.textfield.AbstractNumberField<IntegerField,Integer>
-
- com.vaadin.flow.component.textfield.IntegerField
-
- All Implemented Interfaces:
AttachNotifier
,BlurNotifier<IntegerField>
,CompositionNotifier
,DetachNotifier
,Focusable<IntegerField>
,FocusNotifier<IntegerField>
,HasElement
,HasEnabled
,HasHelper
,HasLabel
,HasSize
,HasStyle
,HasTheme
,HasValidation
,HasValue<AbstractField.ComponentValueChangeEvent<IntegerField,Integer>,Integer>
,HasValueAndElement<AbstractField.ComponentValueChangeEvent<IntegerField,Integer>,Integer>
,InputNotifier
,KeyNotifier
,HasAllowedCharPattern
,HasClearButton
,HasThemeVariant<TextFieldVariant>
,HasTooltip
,HasAutocapitalize
,HasAutocomplete
,HasAutocorrect
,HasPrefixAndSuffix
,HasValidator<Integer>
,HasValueChangeMode
,Serializable
@Tag("vaadin-integer-field") @NpmPackage(value="@vaadin/polymer-legacy-adapter",version="23.5.12") @NpmPackage(value="@vaadin/integer-field",version="23.5.12") @NpmPackage(value="@vaadin/vaadin-text-field",version="23.5.12") @JsModule("@vaadin/polymer-legacy-adapter/style-modules.js") @JsModule("@vaadin/integer-field/src/vaadin-integer-field.js") public class IntegerField extends AbstractNumberField<IntegerField,Integer>
IntegerField is an extension of Text Field that only accepts integer numbers.- Author:
- Vaadin Ltd.
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.vaadin.flow.component.textfield.GeneratedVaadinTextField
GeneratedVaadinTextField.ChangeEvent<R extends GeneratedVaadinTextField<R,?>>, GeneratedVaadinTextField.InvalidChangeEvent<R extends GeneratedVaadinTextField<R,?>>
-
Nested classes/interfaces inherited from class com.vaadin.flow.component.AbstractField
AbstractField.ComponentValueChangeEvent<C extends Component,V>
-
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>, HasValue.ValueChangeListener<E extends 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 com.vaadin.flow.data.value.HasValueChangeMode
DEFAULT_CHANGE_TIMEOUT
-
-
Constructor Summary
Constructors Constructor Description IntegerField()
Constructs an emptyIntegerField
.IntegerField(HasValue.ValueChangeListener<? super AbstractField.ComponentValueChangeEvent<IntegerField,Integer>> listener)
Constructs an emptyIntegerField
with a value change listener.IntegerField(String label)
Constructs an emptyIntegerField
with the given label.IntegerField(String label, HasValue.ValueChangeListener<? super AbstractField.ComponentValueChangeEvent<IntegerField,Integer>> listener)
Constructs an emptyIntegerField
with a value change listener and a label.IntegerField(String label, Integer initialValue, HasValue.ValueChangeListener<? super AbstractField.ComponentValueChangeEvent<IntegerField,Integer>> listener)
Constructs aIntegerField
with a value change listener, a label and an initial value.IntegerField(String label, String placeholder)
Constructs an emptyIntegerField
with the given label and placeholder text.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getMax()
Gets the maximum allowed value of the field.int
getMin()
Gets the minimum allowed value of the field.int
getStep()
Gets the allowed number intervals of the field.void
setMax(int max)
Sets the maximum value of the field.void
setMin(int min)
Sets the minimum value of the field.void
setStep(int step)
Sets the allowed number intervals of the field.-
Methods inherited from class com.vaadin.flow.component.textfield.AbstractNumberField
addThemeVariants, getDefaultValidator, getEmptyValue, getErrorMessage, getLabel, getMaxDouble, getMinDouble, getPlaceholder, getStepDouble, getTitle, getValue, getValueChangeMode, getValueChangeTimeout, hasControls, isAutofocus, isAutoselect, isFeatureFlagEnabled, isInvalid, isStepButtonsVisible, onAttach, removeThemeVariants, setAutofocus, setAutoselect, setErrorMessage, setHasControls, setInvalid, setLabel, setMax, setMin, setPlaceholder, setRequiredIndicatorVisible, setStep, setStepButtonsVisible, setTitle, setValue, setValueChangeMode, setValueChangeTimeout, validate
-
Methods inherited from class com.vaadin.flow.component.textfield.GeneratedVaadinNumberField
checkValidity, hasControlsBoolean
-
Methods inherited from class com.vaadin.flow.component.textfield.GeneratedVaadinTextField
addChangeListener, addInvalidChangeListener, addToInput, addToPrefix, addToSuffix, 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, setPattern, setPreventInvalidInput, setReadonly, setRequired
-
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, onDetach, 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 com.vaadin.flow.component.AttachNotifier
addAttachListener
-
Methods inherited from interface com.vaadin.flow.component.BlurNotifier
addBlurListener
-
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.HasClearButton
isClearButtonVisible, setClearButtonVisible
-
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 com.vaadin.flow.component.textfield.HasPrefixAndSuffix
getPrefixComponent, getSuffixComponent, setPrefixComponent, setSuffixComponent
-
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.data.binder.HasValidator
addValidationStatusChangeListener
-
Methods inherited from interface com.vaadin.flow.component.HasValue
clear, getOptionalValue
-
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
-
-
-
-
Constructor Detail
-
IntegerField
public IntegerField()
Constructs an emptyIntegerField
.
-
IntegerField
public IntegerField(String label)
Constructs an emptyIntegerField
with the given label.- Parameters:
label
- the text to set as the label
-
IntegerField
public IntegerField(String label, String placeholder)
Constructs an emptyIntegerField
with the given label and placeholder text.- Parameters:
label
- the text to set as the labelplaceholder
- the placeholder text to set
-
IntegerField
public IntegerField(HasValue.ValueChangeListener<? super AbstractField.ComponentValueChangeEvent<IntegerField,Integer>> listener)
Constructs an emptyIntegerField
with a value change listener.- Parameters:
listener
- the value change listener- See Also:
AbstractField.addValueChangeListener(ValueChangeListener)
-
IntegerField
public IntegerField(String label, HasValue.ValueChangeListener<? super AbstractField.ComponentValueChangeEvent<IntegerField,Integer>> listener)
Constructs an emptyIntegerField
with a value change listener and a label.- Parameters:
label
- the text to set as the labellistener
- the value change listener- See Also:
AbstractNumberField.setLabel(String)
,AbstractField.addValueChangeListener(ValueChangeListener)
-
IntegerField
public IntegerField(String label, Integer initialValue, HasValue.ValueChangeListener<? super AbstractField.ComponentValueChangeEvent<IntegerField,Integer>> listener)
Constructs aIntegerField
with a value change listener, a label and an initial value.- Parameters:
label
- the text to set as the labelinitialValue
- the initial valuelistener
- the value change listener- See Also:
AbstractNumberField.setLabel(String)
,AbstractField.setValue(Object)
,AbstractField.addValueChangeListener(ValueChangeListener)
-
-
Method Detail
-
setMin
public void setMin(int min)
Sets the minimum value of the field. Entering a value which is smaller thanmin
invalidates the field.- Parameters:
min
- the min value to set
-
getMin
public int getMin()
Gets the minimum allowed value of the field.- Returns:
- the min property of the field
- See Also:
setMin(int)
-
setMax
public void setMax(int max)
Sets the maximum value of the field. Entering a value which is greater thanmax
invalidates the field.- Parameters:
max
- the max value to set
-
getMax
public int getMax()
Gets the maximum allowed value of the field.- Returns:
- the max property of the field
- See Also:
setMax(int)
-
setStep
public void setStep(int step)
Sets the allowed number intervals of the field. This specifies how much the value will be increased/decreased when clicking on thestep buttons
. It is also used to invalidate the field, if the value doesn't align with the specified step andmin
(if specified by user).- Parameters:
step
- the new step to set- Throws:
IllegalArgumentException
- if the argument is less or equal to zero.
-
getStep
public int getStep()
Gets the allowed number intervals of the field.- Returns:
- the step property of the field
- See Also:
setStep(int)
-
-