Class IntegerField

  • All Implemented Interfaces:
    com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.BlurNotifier<IntegerField>, com.vaadin.flow.component.CompositionNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.Focusable<IntegerField>, com.vaadin.flow.component.FocusNotifier<IntegerField>, 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<IntegerField,​Integer>,​Integer>, com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<IntegerField,​Integer>,​Integer>, com.vaadin.flow.component.InputNotifier, com.vaadin.flow.component.KeyNotifier, HasAllowedCharPattern, HasClearButton, HasThemeVariant<TextFieldVariant>, HasTooltip, HasAutocapitalize, HasAutocomplete, HasAutocorrect, HasPrefixAndSuffix, com.vaadin.flow.data.binder.HasValidator<Integer>, com.vaadin.flow.data.value.HasValueChangeMode, Serializable

    @Tag("vaadin-integer-field")
    @NpmPackage(value="@vaadin/polymer-legacy-adapter",version="23.6.1") @NpmPackage(value="@vaadin/integer-field",version="23.6.1") @NpmPackage(value="@vaadin/vaadin-text-field",version="23.6.1")
    @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
    • Constructor Detail

      • IntegerField

        public IntegerField()
        Constructs an empty IntegerField.
      • IntegerField

        public IntegerField​(String label)
        Constructs an empty IntegerField with the given label.
        Parameters:
        label - the text to set as the label
      • IntegerField

        public IntegerField​(String label,
                            String placeholder)
        Constructs an empty IntegerField with the given label and placeholder text.
        Parameters:
        label - the text to set as the label
        placeholder - the placeholder text to set
      • IntegerField

        public IntegerField​(com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<IntegerField,​Integer>> listener)
        Constructs an empty IntegerField with a value change listener.
        Parameters:
        listener - the value change listener
        See Also:
        AbstractField.addValueChangeListener(ValueChangeListener)
      • IntegerField

        public IntegerField​(String label,
                            com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<IntegerField,​Integer>> listener)
        Constructs an empty IntegerField with a value change listener and a label.
        Parameters:
        label - the text to set as the label
        listener - the value change listener
        See Also:
        AbstractNumberField.setLabel(String), AbstractField.addValueChangeListener(ValueChangeListener)
      • IntegerField

        public IntegerField​(String label,
                            Integer initialValue,
                            com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<IntegerField,​Integer>> listener)
        Constructs a IntegerField with a value change listener, a label and an initial value.
        Parameters:
        label - the text to set as the label
        initialValue - the initial value
        listener - 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 than min 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 than max 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 the step buttons. It is also used to invalidate the field, if the value doesn't align with the specified step and min (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)