@Tag(value="vaadin-time-picker") @NpmPackage(value="@vaadin/vaadin-time-picker", version="2.4.0") @JsModule(value="@vaadin/vaadin-time-picker/src/vaadin-time-picker.js") @HtmlImport(value="frontend://bower_components/vaadin-time-picker/src/vaadin-time-picker.html") public abstract class GeneratedVaadinTimePicker<R extends GeneratedVaadinTimePicker<R,T>,T> extends AbstractSinglePropertyField<R,T> implements HasStyle, 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.
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.
Modifier and Type | Class and Description |
---|---|
static class |
GeneratedVaadinTimePicker.InvalidChangeEvent<R extends GeneratedVaadinTimePicker<R,?>> |
AbstractField.ComponentValueChangeEvent<C extends Component,V>
BlurNotifier.BlurEvent<C extends Component>
FocusNotifier.FocusEvent<C extends Component>
HasValue.ValueChangeEvent<V>, HasValue.ValueChangeListener<E extends HasValue.ValueChangeEvent<?>>
Constructor and Description |
---|
GeneratedVaadinTimePicker()
Default constructor.
|
GeneratedVaadinTimePicker(T initialValue,
T defaultValue,
boolean acceptNullValues)
Constructs a new GeneratedVaadinTimePicker component with the given
arguments.
|
GeneratedVaadinTimePicker(T initialValue,
T defaultValue,
Class<P> elementPropertyType,
SerializableBiFunction<R,P,T> presentationToModel,
SerializableBiFunction<R,T,P> modelToPresentation)
Constructs a new GeneratedVaadinTimePicker component with the given
arguments.
|
GeneratedVaadinTimePicker(T initialValue,
T defaultValue,
Class<P> elementPropertyType,
SerializableFunction<P,T> presentationToModel,
SerializableFunction<T,P> modelToPresentation)
Constructs a new GeneratedVaadinTimePicker component with the given
arguments.
|
Modifier and Type | Method and Description |
---|---|
protected Registration |
addInvalidChangeListener(ComponentEventListener<GeneratedVaadinTimePicker.InvalidChangeEvent<R>> listener)
Adds a listener for
invalid-changed events fired by the
webcomponent. |
protected void |
checkValidity()
Description copied from corresponding location in WebComponent:
|
protected String |
getErrorMessageString()
Description copied from corresponding location in WebComponent:
|
protected elemental.json.JsonObject |
getI18nJsonObject()
Description copied from corresponding location in WebComponent:
|
protected String |
getLabelString()
Description copied from corresponding location in WebComponent:
|
protected String |
getMaxString()
Description copied from corresponding location in WebComponent:
|
protected String |
getMinString()
Description copied from corresponding location in WebComponent:
|
protected String |
getNameString()
Description copied from corresponding location in WebComponent:
|
protected String |
getPatternString()
Description copied from corresponding location in WebComponent:
|
protected 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(String errorMessage)
Description copied from corresponding location in WebComponent:
|
protected 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(String label)
Description copied from corresponding location in WebComponent:
|
protected void |
setMax(String max)
Description copied from corresponding location in WebComponent:
|
protected void |
setMin(String min)
Description copied from corresponding location in WebComponent:
|
protected void |
setName(String name)
Description copied from corresponding location in WebComponent:
|
protected void |
setPattern(String pattern)
Description copied from corresponding location in WebComponent:
|
protected void |
setPlaceholder(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:
|
getSynchronizationRegistration, hasValidValue, setPresentationValue, setSynchronizedEvent
addValueChangeListener, getEmptyValue, getValue, isEmpty, setModelValue, setValue, valueEquals
addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, set, setElement, setId, setVisible
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
addFocusShortcut, blur, focus, getTabIndex, setTabIndex
addBlurListener
addFocusListener
isEnabled, setEnabled
getElement
isReadOnly, isRequiredIndicatorVisible, setReadOnly, setRequiredIndicatorVisible
clear, getOptionalValue
addAttachListener
addDetachListener
public GeneratedVaadinTimePicker(T initialValue, T defaultValue, Class<P> elementPropertyType, SerializableFunction<P,T> presentationToModel, SerializableFunction<T,P> modelToPresentation)
P
- the property typeinitialValue
- 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 valuepublic GeneratedVaadinTimePicker(T initialValue, T defaultValue, boolean acceptNullValues)
initialValue
- the initial value to set to the valuedefaultValue
- the default value to use if the value isn't definedacceptNullValues
- whether null
is accepted as a model valuepublic GeneratedVaadinTimePicker(T initialValue, T defaultValue, Class<P> elementPropertyType, SerializableBiFunction<R,P,T> presentationToModel, SerializableBiFunction<R,T,P> modelToPresentation)
P
- the property typeinitialValue
- 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 valuepublic GeneratedVaadinTimePicker()
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.
autofocus
property from the webcomponentprotected 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 setprotected 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.
disabled
property from the webcomponentprotected void setDisabled(boolean disabled)
Description copied from corresponding location in WebComponent:
Set to true to disable this input.
disabled
- the boolean value to setprotected 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.
name
property from the webcomponentprotected void setName(String name)
Description copied from corresponding location in WebComponent:
The name of this element.
name
- the String value to setprotected 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.
label
property from the webcomponentprotected void setLabel(String label)
Description copied from corresponding location in WebComponent:
The label for this element.
label
- the String value to setprotected 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.
required
property from the webcomponentprotected 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 setprotected 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.
preventInvalidInput
property from the webcomponentprotected 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 setprotected 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.
pattern
property from the webcomponentprotected void setPattern(String pattern)
Description copied from corresponding location in WebComponent:
A pattern to validate the input
with.
pattern
- the String value to setprotected 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.
errorMessage
property from the webcomponentprotected void setErrorMessage(String errorMessage)
Description copied from corresponding location in WebComponent:
The error message to display when the input is invalid.
errorMessage
- the String value to setprotected 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.
placeholder
property from the webcomponentprotected void setPlaceholder(String placeholder)
Description copied from corresponding location in WebComponent:
A placeholder string in addition to the label.
placeholder
- the String value to setprotected 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.
readonly
property from the webcomponentprotected 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 setprotected 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.
invalid
property from the webcomponentprotected void setInvalid(boolean invalid)
Description copied from corresponding location in WebComponent:
Set to true if the value is invalid.
invalid
- the boolean value to setprotected 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.
min
property from the webcomponentprotected void setMin(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 setprotected 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.
max
property from the webcomponentprotected void setMax(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 setprotected 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 to
hh:mm:ss
and hh: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.
step
property from the webcomponentprotected 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 to
hh:mm:ss
and hh: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 setprotected 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.
clearButtonVisible
property from the webcomponentprotected 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 setprotected 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 in hh
/ 'hh:mm' / 'hh:mm:ss' / 'hh:mm:ss.fff' - formats
},
// A function to parse the given text to an Object
in the format
// { hours: ..., minutes: ..., seconds: ..., milliseconds: ... }
.
// Must properly parse (at least) text
// formatted by formatTime
.
parseTime: text => {
// Parses a string in object/string that can be formatted by formatTime
.
}
// 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.
i18n
property from the webcomponentprotected 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 in hh
/ 'hh:mm' / 'hh:mm:ss' / 'hh:mm:ss.fff' - formats
},
// A function to parse the given text to an Object
in the format
// { hours: ..., minutes: ..., seconds: ..., milliseconds: ... }
.
// Must properly parse (at least) text
// formatted by formatTime
.
parseTime: text => {
// Parses a string in object/string that can be formatted by formatTime
.
}
// 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@NotSupported protected void validate()
Description copied from corresponding location in WebComponent:
Returns true if value
is valid, and sets the invalid
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.
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.
protected Registration addInvalidChangeListener(ComponentEventListener<GeneratedVaadinTimePicker.InvalidChangeEvent<R>> listener)
invalid-changed
events fired by the
webcomponent.listener
- the listenerRegistration
for removing the event listenerCopyright © 2023. All rights reserved.