public class Timepicker
extends org.zkoss.zul.impl.DateTimeFormatInputElement
Default getZclass(): z-timepicker.
| Constructor and Description |
|---|
Timepicker() |
Timepicker(Date date) |
Timepicker(LocalDateTime value) |
Timepicker(LocalTime value) |
Timepicker(ZonedDateTime value) |
| Modifier and Type | Method and Description |
|---|---|
protected Object |
coerceFromString(String value) |
protected String |
coerceToString(Object value) |
protected DateFormat |
getDateFormat(String fmt)
Returns the date format of the time only,
Default: it uses SimpleDateFormat to format the date.
|
protected String |
getDefaultFormat()
Returns the default format, which is used when constructing a timepicker.
|
int |
getInterval()
Returns the interval time used to generate the options in Timepicker
Unit: 1 second
Default: 1 hr
|
Date |
getMax()
Returns the maximum time used to generate the options in Timepicker, or null if
the default maximum time is used.
|
LocalTime |
getMaxInLocalTime()
Returns the maximum time used to generate the options in Timepicker, or null if
the default maximum time is used.
|
Date |
getMin()
Returns the minimum time used to generate the options in Timepicker, or null if
the default minimum time is used.(00:00:00 AM)
|
LocalTime |
getMinInLocalTime()
Returns the minimum time used to generate the options in Timepicker, or null if
the default minimum time is used.(00:00:00 AM)
|
String |
getRealFormat()
Returns the real format, i.e., the combination of the format patterns,
such as hh:mm.
|
String |
getZclass() |
protected void |
renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) |
void |
setConstraint(String constr) |
void |
setFormat(String format)
Sets the date format.
|
void |
setInterval(int interval)
Sets the interval time used to generate the options in Timepicker
Unit: 1 second
|
void |
setMax(Date max)
Sets the maximum time used to generate the options in Timepicker
|
void |
setMaxInLocalTime(LocalTime max)
Sets the maximum time used to generate the options in Timepicker
|
void |
setMin(Date min)
Sets the minimum time used to generate the options in Timepicker
|
void |
setMinInLocalTime(LocalTime min)
Sets the minimum time used to generate the options in Timepicker
|
void |
setValueInLocalDate(LocalDate value)
It is meaningless to set only LocalDate in timepicker.
|
getLocale, getPropertyAccess, getTimeZone, getValue, getValueInLocalDate, getValueInLocalDateTime, getValueInLocalTime, getValueInZonedDateTime, getZoneId, setConstraint, setLocale, setLocale, setTimeZone, setTimeZone, setValue, setValueInLocalDateTime, setValueInLocalTime, setValueInZonedDateTime, toDate, toDate, toDate, toZonedDateTimecheckUserError, clearErrorMessage, clearErrorMessage, clone, getCols, getConstraint, getErrorboxIconSclass, getErrorboxSclass, getErrorMessage, getInputAttributes, getInstant, getMaxlength, getName, getPlaceholder, getRawText, getRawValue, getTargetValue, getText, getType, isChildable, isDisabled, isInplace, isInstant, isMultiline, isReadonly, isValid, marshall, onWrongValue, select, service, setCols, setDisabled, setErrorboxIconSclass, setErrorboxSclass, setErrorMessage, setInplace, setInputAttributes, setInputAttributes, setInsertedText, setInstant, setMaxlength, setName, setPlaceholder, setRawValue, setReadonly, setSelectedText, setSelectionRange, setText, setValueDirectly, showCustomError, unmarshall, validategetContext, getCtrlKeys, getPopup, getTooltip, setContext, setContext, setContextAttributes, setCtrlKeys, setPopup, setPopup, setPopupAttributes, setTooltip, setTooltip, setTooltipAttributesaddSclass, evalCSSFlex, focus, getAction, getDraggable, getDroppable, getExtraCtrl, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTabindexInteger, getTooltiptext, getTop, getVflex, getWidth, getZindex, getZIndex, removeSclass, removeSclass, setAction, setClass, setDraggable, setDroppable, setFocus, setHeight, setHeight0, setHeightDirectly, setHflex, setHflex0, setHflexDirectly, setLeft, setLeftDirectly, setRenderdefer, setSclass, setStyle, setTabindex, setTabindex, setTooltiptext, setTop, setTopDirectly, setVflex, setVflex0, setVflexDirectly, setWidth, setWidth0, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectlyaddAnnotation, addAnnotation, addCallback, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, enableBindingAnnotation, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getCallback, getChildren, getClientAttribute, getClientDataAttribute, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getEventListenerMap, getEventListeners, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRedrawCallback, getRoot, getShadowFellowIfAny, getShadowRoots, getShadowVariable, getShadowVariable, getShadowVariable0, getSpaceOwner, getSpecialRendererOutput, getStubonly, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttribute, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, insertBefore, invalidate, invalidatePartial, isInitialized, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageAttached, onPageDetached, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, replace, response, response, response, service, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setStubonly, setSubBindingAnnotationCount, setTemplate, setVisible, setVisibleDirectly, setWidgetAttribute, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerializepublic Timepicker()
public Timepicker(Date date) throws org.zkoss.zk.ui.WrongValueException
org.zkoss.zk.ui.WrongValueExceptionpublic Timepicker(ZonedDateTime value) throws org.zkoss.zk.ui.WrongValueException
org.zkoss.zk.ui.WrongValueExceptionpublic Timepicker(LocalDateTime value) throws org.zkoss.zk.ui.WrongValueException
org.zkoss.zk.ui.WrongValueExceptionpublic Timepicker(LocalTime value) throws org.zkoss.zk.ui.WrongValueException
org.zkoss.zk.ui.WrongValueExceptionpublic void setFormat(String format) throws org.zkoss.zk.ui.WrongValueException
If null or empty is specified, getDefaultFormat() is assumed.
Since 5.0.7, you could specify one of the following reserved words,
and DateFormats.getTimeFormat(int, java.util.Locale, java.lang.String)
will be used to retrieve the real format.
| short | DateFormats.getTimeFormat(int, java.util.Locale, java.lang.String) with DateFormat.SHORT |
| medium | DateFormats.getTimeFormat(int, java.util.Locale, java.lang.String) with DateFormat.MEDIUM |
In additions, the format could be a combination of the following pattern letters:
| Letter | Date or Time Component | Presentation | Examples |
|---|---|---|---|
a
| Am/pm marker | Text | PM
|
H
| Hour in day (0-23) | Number | 0
|
k
| Hour in day (1-24) | Number | 24
|
K
| Hour in am/pm (0-11) | Number | 0
|
h
| Hour in am/pm (1-12) | Number | 12
|
m
| Minute in hour | Number | 30
|
s
| Second in minute | Number | 55
|
setFormat in class org.zkoss.zul.impl.FormatInputElementorg.zkoss.zk.ui.WrongValueExceptionpublic String getRealFormat()
As described in setFormat(java.lang.String), a developer could specify
an abstract name, such as short, or an empty string as the format,
and this method will convert it to a real time format.
getRealFormat in class org.zkoss.zul.impl.FormatInputElementpublic void setValueInLocalDate(LocalDate value) throws org.zkoss.zk.ui.WrongValueException
setValueInLocalDate in class org.zkoss.zul.impl.DateTimeFormatInputElementorg.zkoss.zk.ui.WrongValueExceptionpublic Date getMin()
public void setMin(Date min)
public LocalTime getMinInLocalTime()
public void setMinInLocalTime(LocalTime min)
public Date getMax()
public void setMax(Date max)
public LocalTime getMaxInLocalTime()
public void setMaxInLocalTime(LocalTime max)
public int getInterval()
Unit: 1 second
Default: 1 hr
public void setInterval(int interval)
Unit: 1 second
public void setConstraint(String constr)
setConstraint in class org.zkoss.zul.impl.InputElementconstr - a list of constraints separated by comma.
Example: between 093000 and 183000, before 210000protected String getDefaultFormat()
Default: DateFormats.getTimeFormat(DEFAULT, null, "HH:mm")
(see DateFormats.getTimeFormat(int, java.util.Locale, java.lang.String)).
Though you might override this method to provide your own default format,
it is suggested to specify the format for the current thread
with DateFormats.setLocalFormatInfo(org.zkoss.text.DateFormatInfo).
protected Object coerceFromString(String value) throws org.zkoss.zk.ui.WrongValueException
coerceFromString in class org.zkoss.zul.impl.InputElementorg.zkoss.zk.ui.WrongValueExceptionprotected String coerceToString(Object value)
coerceToString in class org.zkoss.zul.impl.InputElementprotected DateFormat getDateFormat(String fmt)
Default: it uses SimpleDateFormat to format the date.
public String getZclass()
getZclass in class org.zkoss.zk.ui.HtmlBasedComponentprotected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer)
throws IOException
renderProperties in class org.zkoss.zul.impl.DateTimeFormatInputElementIOExceptionCopyright © 2026. All rights reserved.