Class CalendarEvent
events.
Bean-only (juneau-console-widgets): the emitter and runtime live in juneau-console-views.
Titles, tooltips, and labels are painted with textContent by the runtime, never as markup.
end is layout-significant, with split inclusivity:
- All-day (date-only
end): inclusive.start=2026-03-02,end=2026-03-04occupies three day cells. - Timed (date-time
end): exclusive.start=…T09:00,end=…T10:00occupies[09:00, 10:00)— the start day only. A timed event crossing midnight is a spanning bar using the exclusiveend, never intra-day chips on each crossed day. - Omitted
end: start-only, and valid. An all-day event occupies the start day cell; a timed event occupies the start instant as a zero-width chip on the start day (never a spanning bar). - An all-day
endequal tostartis a single-day event; a timedendequal tostartis zero-duration and is rejected, as is anyendbeforestart.
All-day agreement and the malformed set:
Agreement between allDay and the shape of end is decided by effectiveAllDay(), never by
the raw allDay field, so a allDay paired with matching start/end
shapes stays valid. An event is malformed for exactly these reasons — and no others:
- a missing/blank
id,title, orstart; - an unparseable
start/endcivil date, or anendthat is not after (all-day: not on or after)start; - a declared
allDay/enddisagreement —allDay ==true with a date-timeend, orallDay ==false with a date-onlyend; - mixed
start/endshapes with anull allDay.
A malformed event is dropped by CalendarDef.validate() and by a per-month GET handler that filters
through retainWellFormed(Collection) — the same rule on both paths. Neither fails the whole
definition nor the whole month payload. An omitted end is not malformed.
Timezone contract:
start/end are interpreted as an ISO-8601 local date (yyyy-MM-dd) or local date-time
(yyyy-MM-ddTHH:mm). A trailing offset or Z is fail-soft ignored, never rejected — a
seeded 2026-03-02T09:00:00Z keeps validating and keeps rendering at 09:00 in the server's injected clock
zone. The same parse applies on the seed path and on the per-month GET path.
- Since:
- 10.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionOptional category id; must reference a declaredEventCategoryfor a seed event; unknown wire ids paintNEUTRAL.Optional ISO-8601 date/date-time bound.Optional same-origin document URL (SafePathTemplate.isSafeDocumentUrl(String)semantics).Stable id; required, non-blank.Required ISO-8601 date (yyyy-MM-dd) or date-time; the civil date drives chip placement.Required, non-blank display title; painted withtextContent.Optional tooltip; painted withtextContent. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionallDay(boolean value) Sets the all-day flag.categoryId(String value) Sets the category id.civilEnd()The civil date ofend, ornull whenendis omitted.The civil date the chip paints on — theyyyy-MM-ddprefix ofstart(a date-timestartis coerced to its leading civil date; a trailing offset is ignored).static CalendarEventcreate()Creates an empty event.booleanThe effective all-day flag: the declaredallDaywhen set, otherwisetrue whenstartis a date with no time component.Sets the optional ISO-8601 end.Sets the same-origin document href.Sets the stable id.lastDay()The last day cell this event occupies, applying the split inclusivity rule (see the class javadoc).The reason this event is malformed, ornull when it is well-formed.static List<CalendarEvent>retainWellFormed(Collection<CalendarEvent> values) Returns the well-formed events of the given collection, dropping the malformed ones and continuing.booleanspanning()Whether this event covers more than one day cell and therefore renders as a spanning bar rather than a chip.Sets the ISO-8601 start.The leadingHH:mmtime label a timed chip renders, ornull for an all-day event or an unparseable time.Sets the display title.Sets the tooltip.voidFail-closed shape check for a seed event, reused byCalendarDef.validate()and by an endpoint handler that wants to validate its own payload before serialization.
-
Field Details
-
id
Stable id; required, non-blank. Used for de-duplication and coalesce keys. -
title
Required, non-blank display title; painted withtextContent. -
start
Required ISO-8601 date (yyyy-MM-dd) or date-time; the civil date drives chip placement. -
end
Optional ISO-8601 date/date-time bound. Layout-significant: inclusive for an all-day (date-only) value, exclusive for a timed (date-time) value. Omitting it is valid and means start-only. -
allDay
-
categoryId
Optional category id; must reference a declaredEventCategoryfor a seed event; unknown wire ids paintNEUTRAL. -
href
Optional same-origin document URL (SafePathTemplate.isSafeDocumentUrl(String)semantics). -
tooltip
Optional tooltip; painted withtextContent.
-
-
Constructor Details
-
CalendarEvent
public CalendarEvent()
-
-
Method Details
-
create
Creates an empty event.- Returns:
- A new
CalendarEvent.
-
id
Sets the stable id.- Parameters:
value- The id. Must not benull or blank.- Returns:
- This object.
-
title
Sets the display title.- Parameters:
value- The title. Must not benull or blank.- Returns:
- This object.
-
start
Sets the ISO-8601 start.- Parameters:
value- Ayyyy-MM-dddate or ISO date-time. Must not benull .- Returns:
- This object.
-
end
Sets the optional ISO-8601 end.- Parameters:
value- Ayyyy-MM-dddate or ISO date-time; must be>= startwhen present.- Returns:
- This object.
-
allDay
Sets the all-day flag.- Parameters:
value- The all-day flag.- Returns:
- This object.
-
categoryId
Sets the category id.- Parameters:
value- The category id.- Returns:
- This object.
-
href
Sets the same-origin document href.- Parameters:
value- The href.- Returns:
- This object.
-
tooltip
Sets the tooltip.- Parameters:
value- The tooltip.- Returns:
- This object.
-
effectiveAllDay
The effective all-day flag: the declaredallDaywhen set, otherwisetrue whenstartis a date with no time component.- Returns:
- The effective all-day flag.
-
civilStart
The civil date the chip paints on — theyyyy-MM-ddprefix ofstart(a date-timestartis coerced to its leading civil date; a trailing offset is ignored).- Returns:
- The civil start date.
- Throws:
IllegalArgumentException- Ifstartis null or not a parseable ISO date/date-time.
-
civilEnd
The civil date ofend, ornull whenendis omitted.This is the raw civil date of the bound, before inclusivity is applied — use
lastDay()for the last day cell the event actually occupies.- Returns:
- The civil end date, or
null whenendis omitted or blank. - Throws:
IllegalArgumentException- Ifendis present but not a parseable ISO date/date-time.
-
lastDay
The last day cell this event occupies, applying the split inclusivity rule (see the class javadoc).Equals
civilStart()whenendis omitted. For an all-day event the date-onlyendis inclusive; for a timed event the date-timeendis exclusive, so an end of exactly midnight lands on the previous day. Never earlier thancivilStart().- Returns:
- The inclusive last occupied day.
- Throws:
IllegalArgumentException- Ifstart/endare not parseable.
-
spanning
Whether this event covers more than one day cell and therefore renders as a spanning bar rather than a chip.- Returns:
true iflastDay()is aftercivilStart().- Throws:
IllegalArgumentException- Ifstart/endare not parseable.
-
startTimeLabel
The leadingHH:mmtime label a timed chip renders, ornull for an all-day event or an unparseable time.- Returns:
- The
HH:mmlabel, ornull .
-
malformedReason
The reason this event is malformed, ornull when it is well-formed.This is the single drop predicate shared by
CalendarDef.validate()(the seed path) and byretainWellFormed(Collection)(the per-month GET path); see the class javadoc for the complete, closed list of malformed reasons. It is a pure shape check: an unknowncategoryId, an unsafehref, and an off-monthstartare author errors reported byvalidate(Set,Integer,Integer), not drop reasons.- Returns:
- A human-readable reason, or
null when this event is well-formed.
-
retainWellFormed
Returns the well-formed events of the given collection, dropping the malformed ones and continuing.A per-month GET handler filters its payload through this before serialization so the dynamic path drops exactly what
CalendarDef.validate()drops on the seed path. Anull element is dropped too.- Parameters:
values- The events to filter. May benull .- Returns:
- A new mutable list of the well-formed events, in the original order. Never
null .
-
validate
Fail-closed shape check for a seed event, reused byCalendarDef.validate()and by an endpoint handler that wants to validate its own payload before serialization.Throws for a malformed event (see
malformedReason()) and for the author errors a seed definition must not contain: an undeclaredcategoryId, a cross-originhref, and astartoutside the rendered window. Callers that want the drop-and-continue posture of the seed and per-month GET paths usemalformedReason()/retainWellFormed(Collection)instead.- Parameters:
knownCategoryIds- The declared category ids; a setcategoryIdmust be a member. May benull (then anycategoryIdfails).initialYear- The initial year the seed month is rendered for, ornull to skip the off-month check.initialMonth- The 1-based initial month, ornull to skip the off-month check.- Throws:
IllegalArgumentException- If this event is not well-formed.
-