com.vaadin.flow.component.textfield.GeneratedVaadinNumberField Maven / Gradle / Ivy
/**
* Copyright 2000-2024 Vaadin Ltd.
*
* This program is available under Vaadin Commercial License and Service Terms.
*
* See {@literal } for the full
* license.
*/
package com.vaadin.flow.component.textfield;
import com.vaadin.flow.component.HasStyle;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.component.dependency.JsModule;
import com.vaadin.flow.component.dependency.NpmPackage;
import com.vaadin.flow.function.SerializableBiFunction;
import com.vaadin.flow.function.SerializableFunction;
/**
*
* Description copied from corresponding location in WebComponent:
*
*
* {@code } is a Polymer 2 element for number field control
* in forms.
*
*
* <vaadin-number-field label="Number">
* </vaadin-number-field>
*
*/
@Tag("vaadin-number-field")
@NpmPackage(value = "@vaadin/vaadin-text-field", version = "2.10.0")
@JsModule("@vaadin/vaadin-text-field/src/vaadin-number-field.js")
public abstract class GeneratedVaadinNumberField, T>
extends GeneratedVaadinTextField implements HasStyle {
/**
*
* Description copied from corresponding location in WebComponent:
*
*
* Set to true to display value increase/decrease controls.
*
* This property is not synchronized automatically from the client side, so
* the returned value may not be the same as in client side.
*
*
* @return the {@code hasControls} property from the webcomponent
*/
protected boolean hasControlsBoolean() {
return getElement().getProperty("hasControls", false);
}
/**
*
* Description copied from corresponding location in WebComponent:
*
*
* Set to true to display value increase/decrease controls.
*
*
* @param hasControls
* the boolean value to set
*/
protected void setHasControls(boolean hasControls) {
getElement().setProperty("hasControls", hasControls);
}
/**
*
* Description copied from corresponding location in WebComponent:
*
*
* The minimum value of the field.
*
* This property is not synchronized automatically from the client side, so
* the returned value may not be the same as in client side.
*
*
* @return the {@code min} property from the webcomponent
*/
protected double getMinDouble() {
return getElement().getProperty("min", 0.0);
}
/**
*
* Description copied from corresponding location in WebComponent:
*
*
* The minimum value of the field.
*
*
* @param min
* the double value to set
*/
protected void setMin(double min) {
getElement().setProperty("min", min);
}
/**
*
* Description copied from corresponding location in WebComponent:
*
*
* The maximum value of the field.
*
* This property is not synchronized automatically from the client side, so
* the returned value may not be the same as in client side.
*
*
* @return the {@code max} property from the webcomponent
*/
protected double getMaxDouble() {
return getElement().getProperty("max", 0.0);
}
/**
*
* Description copied from corresponding location in WebComponent:
*
*
* The maximum value of the field.
*
*
* @param max
* the double value to set
*/
protected void setMax(double max) {
getElement().setProperty("max", max);
}
/**
*
* Description copied from corresponding location in WebComponent:
*
*
* Specifies the allowed number intervals of the field.
*
* This property is not synchronized automatically from the client side, so
* the returned value may not be the same as in client side.
*
*
* @return the {@code step} property from the webcomponent
*/
protected double getStepDouble() {
return getElement().getProperty("step", 0.0);
}
/**
*
* Description copied from corresponding location in WebComponent:
*
*
* Specifies the allowed number intervals of the field.
*
*
* @param step
* the double value to set
*/
protected void setStep(double step) {
getElement().setProperty("step", step);
}
@Override
protected void checkValidity() {
getElement().callFunction("checkValidity");
}
/**
* Constructs a new GeneratedVaadinNumberField component with the given
* arguments.
*
* @param initialValue
* the initial value to set to the value
* @param defaultValue
* the default value to use if the value isn't defined
* @param elementPropertyType
* the type of the element property
* @param presentationToModel
* a function that converts a string value to a model value
* @param modelToPresentation
* a function that converts a model value to a string value
* @param
* the property type
*/
public
GeneratedVaadinNumberField(T initialValue, T defaultValue,
Class
elementPropertyType,
SerializableFunction
presentationToModel,
SerializableFunction modelToPresentation) {
super(initialValue, defaultValue, elementPropertyType,
presentationToModel, modelToPresentation);
}
/**
* Constructs a new GeneratedVaadinNumberField component with the given
* arguments.
*
* @param initialValue
* the initial value to set to the value
* @param defaultValue
* the default value to use if the value isn't defined
* @param acceptNullValues
* whether null
is accepted as a model value
*/
public GeneratedVaadinNumberField(T initialValue, T defaultValue,
boolean acceptNullValues) {
super(initialValue, defaultValue, acceptNullValues);
}
/**
* Constructs a new GeneratedVaadinNumberField component with the given
* arguments.
*
* @param initialValue
* the initial value to set to the value
* @param defaultValue
* the default value to use if the value isn't defined
* @param elementPropertyType
* the type of the element property
* @param presentationToModel
* a function that accepts this component and a property value
* and returns a model value
* @param modelToPresentation
* a function that accepts this component and a model value and
* returns a property value
* @param
* the property type
*/
public
GeneratedVaadinNumberField(T initialValue, T defaultValue,
Class
elementPropertyType,
SerializableBiFunction presentationToModel,
SerializableBiFunction modelToPresentation) {
super(initialValue, defaultValue, elementPropertyType,
presentationToModel, modelToPresentation);
}
/**
* Default constructor.
*/
public GeneratedVaadinNumberField() {
this(null, null, null, (SerializableFunction) null,
(SerializableFunction) null);
}
}