Interface IDaterangebox
-
- All Superinterfaces:
IAnyGroup<IDaterangebox>,IComponent<IDaterangebox>,IDisable<IDaterangebox>,IHtmlBasedComponent<IDaterangebox>,IReadonly<IDaterangebox>,IXulElement<IDaterangebox>
public interface IDaterangebox extends IXulElement<IDaterangebox>, IDisable<IDaterangebox>, IReadonly<IDaterangebox>, IAnyGroup<IDaterangebox>
ImmutableDaterangeboxcomponent (ZK EE only).A date range picker. Allows users to select a contiguous range of dates (optionally including time) via a popup with one or more side-by-side calendar panels and an optional minimum / maximum length constraint.
The range is carried by a single
valueof typeDateRange;beginValueandendValueare derived views of its two endpoints. Either end may benullwhenallowEmptypermits.Support @Action
Name Action Type onChange ActionData: DateRangeData
Denotes the committed range has been changed by the user.onChanging ActionData: DateRangeData
Denotes the user is typing into one of the two inputs; the range is not committed yet.onOpen ActionData: OpenData
Denotes the calendar popup has been opened or closed.onError ActionData: ErrorData
Denotes the user entered a value that cannot be parsed.Constraint
The
constraintis aSimpleDateConstraintexpression applied to both endpoints, for exampleIDaterangebox.ofConstraint("between 20240101 and 20241231"); IDaterangebox.ofConstraint("no past");Only the string form is supported, the same way
IInputElement.withConstraint(String)andICalendar.withConstraint(String)are — a server-sideConstraintinstance has no place in an immutable component.Length Option
withMinNights(int)andwithMaxNights(int)bound the number of nights between the two endpoints;0disables the bound.Position
By default, the popup position is set to
after_start, for other possible popup positions please refer toIPopupBase.Position.- Since:
- 11.0.0
- Author:
- peaker
- See Also:
Daterangebox
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classIDaterangebox.BuilderBuilds instances of typeIDaterangebox.static classIDaterangebox.UpdaterBuilds an updater of typeIDaterangeboxforUiAgent.smartUpdate(Locator, SmartUpdater).
-
Field Summary
Fields Modifier and Type Field Description static IDaterangeboxDEFAULTConstant for default attributes of this immutable component.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default java.lang.StringgetAllowEmpty()Returns which endpoints may be left empty: one of"none","begin","end"or"both".default java.lang.StringgetAutocomplete()Returns the HTMLautocompletetoken applied to both range inputs.java.lang.StringgetBeginPlaceholder()Returns the placeholder for the begin input, ornullif none.default java.util.DategetBeginValue()Returns the begin endpoint, ornullif unset.java.lang.StringgetConstraint()Returns theSimpleDateConstraintexpression applied to both endpoints, ornullif none.java.lang.StringgetEndPlaceholder()Returns the placeholder for the end input, ornullif none.default java.util.DategetEndValue()Returns the end endpoint, ornullif unset.java.lang.StringgetFormat()Returns the raw date format pattern, ornullif none was set (in which casegetRealFormat()supplies the locale-derived fallback).java.util.LocalegetLocale()Returns the locale used for month/weekday labels and the first-day-of-week, ornull(the page/current locale) if unset.default intgetMaxNights()Returns the maximum number of nights allowed between begin and end.default intgetMinNights()Returns the minimum number of nights required between begin and end.default intgetNumberOfMonths()Returns the number of side-by-side calendar panels shown in the popup.java.lang.StringgetPlaceholder()Returns the placeholder applied to both inputs when no per-input placeholder is set, ornullif none.default java.lang.StringgetPosition()Returns the popup anchor position token.default java.lang.StringgetSeparator()Returns the separator rendered between the two date inputs.java.util.TimeZonegetTimeZone()Returns the time zone used for calendar-day boundary decisions and constraint-bound parsing, ornull(the current time zone) if unset.default java.lang.StringgetTodayLinkLabel()Returns the label of the "Today" shortcut shown in the popup footer.org.zkoss.zul.DateRangegetValue()Returns the current range, ornullif unset.default java.lang.StringgetWidgetClass()Returns the client widget class.default booleanisButtonVisible()Returns whether the calendar drop-down button is shown to the right of the inputs.default booleanisHoverPreview()Returns whether hovering a candidate end date previews the range in the calendar.default booleanisLenient()Returns whether date parsing is lenient.default java.lang.BooleanisShowTime()Returns whether the popup shows a time picker and the inputs display the time component, ornullwhen it was never set.default booleanisShowTodayLink()Returns whether the "Today" shortcut link is shown in the day view.default booleanisStrictDate()Returns whether strict date validation is enabled, rejecting impossible dates such as"Nov 31".default booleanisWeekOfYear()Returns whether the week-of-year column is shown in the calendar panels.static IDaterangeboxof(java.util.Date beginValue, java.util.Date endValue)Returns the instance with the given endpoints.static IDaterangeboxof(org.zkoss.zul.DateRange value)Returns the instance with the given range.static IDaterangeboxofConstraint(java.lang.String constraint)Returns the instance with the given constraint.static IDaterangeboxofFormat(java.lang.String format)Returns the instance with the given format.static IDaterangeboxofId(java.lang.String id)Returns the instance with the given id.IDaterangeboxwithAllowEmpty(java.lang.String allowEmpty)Returns a copy ofthisimmutable component with the specifiedallowEmpty.IDaterangeboxwithAutocomplete(java.lang.String autocomplete)Returns a copy ofthisimmutable component with the specifiedautocomplete.IDaterangeboxwithBeginPlaceholder(java.lang.String beginPlaceholder)Returns a copy ofthisimmutable component with the specifiedbeginPlaceholder.default IDaterangeboxwithBeginValue(java.util.Date beginValue)Returns a copy ofthisimmutable component with the specifiedbeginValue, keeping the current end endpoint.default IDaterangeboxwithBeginValueInLocalDate(java.time.LocalDate beginValue)Returns a copy ofthisimmutable component with the specifiedbeginValuetaken at start of day ingetTimeZone().default IDaterangeboxwithBeginValueInLocalDateTime(java.time.LocalDateTime beginValue)Returns a copy ofthisimmutable component with the specifiedbeginValue, interpreted ingetTimeZone().default IDaterangeboxwithBeginValueInZonedDateTime(java.time.ZonedDateTime beginValue)Returns a copy ofthisimmutable component with the specifiedbeginValue(its instant is used).IDaterangeboxwithButtonVisible(boolean buttonVisible)Returns a copy ofthisimmutable component with the specifiedbuttonVisible.IDaterangeboxwithConstraint(java.lang.String constraint)Returns a copy ofthisimmutable component with the specifiedconstraint.IDaterangeboxwithEndPlaceholder(java.lang.String endPlaceholder)Returns a copy ofthisimmutable component with the specifiedendPlaceholder.default IDaterangeboxwithEndValue(java.util.Date endValue)Returns a copy ofthisimmutable component with the specifiedendValue, keeping the current begin endpoint.default IDaterangeboxwithEndValueInLocalDate(java.time.LocalDate endValue)Returns a copy ofthisimmutable component with the specifiedendValuetaken at start of day ingetTimeZone().default IDaterangeboxwithEndValueInLocalDateTime(java.time.LocalDateTime endValue)Returns a copy ofthisimmutable component with the specifiedendValue, interpreted ingetTimeZone().default IDaterangeboxwithEndValueInZonedDateTime(java.time.ZonedDateTime endValue)Returns a copy ofthisimmutable component with the specifiedendValue(its instant is used).IDaterangeboxwithFormat(java.lang.String format)Returns a copy ofthisimmutable component with the specifiedformat.IDaterangeboxwithHoverPreview(boolean hoverPreview)Returns a copy ofthisimmutable component with the specifiedhoverPreview.IDaterangeboxwithLenient(boolean lenient)Returns a copy ofthisimmutable component with the specifiedlenient.default IDaterangeboxwithLocale(java.lang.String locale)Returns a copy ofthisimmutable component with the specifiedlocale.IDaterangeboxwithLocale(java.util.Locale locale)Returns a copy ofthisimmutable component with the specifiedlocale.IDaterangeboxwithMaxNights(int maxNights)Returns a copy ofthisimmutable component with the specifiedmaxNights.IDaterangeboxwithMinNights(int minNights)Returns a copy ofthisimmutable component with the specifiedminNights.IDaterangeboxwithNumberOfMonths(int numberOfMonths)Returns a copy ofthisimmutable component with the specifiednumberOfMonths.IDaterangeboxwithPlaceholder(java.lang.String placeholder)Returns a copy ofthisimmutable component with the specifiedplaceholder.IDaterangeboxwithPosition(java.lang.String position)Returns a copy ofthisimmutable component with the specifiedposition.default IDaterangeboxwithPosition(IPopupBase.Position position)Returns a copy ofthisimmutable component with the specifiedposition.IDaterangeboxwithSeparator(java.lang.String separator)Returns a copy ofthisimmutable component with the specifiedseparator.IDaterangeboxwithShowTime(java.lang.Boolean showTime)Returns a copy ofthisimmutable component with the specifiedshowTime.IDaterangeboxwithShowTodayLink(boolean showTodayLink)Returns a copy ofthisimmutable component with the specifiedshowTodayLink.IDaterangeboxwithStrictDate(boolean strictDate)Returns a copy ofthisimmutable component with the specifiedstrictDate.default IDaterangeboxwithTimeZone(java.lang.String timeZone)Returns a copy ofthisimmutable component with the specifiedtimeZone.IDaterangeboxwithTimeZone(java.util.TimeZone timeZone)Returns a copy ofthisimmutable component with the specifiedtimeZone.IDaterangeboxwithTodayLinkLabel(java.lang.String todayLinkLabel)Returns a copy ofthisimmutable component with the specifiedtodayLinkLabel.IDaterangeboxwithValue(org.zkoss.zul.DateRange value)Returns a copy ofthisimmutable component with the specifiedvalue.default IDaterangeboxwithValueInLocalDate(org.zkoss.zul.LocalDateRange value)Returns a copy ofthisimmutable component with the specifiedvalue, each end taken at start of day ingetTimeZone().default IDaterangeboxwithValueInLocalDateTime(org.zkoss.zul.LocalDateTimeRange value)Returns a copy ofthisimmutable component with the specifiedvalue, each end interpreted ingetTimeZone().default IDaterangeboxwithValueInZonedDateTime(org.zkoss.zul.ZonedDateTimeRange value)Returns a copy ofthisimmutable component with the specifiedvalue(each end's instant is used).IDaterangeboxwithWeekOfYear(boolean weekOfYear)Returns a copy ofthisimmutable component with the specifiedweekOfYear.-
Methods inherited from interface org.zkoss.stateless.sul.IComponent
getAction, getActions, getClientAttributes, getId, getMold, getWidgetListeners, getWidgetOverrides, isVisible, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withActions, withActions, withClientAttribute, withClientAttributes, withId, withMold, withVisible, withWidgetClass, withWidgetListener, withWidgetListeners, withWidgetOverride, withWidgetOverrides
-
Methods inherited from interface org.zkoss.stateless.sul.IDisable
isDisabled, withDisabled
-
Methods inherited from interface org.zkoss.stateless.sul.IHtmlBasedComponent
getClientAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getSkeleton, getStyle, getTabindex, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZIndex, isFocus, withClientAction, withDraggable, withDroppable, withFocus, withHeight, withHflex, withLeft, withRenderdefer, withSclass, withSkeleton, withStyle, withTabindex, withTabindex, withTooltiptext, withTop, withVflex, withWidth, withZclass, withZIndex
-
Methods inherited from interface org.zkoss.stateless.sul.IReadonly
isReadonly, withReadonly
-
Methods inherited from interface org.zkoss.stateless.sul.IXulElement
getContext, getCtrlKeys, getPopup, getTooltip, withContext, withCtrlKeys, withPopup, withTooltip
-
-
-
-
Field Detail
-
DEFAULT
static final IDaterangebox DEFAULT
Constant for default attributes of this immutable component.
-
-
Method Detail
-
getWidgetClass
default java.lang.String getWidgetClass()
Returns the client widget class.Default:
"zkmax.db.Daterangebox"- Specified by:
getWidgetClassin interfaceIComponent<IDaterangebox>
-
getValue
@Nullable org.zkoss.zul.DateRange getValue()
Returns the current range, ornullif unset. Either end of a non-null range may itself benull(an open-ended range).This is the one stored endpoint attribute;
getBeginValue()andgetEndValue()are derived from it.DateRangecopies both ends on the way in and on the way out, so a caller that keeps a reference to theDateit passed cannot mutate this component afterwards.Default:
null
-
withValue
IDaterangebox withValue(@Nullable org.zkoss.zul.DateRange value)
Returns a copy ofthisimmutable component with the specifiedvalue.Sets both endpoints at once.
Note:
UiAgent.smartUpdate(Locator, SmartUpdater)is not supported for this property —IDaterangebox.Updaterships the raw attribute while the initial render ships the epoch millis the client widget parses. Push a whole component withUiAgent.replaceWith(Locator, IComponent)instead.- Parameters:
value- The range;nullclears both ends.- Returns:
- A modified copy of the
thisobject
-
getBeginValue
@Nullable @Derived default java.util.Date getBeginValue()
Returns the begin endpoint, ornullif unset.A derived snapshot of
getValue(); mutating the returnedDateis not supported, callgetValue()for a fresh copy.Default:
null
-
withBeginValue
default IDaterangebox withBeginValue(@Nullable java.util.Date beginValue)
Returns a copy ofthisimmutable component with the specifiedbeginValue, keeping the current end endpoint.Sets the begin endpoint. See
withValue(DateRange)for thesmartUpdaterestriction.- Parameters:
beginValue- The begin date;nullclears the begin endpoint.Default:
null.- Returns:
- A modified copy of the
thisobject
-
getEndValue
@Nullable @Derived default java.util.Date getEndValue()
Returns the end endpoint, ornullif unset.A derived snapshot of
getValue(); mutating the returnedDateis not supported, callgetValue()for a fresh copy.Default:
null
-
withEndValue
default IDaterangebox withEndValue(@Nullable java.util.Date endValue)
Returns a copy ofthisimmutable component with the specifiedendValue, keeping the current begin endpoint.Sets the end endpoint. See
withValue(DateRange)for thesmartUpdaterestriction.- Parameters:
endValue- The end date;nullclears the end endpoint.Default:
null.- Returns:
- A modified copy of the
thisobject
-
withBeginValueInLocalDate
default IDaterangebox withBeginValueInLocalDate(@Nullable java.time.LocalDate beginValue)
Returns a copy ofthisimmutable component with the specifiedbeginValuetaken at start of day ingetTimeZone().- Parameters:
beginValue- The begin date;nullclears the begin endpoint.- Returns:
- A modified copy of the
thisobject
-
withEndValueInLocalDate
default IDaterangebox withEndValueInLocalDate(@Nullable java.time.LocalDate endValue)
Returns a copy ofthisimmutable component with the specifiedendValuetaken at start of day ingetTimeZone().- Parameters:
endValue- The end date;nullclears the end endpoint.- Returns:
- A modified copy of the
thisobject
-
withValueInLocalDate
default IDaterangebox withValueInLocalDate(@Nullable org.zkoss.zul.LocalDateRange value)
Returns a copy ofthisimmutable component with the specifiedvalue, each end taken at start of day ingetTimeZone().- Parameters:
value- The range;nullclears both ends.- Returns:
- A modified copy of the
thisobject
-
withBeginValueInLocalDateTime
default IDaterangebox withBeginValueInLocalDateTime(@Nullable java.time.LocalDateTime beginValue)
Returns a copy ofthisimmutable component with the specifiedbeginValue, interpreted ingetTimeZone().- Parameters:
beginValue- The begin date-time;nullclears the begin endpoint.- Returns:
- A modified copy of the
thisobject
-
withEndValueInLocalDateTime
default IDaterangebox withEndValueInLocalDateTime(@Nullable java.time.LocalDateTime endValue)
Returns a copy ofthisimmutable component with the specifiedendValue, interpreted ingetTimeZone().- Parameters:
endValue- The end date-time;nullclears the end endpoint.- Returns:
- A modified copy of the
thisobject
-
withValueInLocalDateTime
default IDaterangebox withValueInLocalDateTime(@Nullable org.zkoss.zul.LocalDateTimeRange value)
Returns a copy ofthisimmutable component with the specifiedvalue, each end interpreted ingetTimeZone().- Parameters:
value- The range;nullclears both ends.- Returns:
- A modified copy of the
thisobject
-
withBeginValueInZonedDateTime
default IDaterangebox withBeginValueInZonedDateTime(@Nullable java.time.ZonedDateTime beginValue)
Returns a copy ofthisimmutable component with the specifiedbeginValue(its instant is used).- Parameters:
beginValue- The begin date-time;nullclears the begin endpoint.- Returns:
- A modified copy of the
thisobject
-
withEndValueInZonedDateTime
default IDaterangebox withEndValueInZonedDateTime(@Nullable java.time.ZonedDateTime endValue)
Returns a copy ofthisimmutable component with the specifiedendValue(its instant is used).- Parameters:
endValue- The end date-time;nullclears the end endpoint.- Returns:
- A modified copy of the
thisobject
-
withValueInZonedDateTime
default IDaterangebox withValueInZonedDateTime(@Nullable org.zkoss.zul.ZonedDateTimeRange value)
Returns a copy ofthisimmutable component with the specifiedvalue(each end's instant is used).- Parameters:
value- The range;nullclears both ends.- Returns:
- A modified copy of the
thisobject
-
getFormat
@Nullable java.lang.String getFormat()
Returns the raw date format pattern, ornullif none was set (in which casegetRealFormat()supplies the locale-derived fallback).Default:
null
-
withFormat
IDaterangebox withFormat(@Nullable java.lang.String format)
Returns a copy ofthisimmutable component with the specifiedformat.Sets the date format pattern applied to both input fields, using
java.text.SimpleDateFormatletters (e.g.yyyy/MM/dd).nullor""resets to the locale-aware MEDIUM fallback.Note:
UiAgent.smartUpdate(Locator, SmartUpdater)is not supported for this property —IDaterangebox.Updaterships the raw attribute while the initial render shipsgetRealFormat(). Push a whole component withUiAgent.replaceWith(Locator, IComponent)instead.- Parameters:
format- The format pattern, ornull/""for the default.Default:
null.- Returns:
- A modified copy of the
thisobject
-
getLocale
@Nullable java.util.Locale getLocale()
Returns the locale used for month/weekday labels and the first-day-of-week, ornull(the page/current locale) if unset.Default:
null
-
withLocale
IDaterangebox withLocale(@Nullable java.util.Locale locale)
Returns a copy ofthisimmutable component with the specifiedlocale.Sets the locale used for month/weekday labels and the first-day-of-week.
Note:
UiAgent.smartUpdate(Locator, SmartUpdater)is not supported for this property —IDaterangebox.Updaterships the raw attribute while the initial render shipslocale.toString()plus the localized symbols. Push a whole component withUiAgent.replaceWith(Locator, IComponent)instead.- Parameters:
locale- The preferred locale, ornullto use the current locale.Default:
null.- Returns:
- A modified copy of the
thisobject
-
withLocale
default IDaterangebox withLocale(@Nullable java.lang.String locale)
Returns a copy ofthisimmutable component with the specifiedlocale.Sets the locale from its string code (e.g.
"zh_TW").- Parameters:
locale- The locale code, ornull/""to clear.Default:
null.- Returns:
- A modified copy of the
thisobject
-
getTimeZone
@Nullable java.util.TimeZone getTimeZone()
Returns the time zone used for calendar-day boundary decisions and constraint-bound parsing, ornull(the current time zone) if unset.Default:
null
-
withTimeZone
IDaterangebox withTimeZone(@Nullable java.util.TimeZone timeZone)
Returns a copy ofthisimmutable component with the specifiedtimeZone.Sets the time zone used for calendar-day boundary decisions and for
SimpleDateConstraintbound parsing.Note:
UiAgent.smartUpdate(Locator, SmartUpdater)is not supported for this property —IDaterangebox.Updaterships the raw attribute while the initial render shipsDateTimeFormatInputElement.getFormattedTimeZone(timeZone). Push a whole component withUiAgent.replaceWith(Locator, IComponent)instead.- Parameters:
timeZone- The preferred time zone, ornullto use the current one.Default:
null.- Returns:
- A modified copy of the
thisobject
-
withTimeZone
default IDaterangebox withTimeZone(@Nullable java.lang.String timeZone)
Returns a copy ofthisimmutable component with the specifiedtimeZone.Sets the time zone from its ID (e.g.
"Asia/Tokyo").- Parameters:
timeZone- The time zone ID, ornull/""to clear.Default:
null.- Returns:
- A modified copy of the
thisobject - Throws:
org.zkoss.zk.ui.WrongValueException- iftimeZoneis not a recognized time zone ID.
-
getConstraint
@Nullable java.lang.String getConstraint()
Returns theSimpleDateConstraintexpression applied to both endpoints, ornullif none.Default:
null
-
withConstraint
IDaterangebox withConstraint(@Nullable java.lang.String constraint)
Returns a copy ofthisimmutable component with the specifiedconstraint.Sets the constraint from a
SimpleDateConstraintexpression (e.g."between 20240101 and 20241231","no past"), which is applied to both the begin and end values.- Parameters:
constraint- The constraint expression, ornullto clear.Default:
null.- Returns:
- A modified copy of the
thisobject
-
getNumberOfMonths
default int getNumberOfMonths()
Returns the number of side-by-side calendar panels shown in the popup.Default: the library property
org.zkoss.zul.daterangebox.numberOfMonths(2if unset).
-
withNumberOfMonths
IDaterangebox withNumberOfMonths(int numberOfMonths)
Returns a copy ofthisimmutable component with the specifiednumberOfMonths.Sets the number of side-by-side calendar panels shown in the popup.
- Parameters:
numberOfMonths- The panel count; must be between1and the configured maximum (library propertyorg.zkoss.zul.daterangebox.numberOfMonths.max, default12).- Returns:
- A modified copy of the
thisobject - Throws:
org.zkoss.zk.ui.WrongValueException- if it is outside that range.
-
getAllowEmpty
@Nullable default java.lang.String getAllowEmpty()
Returns which endpoints may be left empty: one of"none","begin","end"or"both".Default:
"both"
-
withAllowEmpty
IDaterangebox withAllowEmpty(@Nullable java.lang.String allowEmpty)
Returns a copy ofthisimmutable component with the specifiedallowEmpty.Sets which endpoints may be left empty.
- Parameters:
allowEmpty- one ofnone,begin,endorboth.Default:
"both".- Returns:
- A modified copy of the
thisobject - Throws:
org.zkoss.zk.ui.WrongValueException- if it is not one of the accepted tokens.
-
isShowTime
@Nullable default java.lang.Boolean isShowTime()
Returns whether the popup shows a time picker and the inputs display the time component, ornullwhen it was never set.Default:
null(unset)Tri-state, mirroring
Daterangebox'sBoolean _showTime:nullleaves the decision to the client, which auto-detects a time token in the format; an explicitfalsesuppresses that auto-detection. Only a non-null value reaches the wire, so the three states stay distinguishable.
-
withShowTime
IDaterangebox withShowTime(@Nullable java.lang.Boolean showTime)
Returns a copy ofthisimmutable component with the specifiedshowTime.Sets whether the popup shows a time picker. When turned on without an explicit format,
" HH:mm"is appended to the effective format (seegetRealFormat()).- Parameters:
showTime-trueto show the time picker,falseto suppress it even for a time-bearing format, ornullto let the client decide from the format.Default:
null.- Returns:
- A modified copy of the
thisobject
-
getMinNights
default int getMinNights()
Returns the minimum number of nights required between begin and end.0means no minimum.Default:
0
-
withMinNights
IDaterangebox withMinNights(int minNights)
Returns a copy ofthisimmutable component with the specifiedminNights.Sets the minimum number of nights required between begin and end.
- Parameters:
minNights- The minimum nights; must be>= 0and not exceed a non-zerogetMaxNights().Default:
0.- Returns:
- A modified copy of the
thisobject - Throws:
org.zkoss.zk.ui.WrongValueException- if it is negative, or greater than a configured non-zeromaxNights.
-
getMaxNights
default int getMaxNights()
Returns the maximum number of nights allowed between begin and end.0means unbounded.Default:
0
-
withMaxNights
IDaterangebox withMaxNights(int maxNights)
Returns a copy ofthisimmutable component with the specifiedmaxNights.Sets the maximum number of nights allowed between begin and end.
- Parameters:
maxNights- The maximum nights; must be>= 0and not less than a non-zerogetMinNights().Default:
0.- Returns:
- A modified copy of the
thisobject - Throws:
org.zkoss.zk.ui.WrongValueException- if it is negative, or less than a configured non-zerominNights.
-
getPosition
@Nullable default java.lang.String getPosition()
Returns the popup anchor position token.Default:
"after_start"
-
withPosition
IDaterangebox withPosition(@Nullable java.lang.String position)
Returns a copy ofthisimmutable component with the specifiedposition.Position the calendar popup to the specified location.
- Parameters:
position- Where to position. Default:after_start. It accepts the same tokens asIPopupBase.Position.- Returns:
- A modified copy of the
thisobject
-
withPosition
default IDaterangebox withPosition(IPopupBase.Position position)
Returns a copy ofthisimmutable component with the specifiedposition.Position the calendar popup to the specified location.
- Parameters:
position- Where to position. Default:IPopupBase.Position.AFTER_START- Returns:
- A modified copy of the
thisobject
-
isButtonVisible
default boolean isButtonVisible()
Returns whether the calendar drop-down button is shown to the right of the inputs.Default:
true
-
withButtonVisible
IDaterangebox withButtonVisible(boolean buttonVisible)
Returns a copy ofthisimmutable component with the specifiedbuttonVisible.Sets whether the calendar drop-down button is shown.
- Parameters:
buttonVisible-falseto hide the button.Default:
true.- Returns:
- A modified copy of the
thisobject
-
isWeekOfYear
default boolean isWeekOfYear()
Returns whether the week-of-year column is shown in the calendar panels.Default:
false
-
withWeekOfYear
IDaterangebox withWeekOfYear(boolean weekOfYear)
Returns a copy ofthisimmutable component with the specifiedweekOfYear.Sets whether the week-of-year column is shown in the calendar panels.
- Parameters:
weekOfYear-trueto show the week-of-year column.Default:
false.- Returns:
- A modified copy of the
thisobject
-
isShowTodayLink
default boolean isShowTodayLink()
Returns whether the "Today" shortcut link is shown in the day view.Default:
false
-
withShowTodayLink
IDaterangebox withShowTodayLink(boolean showTodayLink)
Returns a copy ofthisimmutable component with the specifiedshowTodayLink.Sets whether the "Today" shortcut link is shown in the day view.
- Parameters:
showTodayLink-trueto show the "Today" link.Default:
false.- Returns:
- A modified copy of the
thisobject
-
getTodayLinkLabel
@Nullable default java.lang.String getTodayLinkLabel()
Returns the label of the "Today" shortcut shown in the popup footer.Default: the localized
MZul.CALENDAR_TODAY("Today" in English)
-
withTodayLinkLabel
IDaterangebox withTodayLinkLabel(@Nullable java.lang.String todayLinkLabel)
Returns a copy ofthisimmutable component with the specifiedtodayLinkLabel.Sets the label of the "Today" shortcut shown in the popup footer.
- Parameters:
todayLinkLabel- The label of the link to jump to today, ornull—Daterangebox.setTodayLinkLabel(String)accepts a null and the C2I conversion has to be able to carry it back.Default:
"Today".- Returns:
- A modified copy of the
thisobject
-
getAutocomplete
default java.lang.String getAutocomplete()
Returns the HTMLautocompletetoken applied to both range inputs.Default:
"off"
-
withAutocomplete
IDaterangebox withAutocomplete(java.lang.String autocomplete)
Returns a copy ofthisimmutable component with the specifiedautocomplete.Sets the HTML
autocompletetoken applied to both range inputs. Required for WCAG 1.3.5 (Identify Input Purpose) when the inputs collect information about the user — e.g."bday".- Parameters:
autocomplete- The autofill detail token.Default:
"off".- Returns:
- A modified copy of the
thisobject
-
isLenient
default boolean isLenient()
Returns whether date parsing is lenient. With lenient parsing, inputs that do not exactly match the format may be interpreted heuristically.Default:
true
-
withLenient
IDaterangebox withLenient(boolean lenient)
Returns a copy ofthisimmutable component with the specifiedlenient.Sets whether date parsing is lenient.
- Parameters:
lenient-falseto require inputs to match the format exactly.Default:
true.- Returns:
- A modified copy of the
thisobject
-
isStrictDate
default boolean isStrictDate()
Returns whether strict date validation is enabled, rejecting impossible dates such as"Nov 31".Default:
false
-
withStrictDate
IDaterangebox withStrictDate(boolean strictDate)
Returns a copy ofthisimmutable component with the specifiedstrictDate.Sets whether strict date validation is enabled.
- Parameters:
strictDate-trueto refuse dates like"Jan 0".Default:
false.- Returns:
- A modified copy of the
thisobject
-
getSeparator
default java.lang.String getSeparator()
Returns the separator rendered between the two date inputs.Default: the library property
org.zkoss.zul.daterangebox.separator("~"if unset)
-
withSeparator
IDaterangebox withSeparator(java.lang.String separator)
Returns a copy ofthisimmutable component with the specifiedseparator.Sets the separator string rendered between the two date inputs.
Note: unlike
Daterangebox.setSeparator(String),nullis not accepted here. To fall back togetSeparator()'s default chain, build a fresh instance without setting a separator.- Parameters:
separator- The separator string.Default:
"~".- Returns:
- A modified copy of the
thisobject
-
getPlaceholder
@Nullable java.lang.String getPlaceholder()
Returns the placeholder applied to both inputs when no per-input placeholder is set, ornullif none.Default:
null
-
withPlaceholder
IDaterangebox withPlaceholder(@Nullable java.lang.String placeholder)
Returns a copy ofthisimmutable component with the specifiedplaceholder.Sets the placeholder shown in both inputs when empty.
- Parameters:
placeholder- The placeholder text, ornullto clear.Default:
null.- Returns:
- A modified copy of the
thisobject
-
getBeginPlaceholder
@Nullable java.lang.String getBeginPlaceholder()
Returns the placeholder for the begin input, ornullif none.Default:
null
-
withBeginPlaceholder
IDaterangebox withBeginPlaceholder(@Nullable java.lang.String beginPlaceholder)
Returns a copy ofthisimmutable component with the specifiedbeginPlaceholder.Sets the placeholder shown in the begin input when empty.
- Parameters:
beginPlaceholder- The placeholder text, ornullto clear.Default:
null.- Returns:
- A modified copy of the
thisobject
-
getEndPlaceholder
@Nullable java.lang.String getEndPlaceholder()
Returns the placeholder for the end input, ornullif none.Default:
null
-
withEndPlaceholder
IDaterangebox withEndPlaceholder(@Nullable java.lang.String endPlaceholder)
Returns a copy ofthisimmutable component with the specifiedendPlaceholder.Sets the placeholder shown in the end input when empty.
- Parameters:
endPlaceholder- The placeholder text, ornullto clear.Default:
null.- Returns:
- A modified copy of the
thisobject
-
isHoverPreview
default boolean isHoverPreview()
Returns whether hovering a candidate end date previews the range in the calendar.Default: the library property
org.zkoss.zul.daterangebox.hoverPreview(trueif unset)
-
withHoverPreview
IDaterangebox withHoverPreview(boolean hoverPreview)
Returns a copy ofthisimmutable component with the specifiedhoverPreview.Sets whether hovering a candidate end date previews the range.
- Parameters:
hoverPreview-falseto disable the hover preview.Default:
true.- Returns:
- A modified copy of the
thisobject
-
of
static IDaterangebox of(org.zkoss.zul.DateRange value)
Returns the instance with the given range.- Parameters:
value- The initial range
-
of
static IDaterangebox of(@Nullable java.util.Date beginValue, @Nullable java.util.Date endValue)
Returns the instance with the given endpoints.- Parameters:
beginValue- The begin date, ornullendValue- The end date, ornull
-
ofFormat
static IDaterangebox ofFormat(java.lang.String format)
Returns the instance with the given format.- Parameters:
format- The daterangebox format
-
ofConstraint
static IDaterangebox ofConstraint(java.lang.String constraint)
Returns the instance with the given constraint.- Parameters:
constraint- The daterangebox constraint
-
ofId
static IDaterangebox ofId(java.lang.String id)
Returns the instance with the given id.- Parameters:
id- The id to identify this component
-
-