Package com.vaadin.flow.component.html
Class Input
- java.lang.Object
-
- com.vaadin.flow.component.Component
-
- com.vaadin.flow.component.AbstractField<C,T>
-
- com.vaadin.flow.component.AbstractSinglePropertyField<Input,String>
-
- com.vaadin.flow.component.html.Input
-
- All Implemented Interfaces:
AttachNotifier
,BlurNotifier<Input>
,DetachNotifier
,Focusable<Input>
,FocusNotifier<Input>
,HasAriaLabel
,HasElement
,HasEnabled
,HasSize
,HasStyle
,HasValue<AbstractField.ComponentValueChangeEvent<Input,String>,String>
,HasValueAndElement<AbstractField.ComponentValueChangeEvent<Input,String>,String>
,HasValueChangeMode
,Serializable
@Tag("input") public class Input extends AbstractSinglePropertyField<Input,String> implements Focusable<Input>, HasSize, HasStyle, HasValueChangeMode, HasAriaLabel
Component representing an<input>
element.- Since:
- 1.0
- Author:
- Vaadin Ltd
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
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.data.value.HasValueChangeMode
DEFAULT_CHANGE_TIMEOUT
-
-
Constructor Summary
Constructors Constructor Description Input()
Creates a new input without any specific type, withON_CHANGE
value change mode.Input(ValueChangeMode valueChangeMode)
Creates a new input without any specific type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<String>
getPlaceholder()
Gets the placeholder text.String
getType()
Gets the type of this input.ValueChangeMode
getValueChangeMode()
Gets current value change mode of the component.int
getValueChangeTimeout()
Returns the currently set timeout, for how oftenHasValue.ValueChangeEvent
s are triggered when the ValueChangeMode is set toValueChangeMode.LAZY
, orValueChangeMode.TIMEOUT
.void
setPlaceholder(String placeholder)
Sets the placeholder text that is shown if the input is empty.void
setType(String type)
Sets the type of this input.void
setValueChangeMode(ValueChangeMode valueChangeMode)
Sets new value change mode for the component.void
setValueChangeTimeout(int valueChangeTimeout)
Sets how oftenHasValue.ValueChangeEvent
s are triggered when the ValueChangeMode is set toValueChangeMode.LAZY
, orValueChangeMode.TIMEOUT
.-
Methods inherited from class com.vaadin.flow.component.AbstractSinglePropertyField
getSynchronizationRegistration, hasValidValue, setPresentationValue, setSynchronizedEvent
-
Methods inherited from class com.vaadin.flow.component.AbstractField
addValueChangeListener, getEmptyValue, getValue, isEmpty, setModelValue, setValue, 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, onAttach, 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.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.HasAriaLabel
getAriaLabel, setAriaLabel
-
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.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.HasValue
clear, getOptionalValue
-
Methods inherited from interface com.vaadin.flow.component.HasValueAndElement
isReadOnly, isRequiredIndicatorVisible, setReadOnly, setRequiredIndicatorVisible
-
-
-
-
Constructor Detail
-
Input
public Input()
Creates a new input without any specific type, withON_CHANGE
value change mode.
-
Input
public Input(ValueChangeMode valueChangeMode)
Creates a new input without any specific type.- Parameters:
valueChangeMode
- initial value change mode, ornull
to disable the value synchronization
-
-
Method Detail
-
setPlaceholder
public void setPlaceholder(String placeholder)
Sets the placeholder text that is shown if the input is empty.- Parameters:
placeholder
- the placeholder text to set, ornull
to remove the placeholder
-
getPlaceholder
public Optional<String> getPlaceholder()
Gets the placeholder text.- Returns:
- an optional placeholder, or an empty optional if no placeholder has been set
- See Also:
setPlaceholder(String)
-
setType
public void setType(String type)
Sets the type of this input.- Parameters:
type
- the type, notnull
- See Also:
- Overview of supported type values
-
getType
public String getType()
Gets the type of this input.- Returns:
- the input type, by default "text"
-
getValueChangeMode
public ValueChangeMode getValueChangeMode()
Description copied from interface:HasValueChangeMode
Gets current value change mode of the component.- Specified by:
getValueChangeMode
in interfaceHasValueChangeMode
- Returns:
- current value change mode of the component, or
null
if the value is not synchronized
-
setValueChangeMode
public void setValueChangeMode(ValueChangeMode valueChangeMode)
Description copied from interface:HasValueChangeMode
Sets new value change mode for the component.- Specified by:
setValueChangeMode
in interfaceHasValueChangeMode
- Parameters:
valueChangeMode
- new value change mode, ornull
to disable the value synchronization
-
setValueChangeTimeout
public void setValueChangeTimeout(int valueChangeTimeout)
Description copied from interface:HasValueChangeMode
Sets how oftenHasValue.ValueChangeEvent
s are triggered when the ValueChangeMode is set toValueChangeMode.LAZY
, orValueChangeMode.TIMEOUT
.Implementations should use
ValueChangeMode.applyChangeTimeout(ValueChangeMode, int, DomListenerRegistration)
.- Specified by:
setValueChangeTimeout
in interfaceHasValueChangeMode
- Parameters:
valueChangeTimeout
- the timeout in milliseconds of how oftenHasValue.ValueChangeEvent
s are triggered.
-
getValueChangeTimeout
public int getValueChangeTimeout()
Returns the currently set timeout, for how oftenHasValue.ValueChangeEvent
s are triggered when the ValueChangeMode is set toValueChangeMode.LAZY
, orValueChangeMode.TIMEOUT
.The default value is
HasValueChangeMode.DEFAULT_CHANGE_TIMEOUT
.- Specified by:
getValueChangeTimeout
in interfaceHasValueChangeMode
- Returns:
- the timeout in milliseconds of how often
HasValue.ValueChangeEvent
s are triggered.
-
-