Package org.zkoss.zul.impl

## Class DateTimeFormatInputElement

- 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

- All Implemented Interfaces:
    `java.io.Serializable`, `java.lang.Cloneable`, `Component`, `Disable`, `Readonly`, `Scope`, `ComponentCtrl`, `Constrainted`
  Direct Known Subclasses:
    `Datebox`, `Timebox`, `Timepicker`

      public abstract class DateTimeFormatInputElement
      extends FormatInputElement

  A skeletal implementation for date/time type input box.
  Since:
    9.0.0
  Author:
    rudyhuang
  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
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected java.util.Locale` | `_locale` |
    `protected java.util.TimeZone` | `_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
    --- | ---
    `DateTimeFormatInputElement()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.util.Locale` | `getLocale()` | Returns the locale associated with this component, or null if `Locales.getCurrent()` is preferred.
    `PropertyAccess` | `getPropertyAccess​(java.lang.String prop)` | Returns the corresponding property access object from the given property name, if any.
    `java.util.TimeZone` | `getTimeZone()` | Returns the time zone that this component belongs to, or null if the default time zone is used.
    `java.util.Date` | `getValue()` | Returns the value (in Date), might be null unless a constraint stops it.
    `java.time.LocalDate` | `getValueInLocalDate()` | Returns the value (in LocalDate), might be null unless a constraint stops it.
    `java.time.LocalDateTime` | `getValueInLocalDateTime()` | Returns the value (in LocalDateTime), might be null unless a constraint stops it.
    `java.time.LocalTime` | `getValueInLocalTime()` | Returns the value (in LocalTime), might be null unless a constraint stops it.
    `java.time.ZonedDateTime` | `getValueInZonedDateTime()` | Returns the value (in ZonedDateTime), might be null unless a constraint stops it.
    `protected java.time.ZoneId` | `getZoneId()` |
    `protected void` | `renderProperties​(ContentRenderer renderer)` | Renders the content of this component, excluding the enclosing tags and children.
    `void` | `setConstraint​(Constraint constr)` | Sets the constraint.
    `void` | `setLocale​(java.lang.String locale)` | Sets the locale used to identify the format of this component.
    `void` | `setLocale​(java.util.Locale locale)` | Sets the locale used to identify the format of this component.
    `void` | `setTimeZone​(java.lang.String id)` | Sets the time zone that this component belongs to, or null if the default time zone is used.
    `void` | `setTimeZone​(java.util.TimeZone tzone)` | Sets the time zone that this component belongs to, or null if the default time zone is used.
    `void` | `setValue​(java.util.Date value)` | Sets the value (in Date).
    `void` | `setValueInLocalDate​(java.time.LocalDate value)` | Sets the value (in LocalDate).
    `void` | `setValueInLocalDateTime​(java.time.LocalDateTime value)` | Sets the value (in LocalDateTime).
    `void` | `setValueInLocalTime​(java.time.LocalTime value)` | Sets the value (in LocalTime).
    `void` | `setValueInZonedDateTime​(java.time.ZonedDateTime value)` | Sets the value (in ZonedDateTime).
    `protected java.util.Date` | `toDate​(java.time.LocalDate value)` |
    `protected java.util.Date` | `toDate​(java.time.LocalDateTime value)` |
    `protected java.util.Date` | `toDate​(java.time.LocalTime value)` |
    `protected java.time.ZonedDateTime` | `toZonedDateTime​(java.util.Date value)` |

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

      `getFormat, getRealFormat, setFormat`

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

      `checkUserError, clearErrorMessage, clearErrorMessage, clone, coerceFromString, coerceToString, getCols, getConstraint, getConstraintString, 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, setConstraint, setDisabled, setErrorboxIconSclass, setErrorboxSclass, setErrorMessage, setInplace, setInputAttributes, setInputAttributes, setInsertedText, setInstant, setMaxlength, setName, setPlaceholder, setRawValue, setReadonly, 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, getZclass, 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`

