Class Timepicker
- java.lang.Object
-
- org.zkoss.zk.ui.AbstractComponent
-
- org.zkoss.zk.ui.HtmlBasedComponent
-
- org.zkoss.zul.impl.XulElement
-
- org.zkoss.zul.impl.InputElement
-
- org.zkoss.zul.impl.FormatInputElement
-
- org.zkoss.zul.impl.DateTimeFormatInputElement
-
- org.zkoss.zkmax.zul.Timepicker
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,org.zkoss.zk.ui.Component,org.zkoss.zk.ui.ext.Disable,org.zkoss.zk.ui.ext.Readonly,org.zkoss.zk.ui.ext.Scope,org.zkoss.zk.ui.sys.ComponentCtrl,org.zkoss.zul.ext.Constrainted
public class Timepicker extends org.zkoss.zul.impl.DateTimeFormatInputElementAn input box for holding a time (aDateObject), but only Hour, Minute, Second are used.Default
getZclass(): z-timepicker.- Since:
- 8.0.0
- Author:
- James Chu
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Timepicker()Timepicker(java.time.LocalDateTime value)Timepicker(java.time.LocalTime value)Timepicker(java.time.ZonedDateTime value)Timepicker(java.util.Date date)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.ObjectcoerceFromString(java.lang.String value)protected java.lang.StringcoerceToString(java.lang.Object value)protected java.text.DateFormatgetDateFormat(java.lang.String fmt)Returns the date format of the time only,protected java.lang.StringgetDefaultFormat()Returns the default format, which is used when constructing a timepicker.intgetInterval()Returns the interval time used to generate the options in Timepickerjava.util.DategetMax()Returns the maximum time used to generate the options in Timepicker, or null if the default maximum time is used.java.time.LocalTimegetMaxInLocalTime()Returns the maximum time used to generate the options in Timepicker, or null if the default maximum time is used.java.util.DategetMin()Returns the minimum time used to generate the options in Timepicker, or null if the default minimum time is used.(00:00:00 AM)java.time.LocalTimegetMinInLocalTime()Returns the minimum time used to generate the options in Timepicker, or null if the default minimum time is used.(00:00:00 AM)java.lang.StringgetRealFormat()Returns the real format, i.e., the combination of the format patterns, such as hh:mm.java.lang.StringgetZclass()booleanisReadonly()protected voidrenderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer)voidsetConstraint(java.lang.String constr)voidsetFormat(java.lang.String format)Sets the date format.voidsetInterval(int interval)Sets the interval time used to generate the options in TimepickervoidsetMax(java.util.Date max)Sets the maximum time used to generate the options in TimepickervoidsetMaxInLocalTime(java.time.LocalTime max)Sets the maximum time used to generate the options in TimepickervoidsetMin(java.util.Date min)Sets the minimum time used to generate the options in TimepickervoidsetMinInLocalTime(java.time.LocalTime min)Sets the minimum time used to generate the options in TimepickervoidsetReadonly(boolean readonly)voidsetValueInLocalDate(java.time.LocalDate value)It is meaningless to set only LocalDate in timepicker.-
Methods inherited from class org.zkoss.zul.impl.DateTimeFormatInputElement
getFormattedTimeZone, getLocale, getPropertyAccess, getTimeZone, getValue, getValueInLocalDate, getValueInLocalDateTime, getValueInLocalTime, getValueInZonedDateTime, getZoneId, setConstraint, setLocale, setLocale, setTimeZone, setTimeZone, setValue, setValueInLocalDateTime, setValueInLocalTime, setValueInZonedDateTime, toDate, toDate, toDate, toZonedDateTime
-
Methods inherited from class org.zkoss.zul.impl.InputElement
checkUserError, clearErrorMessage, clearErrorMessage, clone, getCols, getConstraint, getConstraintString, getErrorboxIconSclass, getErrorboxSclass, getErrorMessage, getInputAttributes, getInstant, getMaxlength, getName, getPlaceholder, getRawText, getRawValue, getTargetValue, getText, getType, isChildable, isDisabled, isInplace, isInstant, isMultiline, isValid, marshall, onWrongValue, select, service, setCols, setDisabled, setErrorboxIconSclass, setErrorboxSclass, setErrorMessage, setInplace, setInputAttributes, setInputAttributes, setInsertedText, setInstant, setMaxlength, setName, setPlaceholder, setRawValue, setSelectedText, setSelectionRange, setText, setValueDirectly, showCustomError, unmarshall, validate
-
Methods inherited from class org.zkoss.zul.impl.XulElement
getContext, getCtrlKeys, getPopup, getTooltip, setContext, setContext, setContextAttributes, setCtrlKeys, setPopup, setPopup, setPopupAttributes, setTooltip, setTooltip, setTooltipAttributes
-
Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent
addSclass, evalCSSFlex, focus, getAction, getClientAction, getDraggable, getDroppable, getExtraCtrl, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTabindexInteger, getTooltiptext, getTop, getVflex, getWidth, getZindex, getZIndex, removeSclass, removeSclass, setAction, setClass, setClientAction, 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, setZIndexDirectly
-
Methods inherited from class org.zkoss.zk.ui.AbstractComponent
addAnnotation, addCallback, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, destroyIndexCacheMap, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, disableHostChanged, enableBindingAnnotation, enableHostChanged, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, 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, getForwards, getId, getIndexCacheMap, getLastChild, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRedrawCallback, getRoot, getShadowFellowIfAny, getShadowRoots, getShadowVariable, getShadowVariable, getShadowVariable0, getSpaceOwner, getSpecialRendererOutput, getStubonly, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, initIndexCacheMap, insertBefore, invalidate, isDisabledHostChanged, isInitialized, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageAttached, onPageDetached, onParentChanged, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, renderPropertiesOnly, 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, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerialize
-
-
-
-
Constructor Detail
-
Timepicker
public Timepicker()
-
Timepicker
public Timepicker(java.util.Date date) throws org.zkoss.zk.ui.WrongValueException- Throws:
org.zkoss.zk.ui.WrongValueException
-
Timepicker
public Timepicker(java.time.ZonedDateTime value) throws org.zkoss.zk.ui.WrongValueException- Throws:
org.zkoss.zk.ui.WrongValueException
-
Timepicker
public Timepicker(java.time.LocalDateTime value) throws org.zkoss.zk.ui.WrongValueException- Throws:
org.zkoss.zk.ui.WrongValueException
-
Timepicker
public Timepicker(java.time.LocalTime value) throws org.zkoss.zk.ui.WrongValueException- Throws:
org.zkoss.zk.ui.WrongValueException
-
-
Method Detail
-
setFormat
public void setFormat(java.lang.String format) throws org.zkoss.zk.ui.WrongValueExceptionSets the date format.If null or empty is specified,
getDefaultFormat()is assumed. Since 5.0.7, you could specify one of the following reserved words, andDateFormats.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)withDateFormat.SHORTmedium DateFormats.getTimeFormat(int, java.util.Locale, java.lang.String)withDateFormat.MEDIUMIn additions, the format could be a combination of the following pattern letters:
Letter Date or Time Component Presentation Examples aAm/pm marker Text PMHHour in day (0-23) Number 0kHour in day (1-24) Number 24KHour in am/pm (0-11) Number 0hHour in am/pm (1-12) Number 12mMinute in hour Number 30sSecond in minute Number 55- Overrides:
setFormatin classorg.zkoss.zul.impl.FormatInputElement- Throws:
org.zkoss.zk.ui.WrongValueException
-
getRealFormat
public java.lang.String getRealFormat()
Returns the real format, i.e., the combination of the format patterns, such as hh:mm.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.- Overrides:
getRealFormatin classorg.zkoss.zul.impl.FormatInputElement
-
setValueInLocalDate
public void setValueInLocalDate(java.time.LocalDate value) throws org.zkoss.zk.ui.WrongValueExceptionIt is meaningless to set only LocalDate in timepicker.- Overrides:
setValueInLocalDatein classorg.zkoss.zul.impl.DateTimeFormatInputElement- Throws:
org.zkoss.zk.ui.WrongValueException
-
getMin
public java.util.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)
-
setMin
public void setMin(java.util.Date min)
Sets the minimum time used to generate the options in Timepicker
-
getMinInLocalTime
public java.time.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)- Since:
- 9.0.0
-
setMinInLocalTime
public void setMinInLocalTime(java.time.LocalTime min)
Sets the minimum time used to generate the options in Timepicker- Since:
- 9.0.0
-
getMax
public java.util.Date getMax()
Returns the maximum time used to generate the options in Timepicker, or null if the default maximum time is used.
-
setMax
public void setMax(java.util.Date max)
Sets the maximum time used to generate the options in Timepicker
-
getMaxInLocalTime
public java.time.LocalTime getMaxInLocalTime()
Returns the maximum time used to generate the options in Timepicker, or null if the default maximum time is used.- Since:
- 9.0.0
-
setMaxInLocalTime
public void setMaxInLocalTime(java.time.LocalTime max)
Sets the maximum time used to generate the options in Timepicker- Since:
- 9.0.0
-
getInterval
public int getInterval()
Returns the interval time used to generate the options in TimepickerUnit: second
Default:
3600, i.e. 1hr
-
setInterval
public void setInterval(int interval)
Sets the interval time used to generate the options in TimepickerUnit: 1 second
-
isReadonly
public boolean isReadonly()
- Specified by:
isReadonlyin interfaceorg.zkoss.zk.ui.ext.Readonly- Overrides:
isReadonlyin classorg.zkoss.zul.impl.InputElement
-
setReadonly
public void setReadonly(boolean readonly)
- Specified by:
setReadonlyin interfaceorg.zkoss.zk.ui.ext.Readonly- Overrides:
setReadonlyin classorg.zkoss.zul.impl.InputElement
-
setConstraint
public void setConstraint(java.lang.String constr)
- Overrides:
setConstraintin classorg.zkoss.zul.impl.InputElement- Parameters:
constr- a list of constraints separated by comma. Example: between 093000 and 183000, before 210000
-
getDefaultFormat
protected java.lang.String getDefaultFormat()
Returns the default format, which is used when constructing a timepicker.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).
-
coerceFromString
protected java.lang.Object coerceFromString(java.lang.String value) throws org.zkoss.zk.ui.WrongValueException- Specified by:
coerceFromStringin classorg.zkoss.zul.impl.InputElement- Throws:
org.zkoss.zk.ui.WrongValueException
-
coerceToString
protected java.lang.String coerceToString(java.lang.Object value)
- Specified by:
coerceToStringin classorg.zkoss.zul.impl.InputElement
-
getDateFormat
protected java.text.DateFormat getDateFormat(java.lang.String fmt)
Returns the date format of the time only,Default: it uses SimpleDateFormat to format the date.
-
getZclass
public java.lang.String getZclass()
- Overrides:
getZclassin classorg.zkoss.zk.ui.HtmlBasedComponent
-
renderProperties
protected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) throws java.io.IOException- Overrides:
renderPropertiesin classorg.zkoss.zul.impl.DateTimeFormatInputElement- Throws:
java.io.IOException
-
-