类 GeneratedVaadinTimePicker<R extends GeneratedVaadinTimePicker<R,T>,T>
- 所有已实现的接口:
com.vaadin.flow.component.AttachNotifier
,com.vaadin.flow.component.BlurNotifier<R>
,com.vaadin.flow.component.DetachNotifier
,com.vaadin.flow.component.Focusable<R>
,com.vaadin.flow.component.FocusNotifier<R>
,com.vaadin.flow.component.HasElement
,com.vaadin.flow.component.HasEnabled
,com.vaadin.flow.component.HasStyle
,com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<R,T>,T>
,com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<R,T>,T>
,java.io.Serializable
- 直接已知子类:
TimePicker
@Generated({"Generator: com.vaadin.generator.ComponentGenerator#2.0-SNAPSHOT","WebComponent: Vaadin.TimePickerElement#2.0.0","Flow#2.0-SNAPSHOT"})
@Tag("vaadin-time-picker")
@NpmPackage(value="@vaadin/vaadin-time-picker",
version="2.3.0")
@JsModule("@vaadin/vaadin-time-picker/src/vaadin-time-picker.js")
public abstract class GeneratedVaadinTimePicker<R extends GeneratedVaadinTimePicker<R,T>,T>
extends com.vaadin.flow.component.AbstractSinglePropertyField<R,T>
implements com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.Focusable<R>
Description copied from corresponding location in WebComponent:
<vaadin-time-picker>
is a Web Component providing a time-selection
field.
<vaadin-time-picker></vaadin-time-picker>
timePicker.value = '14:30';
When the selected value
is changed, a value-changed
event is
triggered.
Styling
The following custom properties are available for styling:
Part name | Description |
---|---|
toggle-button |
The toggle button |
See ThemableMixin – how to apply styles for shadow parts
The following state attributes are available for styling:
Attribute | Description | Part name |
---|---|---|
disabled |
Set to a disabled time picker | :host |
readonly |
Set to a read only time picker | :host |
invalid |
Set when the element is invalid | :host |
focused |
Set when the element is focused | :host |
focus-ring |
Set when the element is keyboard focused | :host |
In addition to <vaadin-time-picker>
itself, the following internal
components are themable:
<vaadin-time-picker-text-field>
, see<vaadin-text-field>
documentation for the text field parts.<vaadin-combo-box-light>
, see<vaadin-combo-box>
documentation for the combo box parts.
Note: the theme
attribute value set on <vaadin-time-picker>
is propagated to the internal themable components listed above.
- 另请参阅:
- 序列化表格
-
嵌套类概要
嵌套类 修饰符和类型 类 说明 static class
GeneratedVaadinTimePicker.InvalidChangeEvent<R extends GeneratedVaadinTimePicker<R,?>>
从类继承的嵌套类/接口 com.vaadin.flow.component.AbstractField
com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<C extends com.vaadin.flow.component.Component,V extends java.lang.Object>
从接口继承的嵌套类/接口 com.vaadin.flow.component.BlurNotifier
com.vaadin.flow.component.BlurNotifier.BlurEvent<C extends com.vaadin.flow.component.Component>
-
构造器概要
构造器 构造器 说明 GeneratedVaadinTimePicker()
Default constructor.GeneratedVaadinTimePicker(T initialValue, T defaultValue, boolean acceptNullValues)
Constructs a new GeneratedVaadinTimePicker component with the given arguments.GeneratedVaadinTimePicker(T initialValue, T defaultValue, java.lang.Class<P> elementPropertyType, com.vaadin.flow.function.SerializableBiFunction<R,P,T> presentationToModel, com.vaadin.flow.function.SerializableBiFunction<R,T,P> modelToPresentation)
Constructs a new GeneratedVaadinTimePicker component with the given arguments.GeneratedVaadinTimePicker(T initialValue, T defaultValue, java.lang.Class<P> elementPropertyType, com.vaadin.flow.function.SerializableFunction<P,T> presentationToModel, com.vaadin.flow.function.SerializableFunction<T,P> modelToPresentation)
Constructs a new GeneratedVaadinTimePicker component with the given arguments.GeneratedVaadinTimePicker(T initialValue, T defaultValue, java.lang.Class<P> elementPropertyType, com.vaadin.flow.function.SerializableFunction<P,T> presentationToModel, com.vaadin.flow.function.SerializableFunction<T,P> modelToPresentation, boolean isInitialValueOptional)
Constructs a new GeneratedVaadinTimePicker component with the given arguments. -
方法概要
修饰符和类型 方法 说明 protected com.vaadin.flow.shared.Registration
addInvalidChangeListener(com.vaadin.flow.component.ComponentEventListener<GeneratedVaadinTimePicker.InvalidChangeEvent<R>> listener)
Adds a listener forinvalid-changed
events fired by the webcomponent.protected void
checkValidity()
Description copied from corresponding location in WebComponent:protected java.lang.String
getErrorMessageString()
Description copied from corresponding location in WebComponent:protected elemental.json.JsonObject
getI18nJsonObject()
Description copied from corresponding location in WebComponent:protected java.lang.String
getLabelString()
Description copied from corresponding location in WebComponent:protected java.lang.String
getMaxString()
Description copied from corresponding location in WebComponent:protected java.lang.String
getMinString()
Description copied from corresponding location in WebComponent:protected java.lang.String
getNameString()
Description copied from corresponding location in WebComponent:protected java.lang.String
getPatternString()
Description copied from corresponding location in WebComponent:protected java.lang.String
getPlaceholderString()
Description copied from corresponding location in WebComponent:protected double
getStepDouble()
Description copied from corresponding location in WebComponent:protected boolean
isAutofocusBoolean()
Description copied from corresponding location in WebComponent:protected boolean
isClearButtonVisibleBoolean()
Description copied from corresponding location in WebComponent:protected boolean
isDisabledBoolean()
Description copied from corresponding location in WebComponent:protected boolean
isInvalidBoolean()
Description copied from corresponding location in WebComponent:protected boolean
isPreventInvalidInputBoolean()
Description copied from corresponding location in WebComponent:protected boolean
isReadonlyBoolean()
Description copied from corresponding location in WebComponent:protected boolean
isRequiredBoolean()
Description copied from corresponding location in WebComponent:protected void
setAutofocus(boolean autofocus)
Description copied from corresponding location in WebComponent:protected void
setClearButtonVisible(boolean clearButtonVisible)
Description copied from corresponding location in WebComponent:protected void
setDisabled(boolean disabled)
Description copied from corresponding location in WebComponent:protected void
setErrorMessage(java.lang.String errorMessage)
Description copied from corresponding location in WebComponent:protected void
setHour12Format(boolean hour12)
Is use 12 hours format Value Format true 11:23:45 PM false 23:23:45 PMprotected void
setI18n(elemental.json.JsonObject i18n)
Description copied from corresponding location in WebComponent:protected void
setInvalid(boolean invalid)
Description copied from corresponding location in WebComponent:protected void
setLabel(java.lang.String label)
Description copied from corresponding location in WebComponent:protected void
setMax(java.lang.String max)
Description copied from corresponding location in WebComponent:protected void
setMin(java.lang.String min)
Description copied from corresponding location in WebComponent:protected void
setName(java.lang.String name)
Description copied from corresponding location in WebComponent:protected void
setPattern(java.lang.String pattern)
Description copied from corresponding location in WebComponent:protected void
setPlaceholder(java.lang.String placeholder)
Description copied from corresponding location in WebComponent:protected void
setPreventInvalidInput(boolean preventInvalidInput)
Description copied from corresponding location in WebComponent:protected void
setReadonly(boolean readonly)
Description copied from corresponding location in WebComponent:protected void
setRequired(boolean required)
Description copied from corresponding location in WebComponent:protected void
setStep(double step)
Description copied from corresponding location in WebComponent:protected void
validate()
Description copied from corresponding location in WebComponent:从类继承的方法 com.vaadin.flow.component.AbstractSinglePropertyField
getSynchronizationRegistration, hasValidValue, setPresentationValue, setSynchronizedEvent
从类继承的方法 com.vaadin.flow.component.AbstractField
addValueChangeListener, getEmptyValue, getValue, isEmpty, setModelValue, setValue, valueEquals
从类继承的方法 com.vaadin.flow.component.Component
addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getUI, hasListener, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, set, setElement, setId, setVisible
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 com.vaadin.flow.component.Focusable
addFocusShortcut, blur, focus, getTabIndex, setTabIndex
-
构造器详细资料
-
GeneratedVaadinTimePicker
public GeneratedVaadinTimePicker(T initialValue, T defaultValue, java.lang.Class<P> elementPropertyType, com.vaadin.flow.function.SerializableFunction<P,T> presentationToModel, com.vaadin.flow.function.SerializableFunction<T,P> modelToPresentation, boolean isInitialValueOptional)Constructs a new GeneratedVaadinTimePicker component with the given arguments.If
isInitialValueOptional
istrue
then the initial value is used only if element has no"value"
property value, otherwise element"value"
property is ignored and the initial value is set.- 类型参数:
P
- the property type- 参数:
initialValue
- the initial value to set to the valuedefaultValue
- the default value to use if the value isn't definedelementPropertyType
- the type of the element propertypresentationToModel
- a function that converts a string value to a model valuemodelToPresentation
- a function that converts a model value to a string valueisInitialValueOptional
- ifisInitialValueOptional
istrue
then the initial value is used only if element has no"value"
property value, otherwise element"value"
property is ignored and the initial value is set <<<<<<< HEAD
-
GeneratedVaadinTimePicker
public GeneratedVaadinTimePicker(T initialValue, T defaultValue, java.lang.Class<P> elementPropertyType, com.vaadin.flow.function.SerializableFunction<P,T> presentationToModel, com.vaadin.flow.function.SerializableFunction<T,P> modelToPresentation)Constructs a new GeneratedVaadinTimePicker component with the given arguments.- 类型参数:
P
- the property type- 参数:
initialValue
- the initial value to set to the valuedefaultValue
- the default value to use if the value isn't definedelementPropertyType
- the type of the element propertypresentationToModel
- a function that converts a string value to a model valuemodelToPresentation
- a function that converts a model value to a string value
-
GeneratedVaadinTimePicker
Constructs a new GeneratedVaadinTimePicker component with the given arguments.- 参数:
initialValue
- the initial value to set to the valuedefaultValue
- the default value to use if the value isn't definedacceptNullValues
- whethernull
is accepted as a model value
-
GeneratedVaadinTimePicker
public GeneratedVaadinTimePicker(T initialValue, T defaultValue, java.lang.Class<P> elementPropertyType, com.vaadin.flow.function.SerializableBiFunction<R,P,T> presentationToModel, com.vaadin.flow.function.SerializableBiFunction<R,T,P> modelToPresentation)Constructs a new GeneratedVaadinTimePicker component with the given arguments.- 类型参数:
P
- the property type- 参数:
initialValue
- the initial value to set to the valuedefaultValue
- the default value to use if the value isn't definedelementPropertyType
- the type of the element propertypresentationToModel
- a function that accepts this component and a property value and returns a model valuemodelToPresentation
- a function that accepts this component and a model value and returns a property value
-
GeneratedVaadinTimePicker
public GeneratedVaadinTimePicker()Default constructor.
-
-
方法详细资料
-
isAutofocusBoolean
protected boolean isAutofocusBoolean()Description copied from corresponding location in WebComponent:
Specify that this control should have input focus when the page loads.
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
- 返回:
- the
autofocus
property from the webcomponent
-
setAutofocus
protected void setAutofocus(boolean autofocus)Description copied from corresponding location in WebComponent:
Specify that this control should have input focus when the page loads.
- 参数:
autofocus
- the boolean value to set
-
isDisabledBoolean
protected boolean isDisabledBoolean()Description copied from corresponding location in WebComponent:
Set to true to disable this input.
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
- 返回:
- the
disabled
property from the webcomponent
-
setDisabled
protected void setDisabled(boolean disabled)Description copied from corresponding location in WebComponent:
Set to true to disable this input.
- 参数:
disabled
- the boolean value to set
-
getNameString
protected java.lang.String getNameString()Description copied from corresponding location in WebComponent:
The name of this element.
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
- 返回:
- the
name
property from the webcomponent
-
setName
protected void setName(java.lang.String name)Description copied from corresponding location in WebComponent:
The name of this element.
- 参数:
name
- the String value to set
-
getLabelString
protected java.lang.String getLabelString()Description copied from corresponding location in WebComponent:
The label for this element.
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
- 返回:
- the
label
property from the webcomponent
-
setLabel
protected void setLabel(java.lang.String label)Description copied from corresponding location in WebComponent:
The label for this element.
- 参数:
label
- the String value to set
-
isRequiredBoolean
protected boolean isRequiredBoolean()Description copied from corresponding location in WebComponent:
Set to true to mark the input as required.
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
- 返回:
- the
required
property from the webcomponent
-
setRequired
protected void setRequired(boolean required)Description copied from corresponding location in WebComponent:
Set to true to mark the input as required.
- 参数:
required
- the boolean value to set
-
isPreventInvalidInputBoolean
protected boolean isPreventInvalidInputBoolean()Description copied from corresponding location in WebComponent:
Set to true to prevent the user from entering invalid input.
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
- 返回:
- the
preventInvalidInput
property from the webcomponent
-
setPreventInvalidInput
protected void setPreventInvalidInput(boolean preventInvalidInput)Description copied from corresponding location in WebComponent:
Set to true to prevent the user from entering invalid input.
- 参数:
preventInvalidInput
- the boolean value to set
-
getPatternString
protected java.lang.String getPatternString()Description copied from corresponding location in WebComponent:
A pattern to validate the
input
with.This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
- 返回:
- the
pattern
property from the webcomponent
-
setPattern
protected void setPattern(java.lang.String pattern)Description copied from corresponding location in WebComponent:
A pattern to validate the
input
with.- 参数:
pattern
- the String value to set
-
getErrorMessageString
protected java.lang.String getErrorMessageString()Description copied from corresponding location in WebComponent:
The error message to display when the input is invalid.
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
- 返回:
- the
errorMessage
property from the webcomponent
-
setErrorMessage
protected void setErrorMessage(java.lang.String errorMessage)Description copied from corresponding location in WebComponent:
The error message to display when the input is invalid.
- 参数:
errorMessage
- the String value to set
-
getPlaceholderString
protected java.lang.String getPlaceholderString()Description copied from corresponding location in WebComponent:
A placeholder string in addition to the label.
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
- 返回:
- the
placeholder
property from the webcomponent
-
setPlaceholder
protected void setPlaceholder(java.lang.String placeholder)Description copied from corresponding location in WebComponent:
A placeholder string in addition to the label.
- 参数:
placeholder
- the String value to set
-
isReadonlyBoolean
protected boolean isReadonlyBoolean()Description copied from corresponding location in WebComponent:
Set to true to prevent user picking a date or typing in the input.
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
- 返回:
- the
readonly
property from the webcomponent
-
setReadonly
protected void setReadonly(boolean readonly)Description copied from corresponding location in WebComponent:
Set to true to prevent user picking a date or typing in the input.
- 参数:
readonly
- the boolean value to set
-
isInvalidBoolean
protected boolean isInvalidBoolean()Description copied from corresponding location in WebComponent:
Set to true if the value is invalid.
This property is synchronized automatically from client side when a 'invalid-changed' event happens.
- 返回:
- the
invalid
property from the webcomponent
-
setInvalid
protected void setInvalid(boolean invalid)Description copied from corresponding location in WebComponent:
Set to true if the value is invalid.
- 参数:
invalid
- the boolean value to set
-
getMinString
protected java.lang.String getMinString()Description copied from corresponding location in WebComponent:
Minimum time allowed.
Supported time formats are in ISO 8601:
hh:mm
hh:mm:ss
hh:mm:ss.fff
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
- 返回:
- the
min
property from the webcomponent
-
setMin
protected void setMin(java.lang.String min)Description copied from corresponding location in WebComponent:
Minimum time allowed.
Supported time formats are in ISO 8601:
hh:mm
hh:mm:ss
hh:mm:ss.fff
- 参数:
min
- the String value to set
-
getMaxString
protected java.lang.String getMaxString()Description copied from corresponding location in WebComponent:
Maximum time allowed.
Supported time formats are in ISO 8601:
hh:mm
hh:mm:ss
hh:mm:ss.fff
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
- 返回:
- the
max
property from the webcomponent
-
setMax
protected void setMax(java.lang.String max)Description copied from corresponding location in WebComponent:
Maximum time allowed.
Supported time formats are in ISO 8601:
hh:mm
hh:mm:ss
hh:mm:ss.fff
- 参数:
max
- the String value to set
-
getStepDouble
protected double getStepDouble()Description copied from corresponding location in WebComponent:
Specifies the number of valid intervals in a day used for configuring the items displayed in the selection box.
It also configures the precision of the value string. By default the component formats values as
hh:mm
but setting a step value lower than one minute or one second, format resolution changes tohh:mm:ss
andhh:mm:ss.fff
respectively.Unit must be set in seconds, and for correctly configuring intervals in the dropdown, it need to evenly divide a day.
Note: it is possible to define step that is dividing an hour in inexact fragments (i.e. 5760 seconds which equals 1 hour 36 minutes), but it is not recommended to use it for better UX experience.
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
- 返回:
- the
step
property from the webcomponent
-
setStep
protected void setStep(double step)Description copied from corresponding location in WebComponent:
Specifies the number of valid intervals in a day used for configuring the items displayed in the selection box.
It also configures the precision of the value string. By default the component formats values as
hh:mm
but setting a step value lower than one minute or one second, format resolution changes tohh:mm:ss
andhh:mm:ss.fff
respectively.Unit must be set in seconds, and for correctly configuring intervals in the dropdown, it need to evenly divide a day.
Note: it is possible to define step that is dividing an hour in inexact fragments (i.e. 5760 seconds which equals 1 hour 36 minutes), but it is not recommended to use it for better UX experience.
- 参数:
step
- the double value to set
-
setHour12Format
protected void setHour12Format(boolean hour12)Is use 12 hours formatValue Format true 11:23:45 PM false 23:23:45 PM - 参数:
hour12
- use 12 hours format
-
isClearButtonVisibleBoolean
protected boolean isClearButtonVisibleBoolean()Description copied from corresponding location in WebComponent:
Set to true to display the clear icon which clears the input.
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
- 返回:
- the
clearButtonVisible
property from the webcomponent
-
setClearButtonVisible
protected void setClearButtonVisible(boolean clearButtonVisible)Description copied from corresponding location in WebComponent:
Set to true to display the clear icon which clears the input.
- 参数:
clearButtonVisible
- the boolean value to set
-
getI18nJsonObject
protected elemental.json.JsonObject getI18nJsonObject()Description copied from corresponding location in WebComponent:
The object used to localize this component. To change the default localization, replace the entire i18n object or just the property you want to modify.
The object has the following JSON structure:
{ // A function to format given
Object
as // time string. Object is in the format{ hours: ..., minutes: ..., seconds: ..., milliseconds: ... }
formatTime: (time) => { // returns a string representation of the given // object inhh
/ 'hh:mm' / 'hh:mm:ss' / 'hh:mm:ss.fff' - formats }, // A function to parse the given text to anObject
in the format //{ hours: ..., minutes: ..., seconds: ..., milliseconds: ... }
. // Must properly parse (at least) text // formatted byformatTime
. parseTime: text => { // Parses a string in object/string that can be formatted byformatTime
. } // Translation of the time selector icon button title. selector: 'Time selector', // Translation of the time selector clear button title. clear: 'Clear' } <p>This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.- 返回:
- the
i18n
property from the webcomponent
-
setI18n
protected void setI18n(elemental.json.JsonObject i18n)Description copied from corresponding location in WebComponent:
The object used to localize this component. To change the default localization, replace the entire i18n object or just the property you want to modify.
The object has the following JSON structure:
{ // A function to format given
Object
as // time string. Object is in the format{ hours: ..., minutes: ..., seconds: ..., milliseconds: ... }
formatTime: (time) => { // returns a string representation of the given // object inhh
/ 'hh:mm' / 'hh:mm:ss' / 'hh:mm:ss.fff' - formats }, // A function to parse the given text to anObject
in the format //{ hours: ..., minutes: ..., seconds: ..., milliseconds: ... }
. // Must properly parse (at least) text // formatted byformatTime
. parseTime: text => { // Parses a string in object/string that can be formatted byformatTime
. } // Translation of the time selector icon button title. selector: 'Time selector', // Translation of the time selector clear button title. clear: 'Clear' }- 参数:
i18n
- the JsonObject value to set
-
validate
@NotSupported protected void validate()Description copied from corresponding location in WebComponent:
Returns true if
value
is valid, and sets theinvalid
flag appropriately.This function is not supported by Flow because it returns a
boolean
. Functions with return types different than void are not supported at this moment. -
checkValidity
protected void checkValidity()Description copied from corresponding location in WebComponent:
Returns true if the current input value satisfies all constraints (if any)
You can override the
checkValidity
method for custom validations. -
addInvalidChangeListener
protected com.vaadin.flow.shared.Registration addInvalidChangeListener(com.vaadin.flow.component.ComponentEventListener<GeneratedVaadinTimePicker.InvalidChangeEvent<R>> listener)Adds a listener forinvalid-changed
events fired by the webcomponent.- 参数:
listener
- the listener- 返回:
- a
Registration
for removing the event listener
-