Package org.zkoss.zkmax.zul

## 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`, `Component`, `Disable`, `Readonly`, `Scope`, `ComponentCtrl`, `Constrainted`

      public class Timepicker
      extends DateTimeFormatInputElement

  An input box for holding a time (a `Date` Object), but only Hour, Minute, Second are used.

  Default `getZclass()`: z-timepicker.

  Since:
    8.0.0
  Author:
    James Chu
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.zkoss.zk.ui.HtmlBasedComponent

      `HtmlBasedComponent.ExtraCtrl`

    - ### Nested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent

      `AbstractComponent.Children, AbstractComponent.ForwardInfo, AbstractComponent.TargetInfo`

  - ### Field Summary

    - ### Fields inherited from class org.zkoss.zul.impl.DateTimeFormatInputElement

      `_locale, _tzone`

    - ### Fields inherited from class org.zkoss.zul.impl.InputElement

      `_cols, _value`

    - ### Fields inherited from class org.zkoss.zk.ui.HtmlBasedComponent

      `_zclass`

    - ### Fields inherited from interface org.zkoss.zk.ui.Component

      `APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE`

    - ### Fields inherited from interface org.zkoss.zk.ui.sys.ComponentCtrl

      `AFTER_CHILD_ADDED, AFTER_CHILD_REMOVED, AFTER_CLONED, AFTER_PAGE_ATTACHED, AFTER_PAGE_DETACHED, AFTER_PARENT_CHANGED, CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE`

  - ### 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.Object` | `coerceFromString​(java.lang.String value)` | Coerces the value passed to `InputElement.setText(java.lang.String)`.
    `protected java.lang.String` | `coerceToString​(java.lang.Object value)` | Coerces the value passed to `InputElement.setText(java.lang.String)`.
    `protected java.text.DateFormat` | `getDateFormat​(java.lang.String fmt)` | Returns the date format of the time only,
    `protected java.lang.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
    `java.util.Date` | `getMax()` | Returns the maximum time used to generate the options in Timepicker, or null if the default maximum time is used.
    `java.time.LocalTime` | `getMaxInLocalTime()` | Returns the maximum time used to generate the options in Timepicker, or null if the default maximum time is used.
    `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)
    `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)
    `java.lang.String` | `getRealFormat()` | Returns the real format, i.e., the combination of the format patterns, such as hh:mm.
    `java.lang.String` | `getZclass()` | Returns the ZK Cascading Style class for this component.
    `boolean` | `isReadonly()` | Returns whether it is readonly.
    `protected void` | `renderProperties​(ContentRenderer renderer)` | Renders the content of this component, excluding the enclosing tags and children.
    `void` | `setConstraint​(java.lang.String constr)` |
    `void` | `setFormat​(java.lang.String format)` | Sets the date format.
    `void` | `setInterval​(int interval)` | Sets the interval time used to generate the options in Timepicker
    `void` | `setMax​(java.util.Date max)` | Sets the maximum time used to generate the options in Timepicker
    `void` | `setMaxInLocalTime​(java.time.LocalTime max)` | Sets the maximum time used to generate the options in Timepicker
    `void` | `setMin​(java.util.Date min)` | Sets the minimum time used to generate the options in Timepicker
    `void` | `setMinInLocalTime​(java.time.LocalTime min)` | Sets the minimum time used to generate the options in Timepicker
    `void` | `setReadonly​(boolean readonly)` | Sets whether it is readonly.
    `void` | `setValueInLocalDate​(java.time.LocalDate value)` | It is meaningless to set only LocalDate in timepicker.

    - ### Methods inherited from class org.zkoss.zul.impl.DateTimeFormatInputElement

      `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.FormatInputElement

      `getFormat`

    - ### 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`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### Timepicker

          public Timepicker()

    - #### Timepicker

          public Timepicker​(java.util.Date date)
                     throws WrongValueException

      Throws:
        `WrongValueException`

    - #### Timepicker

          public Timepicker​(java.time.ZonedDateTime value)
                     throws WrongValueException

      Throws:
        `WrongValueException`

    - #### Timepicker

          public Timepicker​(java.time.LocalDateTime value)
                     throws WrongValueException

      Throws:
        `WrongValueException`

    - #### Timepicker

          public Timepicker​(java.time.LocalTime value)
                     throws WrongValueException

      Throws:
        `WrongValueException`

  - ### Method Detail

    - #### setFormat

          public void setFormat​(java.lang.String format)
                         throws WrongValueException

      Sets 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, 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`

      Overrides:
        `setFormat` in class `FormatInputElement`
      Throws:
        `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:
        `getRealFormat` in class `FormatInputElement`

    - #### setValueInLocalDate

          public void setValueInLocalDate​(java.time.LocalDate value)
                                   throws WrongValueException

      It is meaningless to set only LocalDate in timepicker.
      Overrides:
        `setValueInLocalDate` in class `DateTimeFormatInputElement`
      Parameters:
        `value` - the date to be assigned to this component.
        Notice that, if this component does not allow users to select the time (i.e., the format limited to year, month and day), the date specified here is better to set hour, minutes, seconds and milliseconds to zero (for the current timezone, `TimeZones.getCurrent()`), so it is easier to work with other libraries, such as SQL. `Dates` has a set of utilities to simplify the task.
      Throws:
        `WrongValueException` - if value is wrong

    - #### 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 Timepicker

      Unit: second

      Default: `3600`, i.e. 1hr

    - #### setInterval

          public void setInterval​(int interval)

      Sets the interval time used to generate the options in Timepicker

      Unit: 1 second

    - #### isReadonly

          public boolean isReadonly()

      Description copied from class: `InputElement`
      Returns whether it is readonly.

      Default: false.

      Specified by:
        `isReadonly` in interface `Readonly`
      Overrides:
        `isReadonly` in class `InputElement`

    - #### setReadonly

          public void setReadonly​(boolean readonly)

      Description copied from class: `InputElement`
      Sets whether it is readonly.
      Specified by:
        `setReadonly` in interface `Readonly`
      Overrides:
        `setReadonly` in class `InputElement`

    - #### setConstraint

          public void setConstraint​(java.lang.String constr)

      Overrides:
        `setConstraint` in class `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 WrongValueException

      Description copied from class: `InputElement`
      Coerces the value passed to `InputElement.setText(java.lang.String)`.

      Deriving note:
      If you want to store the value in other type, say BigDecimal, you have to override `InputElement.coerceToString(java.lang.Object)` and `InputElement.coerceFromString(java.lang.String)` to convert between a string and your targeting type.

      Moreover, when `Textbox` is called, it calls this method with value = null. Derives shall handle this case properly.

      Specified by:
        `coerceFromString` in class `InputElement`
      Throws:
        `WrongValueException`

    - #### coerceToString

          protected java.lang.String coerceToString​(java.lang.Object value)

      Description copied from class: `InputElement`
      Coerces the value passed to `InputElement.setText(java.lang.String)`.

      Default: convert null to an empty string.

      Deriving note:
      If you want to store the value in other type, say BigDecimal, you have to override `InputElement.coerceToString(java.lang.Object)` and `InputElement.coerceFromString(java.lang.String)` to convert between a string and your targeting type.

      Specified by:
        `coerceToString` in class `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()

      Description copied from class: `HtmlBasedComponent`
      Returns the ZK Cascading Style class for this component. It usually depends on the implementation of the mold (`AbstractComponent.getMold()`).

      Default: null (the default value depends on element).

      `HtmlBasedComponent.setZclass(java.lang.String)`) will completely replace the default style of a component. In other words, the default style of a component is associated with the default value of `HtmlBasedComponent.getZclass()`. Once it is changed, the default style won't be applied at all. If you want to perform small adjustments, use `HtmlBasedComponent.setSclass(java.lang.String)` instead.

      Overrides:
        `getZclass` in class `HtmlBasedComponent`
      See Also:
        `HtmlBasedComponent.getSclass()`

    - #### renderProperties

          protected void renderProperties​(ContentRenderer renderer)
                                   throws java.io.IOException

      Description copied from class: `HtmlBasedComponent`
      Renders the content of this component, excluding the enclosing tags and children.

      See also ZK Client-side Reference: Property Rendering

      Overrides:
        `renderProperties` in class `DateTimeFormatInputElement`
      Throws:
        `java.io.IOException`