类 TimePicker
- 所有已实现的接口:
com.vaadin.flow.component.AttachNotifier
,com.vaadin.flow.component.BlurNotifier<TimePicker>
,com.vaadin.flow.component.DetachNotifier
,com.vaadin.flow.component.Focusable<TimePicker>
,com.vaadin.flow.component.FocusNotifier<TimePicker>
,com.vaadin.flow.component.HasElement
,com.vaadin.flow.component.HasEnabled
,com.vaadin.flow.component.HasSize
,com.vaadin.flow.component.HasStyle
,com.vaadin.flow.component.HasValidation
,com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TimePicker,java.time.LocalTime>,java.time.LocalTime>
,com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TimePicker,java.time.LocalTime>,java.time.LocalTime>
,java.io.Serializable
@JsModule("./timepickerConnector.js") public class TimePicker extends GeneratedVaadinTimePicker<TimePicker,java.time.LocalTime> implements com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasValidation, com.vaadin.flow.component.HasEnabled
vaadin-time-picker
web component.- 作者:
- Vaadin Ltd
- 另请参阅:
- 序列化表格
-
嵌套类概要
从类继承的嵌套类/接口 com.vaadin.flow.component.timepicker.GeneratedVaadinTimePicker
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>
-
构造器概要
构造器 构造器 说明 TimePicker()
Default constructor.TimePicker(com.vaadin.flow.component.HasValue.ValueChangeListener<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TimePicker,java.time.LocalTime>> listener)
Convenience constructor to create a time picker with aHasValue.ValueChangeListener
.TimePicker(java.lang.String label)
Convenience constructor to create a time picker with a label.TimePicker(java.lang.String label, java.time.LocalTime time)
Convenience constructor to create a time picker with a pre-selected time and a label.TimePicker(java.time.LocalTime time)
Convenience constructor to create a time picker with a pre-selected time. -
方法概要
修饰符和类型 方法 说明 com.vaadin.flow.shared.Registration
addInvalidChangeListener(com.vaadin.flow.component.ComponentEventListener<GeneratedVaadinTimePicker.InvalidChangeEvent<TimePicker>> listener)
Adds a listener forinvalid-changed
events fired by the webcomponent.java.lang.String
getErrorMessage()
Gets the current error message from the time picker.java.lang.String
getLabel()
Gets the label of the time picker.java.util.Locale
getLocale()
Gets the Locale for this time picker.java.lang.String
getMax()
已过时。usegetMaxTime()
instead.java.time.LocalTime
getMaxTime()
Gets the maximum time in the time picker.java.lang.String
getMin()
已过时。usegetMinTime()
instead.java.time.LocalTime
getMinTime()
Gets the minimum time in the time picker.java.lang.String
getPlaceholder()
Gets the placeholder of the time picker.java.time.Duration
getStep()
Gets the step of the time picker.static java.util.stream.Stream<java.util.Locale>
getSupportedAvailableLocales()
Returns a stream of all the available locales that are supported by the time picker component.boolean
isClearButtonVisible()
Gets whether this time picker displays a clear button when it has value.boolean
isInvalid()
Gets the validity of the time picker output.boolean
isRequired()
Determines whether the time picker is marked as input required.protected void
onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
void
setClearButtonVisible(boolean clearButtonVisible)
Sets displaying a clear button in the time picker when it has value.void
setErrorMessage(java.lang.String errorMessage)
Description copied from corresponding location in WebComponent:void
setHour12Format(boolean hour12)
Is use 12 hours format Value Format true 11:23:45 PM false 23:23:45 PMvoid
setHour24Format(boolean hour24)
Is use 24 hours format Value Format true 23:23:45 PM false 11:23:45 PMvoid
setInvalid(boolean invalid)
Description copied from corresponding location in WebComponent:void
setLabel(java.lang.String label)
Description copied from corresponding location in WebComponent:void
setLocale(java.util.Locale locale)
Set the Locale for the Time Picker.void
setMax(java.lang.String max)
已过时。usesetMaxTime(LocalTime)
instead.void
setMaxTime(java.time.LocalTime max)
Sets the maximum time in the time picker.void
setMin(java.lang.String min)
已过时。usesetMinTime(LocalTime)
instead.void
setMinTime(java.time.LocalTime min)
Sets the minimum time in the time picker.void
setPlaceholder(java.lang.String placeholder)
Description copied from corresponding location in WebComponent:void
setRequired(boolean required)
Description copied from corresponding location in WebComponent:void
setRequiredIndicatorVisible(boolean requiredIndicatorVisible)
void
setStep(java.time.Duration step)
Sets thestep
property of the time picker using duration.void
setValue(java.time.LocalTime value)
protected void
validate()
Performs server-side validation of the current value.从类继承的方法 com.vaadin.flow.component.timepicker.GeneratedVaadinTimePicker
checkValidity, getErrorMessageString, getI18nJsonObject, getLabelString, getMaxString, getMinString, getNameString, getPatternString, getPlaceholderString, getStepDouble, isAutofocusBoolean, isClearButtonVisibleBoolean, isDisabledBoolean, isInvalidBoolean, isPreventInvalidInputBoolean, isReadonlyBoolean, isRequiredBoolean, setAutofocus, setDisabled, setI18n, setName, setPattern, setPreventInvalidInput, setReadonly, setStep
从类继承的方法 com.vaadin.flow.component.AbstractSinglePropertyField
getSynchronizationRegistration, hasValidValue, setPresentationValue, setSynchronizedEvent
从类继承的方法 com.vaadin.flow.component.AbstractField
addValueChangeListener, getEmptyValue, getValue, isEmpty, setModelValue, valueEquals
从类继承的方法 com.vaadin.flow.component.Component
addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getParent, getTranslation, getTranslation, getUI, hasListener, isTemplateMapped, isVisible, 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
从接口继承的方法 com.vaadin.flow.component.HasSize
getHeight, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull
-
构造器详细资料
-
TimePicker
public TimePicker()Default constructor. -
TimePicker
public TimePicker(java.time.LocalTime time)Convenience constructor to create a time picker with a pre-selected time.- 参数:
time
- the pre-selected time in the picker
-
TimePicker
public TimePicker(java.lang.String label)Convenience constructor to create a time picker with a label.- 参数:
label
- the label describing the time picker- 另请参阅:
setLabel(String)
-
TimePicker
public TimePicker(java.lang.String label, java.time.LocalTime time)Convenience constructor to create a time picker with a pre-selected time and a label.- 参数:
label
- the label describing the time pickertime
- the pre-selected time in the picker
-
TimePicker
public TimePicker(com.vaadin.flow.component.HasValue.ValueChangeListener<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TimePicker,java.time.LocalTime>> listener)Convenience constructor to create a time picker with aHasValue.ValueChangeListener
.- 参数:
listener
- the listener to receive value change events- 另请参阅:
AbstractField.addValueChangeListener(HasValue.ValueChangeListener)
-
-
方法详细资料
-
setLabel
public void setLabel(java.lang.String label)从类复制的说明:GeneratedVaadinTimePicker
Description copied from corresponding location in WebComponent:
The label for this element.
- 覆盖:
setLabel
在类中GeneratedVaadinTimePicker<TimePicker,java.time.LocalTime>
- 参数:
label
- the String value to set
-
setValue
public void setValue(java.time.LocalTime value)- 指定者:
setValue
在接口中com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TimePicker,java.time.LocalTime>,java.time.LocalTime>
- 覆盖:
setValue
在类中com.vaadin.flow.component.AbstractField<TimePicker,java.time.LocalTime>
-
getLabel
public java.lang.String getLabel()Gets the label of the time picker.- 返回:
- the
label
property of the time picker
-
setErrorMessage
public void setErrorMessage(java.lang.String errorMessage)从类复制的说明:GeneratedVaadinTimePicker
Description copied from corresponding location in WebComponent:
The error message to display when the input is invalid.
- 指定者:
setErrorMessage
在接口中com.vaadin.flow.component.HasValidation
- 覆盖:
setErrorMessage
在类中GeneratedVaadinTimePicker<TimePicker,java.time.LocalTime>
- 参数:
errorMessage
- the String value to set
-
getErrorMessage
public java.lang.String getErrorMessage()Gets the current error message from the time picker.- 指定者:
getErrorMessage
在接口中com.vaadin.flow.component.HasValidation
- 返回:
- the current error message
-
setInvalid
public void setInvalid(boolean invalid)从类复制的说明:GeneratedVaadinTimePicker
Description copied from corresponding location in WebComponent:
Set to true if the value is invalid.
- 指定者:
setInvalid
在接口中com.vaadin.flow.component.HasValidation
- 覆盖:
setInvalid
在类中GeneratedVaadinTimePicker<TimePicker,java.time.LocalTime>
- 参数:
invalid
- the boolean value to set
-
isInvalid
public boolean isInvalid()Gets the validity of the time picker output.return true, if the value is invalid.
- 指定者:
isInvalid
在接口中com.vaadin.flow.component.HasValidation
- 返回:
- the
validity
property from the time picker
-
setPlaceholder
public void setPlaceholder(java.lang.String placeholder)从类复制的说明:GeneratedVaadinTimePicker
Description copied from corresponding location in WebComponent:
A placeholder string in addition to the label.
- 覆盖:
setPlaceholder
在类中GeneratedVaadinTimePicker<TimePicker,java.time.LocalTime>
- 参数:
placeholder
- the String value to set
-
getPlaceholder
public java.lang.String getPlaceholder()Gets the placeholder of the time picker.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 of the time picker
-
setRequired
public void setRequired(boolean required)从类复制的说明:GeneratedVaadinTimePicker
Description copied from corresponding location in WebComponent:
Set to true to mark the input as required.
- 覆盖:
setRequired
在类中GeneratedVaadinTimePicker<TimePicker,java.time.LocalTime>
- 参数:
required
- the boolean value to set
-
setRequiredIndicatorVisible
public void setRequiredIndicatorVisible(boolean requiredIndicatorVisible)- 指定者:
setRequiredIndicatorVisible
在接口中com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TimePicker,java.time.LocalTime>,java.time.LocalTime>
- 指定者:
setRequiredIndicatorVisible
在接口中com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TimePicker,java.time.LocalTime>,java.time.LocalTime>
-
isRequired
public boolean isRequired()Determines whether the time picker is marked as input required.This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
- 返回:
true
if the input is required,false
otherwise
-
setStep
public void setStep(java.time.Duration step)Sets thestep
property of the time picker using duration. It specifies the intervals for the displayed items in the time picker dropdown and also the displayed time format.The set step needs to evenly divide a day or an hour and has to be larger than 0 milliseconds. By default, the format is
hh:mm
(same as *Duration.ofHours(1)
If the step is less than 60 seconds, the format will be changed to
hh:mm:ss
and it can be inhh:mm:ss.fff
format, when the step is less than 1 second.NOTE: If the step is less than 900 seconds, the dropdown is hidden.
NOTE: changing the step to a larger duration can cause a new
HasValue.ValueChangeEvent
to be fired if some parts (eg. seconds) is discarded from the value.- 参数:
step
- the step to set, notnull
and should divide a day or an hour evenly
-
setHour12Format
public void setHour12Format(boolean hour12)Is use 12 hours formatValue Format true 11:23:45 PM false 23:23:45 PM - 覆盖:
setHour12Format
在类中GeneratedVaadinTimePicker<TimePicker,java.time.LocalTime>
- 参数:
hour12
- use 12 hours format
-
setHour24Format
public void setHour24Format(boolean hour24)Is use 24 hours formatValue Format true 23:23:45 PM false 11:23:45 PM - 参数:
hour24
- use 24 hours format
-
getStep
public java.time.Duration getStep()Gets the step of the time picker.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 picker, unit seconds
-
addInvalidChangeListener
public com.vaadin.flow.shared.Registration addInvalidChangeListener(com.vaadin.flow.component.ComponentEventListener<GeneratedVaadinTimePicker.InvalidChangeEvent<TimePicker>> listener)从类复制的说明:GeneratedVaadinTimePicker
Adds a listener forinvalid-changed
events fired by the webcomponent.- 覆盖:
addInvalidChangeListener
在类中GeneratedVaadinTimePicker<TimePicker,java.time.LocalTime>
- 参数:
listener
- the listener- 返回:
- a
Registration
for removing the event listener
-
validate
protected void validate()Performs server-side validation of the current value. This is needed because it is possible to circumvent the client-side validation constraints using browser development tools.- 覆盖:
validate
在类中GeneratedVaadinTimePicker<TimePicker,java.time.LocalTime>
-
onAttach
protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent)- 覆盖:
onAttach
在类中com.vaadin.flow.component.Component
-
setLocale
public void setLocale(java.util.Locale locale)Set the Locale for the Time Picker. The displayed time will be formatted by the browser using the given locale.By default, the locale is
null
until the component is attached to an UI, and then locale is set toUI.getLocale()
, unless a locale has been explicitly set before that.The time formatting is done in the browser using the Date.toLocaleTimeString() function.
If for some reason the browser doesn't support the given locale, the en-US locale is used.
NOTE: only the language + country/region codes are used. This means that the script and variant information is not used and supported. NOTE: timezone related data is not supported. NOTE: changing the locale does not cause a new
HasValue.ValueChangeEvent
to be fired.- 参数:
locale
- the locale set to the time picker, cannot be [@code null}
-
getLocale
public java.util.Locale getLocale()Gets the Locale for this time picker.By default, the locale is
null
until the component is attached to an UI, and then locale is set toUI.getLocale()
, unlesssetLocale(Locale)
has been explicitly called before that.- 覆盖:
getLocale
在类中com.vaadin.flow.component.Component
- 返回:
- the locale used for this time picker
-
setMin
@Deprecated public void setMin(java.lang.String min)已过时。usesetMinTime(LocalTime)
instead.Sets the minimum time in the time picker. Times before that will be disabled in the popup.- 覆盖:
setMin
在类中GeneratedVaadinTimePicker<TimePicker,java.time.LocalTime>
- 参数:
min
- the minimum time that is allowed to be selected, ornull
to remove any minimum constraints
-
setMinTime
public void setMinTime(java.time.LocalTime min)Sets the minimum time in the time picker. Times before that will be disabled in the popup.- 参数:
min
- the minimum time that is allowed to be selected, ornull
to remove any minimum constraints
-
getMin
@Deprecated public java.lang.String getMin()已过时。usegetMinTime()
instead.Gets the minimum time in the time picker. Time before that will be disabled in the popup.- 返回:
- the minimum time that is allowed to be selected, or
null
if there's no minimum
-
getMinTime
public java.time.LocalTime getMinTime()Gets the minimum time in the time picker. Time before that will be disabled in the popup.- 返回:
- the minimum time that is allowed to be selected, or
null
if there's no minimum
-
setMax
@Deprecated public void setMax(java.lang.String max)已过时。usesetMaxTime(LocalTime)
instead.Sets the maximum time in the time picker. Times after that will be disabled in the popup.- 覆盖:
setMax
在类中GeneratedVaadinTimePicker<TimePicker,java.time.LocalTime>
- 参数:
max
- the maximum time that is allowed to be selected, ornull
to remove any maximum constraints
-
setMaxTime
public void setMaxTime(java.time.LocalTime max)Sets the maximum time in the time picker. Times after that will be disabled in the popup.- 参数:
max
- the maximum time that is allowed to be selected, ornull
to remove any maximum constraints
-
getMax
@Deprecated public java.lang.String getMax()已过时。usegetMaxTime()
instead.Gets the maximum time in the time picker. Times after that will be disabled in the popup.- 返回:
- the maximum time that is allowed to be selected, or
null
if there's no maximum
-
getMaxTime
public java.time.LocalTime getMaxTime()Gets the maximum time in the time picker. Times after that will be disabled in the popup.- 返回:
- the maximum time that is allowed to be selected, or
null
if there's no maximum
-
setClearButtonVisible
public void setClearButtonVisible(boolean clearButtonVisible)Sets displaying a clear button in the time picker when it has value.The clear button is an icon, which can be clicked to set the time picker value to
null
.- 覆盖:
setClearButtonVisible
在类中GeneratedVaadinTimePicker<TimePicker,java.time.LocalTime>
- 参数:
clearButtonVisible
-true
to display the clear button,false
to hide it
-
isClearButtonVisible
public boolean isClearButtonVisible()Gets whether this time picker displays a clear button when it has value.- 返回:
true
if this time picker displays a clear button,false
otherwise- 另请参阅:
setClearButtonVisible(boolean)
-
getSupportedAvailableLocales
public static java.util.stream.Stream<java.util.Locale> getSupportedAvailableLocales()Returns a stream of all the available locales that are supported by the time picker component.This is a shorthand for
Locale.getAvailableLocales()
where all locales without theLocale.getLanguage()
have been filtered out, as the browser cannot localize the time for those.- 返回:
- a stream of the available locales that are supported by the time picker component
- 另请参阅:
setLocale(Locale)
,Locale.getAvailableLocales()
,Locale.getLanguage()
-