- - ### Field Detail

    - #### _locale

          protected java.util.Locale _locale

    - #### _tzone

          protected java.util.TimeZone _tzone

  - ### Constructor Detail

    - #### DateTimeFormatInputElement

          public DateTimeFormatInputElement()

  - ### Method Detail

    - #### getLocale

          public java.util.Locale getLocale()

      Returns the locale associated with this component, or null if `Locales.getCurrent()` is preferred.
      Since:
        5.0.7

    - #### setLocale

          public void setLocale​(java.util.Locale locale)

      Sets the locale used to identify the format of this component.

      Default: null (i.e., `Locales.getCurrent()`, the current locale is assumed)

      Since:
        5.0.7

    - #### setLocale

          public void setLocale​(java.lang.String locale)

      Sets the locale used to identify the format of this component.

      Default: null (i.e., `Locales.getCurrent()`, the current locale is assumed)

      Since:
        5.0.7

    - #### getTimeZone

          public java.util.TimeZone getTimeZone()

      Returns the time zone that this component belongs to, or null if the default time zone is used.

      The default time zone is determined by `TimeZones.getCurrent()`.

    - #### setTimeZone

          public void setTimeZone​(java.util.TimeZone tzone)

      Sets the time zone that this component belongs to, or null if the default time zone is used.

      The default time zone is determined by `TimeZones.getCurrent()`.

    - #### setTimeZone

          public void setTimeZone​(java.lang.String id)

      Sets the time zone that this component belongs to, or null if the default time zone is used.

      The default time zone is determined by `TimeZones.getCurrent()`.

      Parameters:
        `id` - the time zone's ID, such as "America/Los_Angeles". The time zone will be retrieved by calling TimeZone.getTimeZone(id).

    - #### getZoneId

          protected java.time.ZoneId getZoneId()

    - #### setConstraint

          public void setConstraint​(Constraint constr)

      Description copied from interface: `Constrainted`
      Sets the constraint.

      Default: null (means no constraint all all).

      Specified by:
        `setConstraint` in interface `Constrainted`
      Overrides:
        `setConstraint` in class `InputElement`

    - #### getValue

          public java.util.Date getValue()
                                  throws WrongValueException

      Returns the value (in Date), might be null unless a constraint stops it.
      Throws:
        `WrongValueException` - if user entered a wrong value

    - #### setValue

          public void setValue​(java.util.Date value)
                        throws WrongValueException

      Sets the value (in Date).
      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

    - #### getValueInZonedDateTime

          public java.time.ZonedDateTime getValueInZonedDateTime()
                                                          throws WrongValueException

      Returns the value (in ZonedDateTime), might be null unless a constraint stops it.
      Throws:
        `WrongValueException` - if user entered a wrong value
      Since:
        9.0.0

    - #### setValueInZonedDateTime

          public void setValueInZonedDateTime​(java.time.ZonedDateTime value)
                                       throws WrongValueException

      Sets the value (in ZonedDateTime).
      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
      Since:
        9.0.0

    - #### getValueInLocalDateTime

          public java.time.LocalDateTime getValueInLocalDateTime()
                                                          throws WrongValueException

      Returns the value (in LocalDateTime), might be null unless a constraint stops it.
      Throws:
        `WrongValueException` - if user entered a wrong value
      Since:
        9.0.0

    - #### setValueInLocalDateTime

          public void setValueInLocalDateTime​(java.time.LocalDateTime value)
                                       throws WrongValueException

      Sets the value (in LocalDateTime).
      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
      Since:
        9.0.0

    - #### getValueInLocalDate

          public java.time.LocalDate getValueInLocalDate()
                                                  throws WrongValueException

      Returns the value (in LocalDate), might be null unless a constraint stops it.
      Throws:
        `WrongValueException` - if user entered a wrong value
      Since:
        9.0.0

    - #### setValueInLocalDate

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

      Sets the value (in LocalDate).
      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
      Since:
        9.0.0

    - #### getValueInLocalTime

          public java.time.LocalTime getValueInLocalTime()
                                                  throws WrongValueException

      Returns the value (in LocalTime), might be null unless a constraint stops it.
      Throws:
        `WrongValueException` - if user entered a wrong value
      Since:
        9.0.0

    - #### setValueInLocalTime

          public void setValueInLocalTime​(java.time.LocalTime value)
                                   throws WrongValueException

      Sets the value (in LocalTime).
      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
      Since:
        9.0.0

    - #### toZonedDateTime

          protected java.time.ZonedDateTime toZonedDateTime​(java.util.Date value)

    - #### toDate

          protected java.util.Date toDate​(java.time.LocalDateTime value)

    - #### toDate

          protected java.util.Date toDate​(java.time.LocalDate value)

    - #### toDate

          protected java.util.Date toDate​(java.time.LocalTime value)

    - #### 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 `FormatInputElement`
      Throws:
        `java.io.IOException`

    - #### getPropertyAccess

          public PropertyAccess getPropertyAccess​(java.lang.String prop)

      Description copied from interface: `ComponentCtrl`
      Returns the corresponding property access object from the given property name, if any.
      Specified by:
        `getPropertyAccess` in interface `ComponentCtrl`
      Overrides:
        `getPropertyAccess` in class `FormatInputElement`
      Parameters:
        `prop` - the name of the property
      Returns:
        null it means not to support for the property name.