# Architecture > Technology stack and module structure for the FullCalendar Flow addon. `pom.xml` is the source of truth for versions. Do not modify `pom.xml` without asking. --- ## 1. Technology Stack - **Java 21** — minimum language level - **Vaadin 25.x** — Flow component framework (BOM-managed) - **FullCalendar JS 7.1.x** — client-side calendar library (`fullcalendar`, `fullcalendar-scheduler`, bundled via `@NpmPackage`) - **Jackson 3** (`tools.jackson`) — JSON serialization for client-server data exchange - **Lombok** — boilerplate reduction (`@Getter`, `@Setter`, `@EqualsAndHashCode`, etc.) - **Apache Commons Text** — string utilities (camelCase conversion for option names) - **Maven** — multi-module build (wrapper available in `demo/`) - **JUnit 5 + Mockito** — unit testing - **Playwright** — E2E testing (separate npm project in `e2e-tests/`) --- ## 2. Module Structure ``` fullcalendar-parent (pom, root) ├── addon/ # Core component — org.vaadin.stefan:fullcalendar2 ├── addon-scheduler/ # Scheduler extension — org.vaadin.stefan:fullcalendar2-scheduler ├── demo/ # Spring Boot 4.x demo application ├── e2e-test-app/ # Vaadin Spring Boot app serving Playwright test views ├── e2e-tests/ # Playwright test suite (npm, NOT a Maven module) └── fc-docs/ # Local copies of the FullCalendar JS v6 and v7 docs (reference) ``` ### addon/ (core) The main Vaadin component. Custom element tag: ``. ``` org.vaadin.stefan.fullcalendar/ FullCalendar.java — Main component (extends Component, @JsModule, @NpmPackage) Entry.java — Calendar entry model (title, start/end, color, recurrence, etc.) FullCalendarOptions.java — User entry point for the options, `calendar.options()`; typed fields plus raw options FullCalendarViewOptions.java — Options of one view type, `calendar.options().view(view)` CalendarOptions.java, ViewOptions.java — Package-private data classes that hold the typed option fields dataprovider/ EntryProvider.java — Interface for providing entries to the calendar InMemoryEntryProvider.java — Entries in a server-side collection, like ListDataProvider CallbackEntryProvider.java — Lazy loading (entries fetched per visible date range) converters/ — Java ↔ JS type converters (Duration, DayOfWeek, RRule, etc.) json/ — Custom annotations (@JsonName, @JsonConverter, @JsonIgnore) model/ — Header/Footer toolbar models ``` Frontend (TypeScript): `addon/src/main/resources/META-INF/frontend/vaadin-full-calendar/full-calendar.ts` ### addon-scheduler/ (scheduler extension) Extends the base calendar with resource management. Custom element tag: ``. ``` org.vaadin.stefan.fullcalendar/ FullCalendarScheduler.java — Extends FullCalendar, implements Scheduler Scheduler.java — Interface for resource management FullCalendarSchedulerOptions.java, FullCalendarSchedulerViewOptions.java — Options entry points of the scheduler SchedulerCalendarOptions.java, SchedulerViewOptions.java — Package-private data classes with the scheduler option fields Resource.java — Resource model (hierarchical, per-resource styling) ResourceEntry.java — Entry subclass with resource assignments SchedulerView.java — Scheduler view enum (timeline, resource-timeline, resource-timegrid) option/ ResourceColumn.java — Column definitions for resource columns ComponentResourceColumn.java — Resource columns that render a Vaadin component per resource EntryPrintLayout.java — Value of the entry print layout option ``` --- ## 3. Client-Server Communication The addon uses Vaadin's built-in Element API for bidirectional communication: - **Java → JS**: `getElement().callJsFunction(name, args)` for imperative calls; `getElement().setPropertyJson(name, json)` for option/state sync - **JS → Java**: `@DomEvent` annotations on event classes trigger server-side `ComponentEvent` subclasses - **Entry sync**: Entries are serialized to JSON via `Entry.toJson()` using reflection-based `BeanProperties` + custom `@JsonConverter` annotations, then sent to the client as batched updates. **Important**: Setting entry properties (e.g., `entry.setTitle("new")`) does NOT auto-push to the client. You must call `provider.refreshItem(entry)` or `provider.refreshAll()` to sync changes. This is unlike `Resource`, where `setTitle()` and `setColor()` auto-push. - **Option system**: `calendar.options()` returns the live options object. A setter such as `setSlotDuration(...)` writes a typed field and schedules a sync. Before the response, the changed options are sent to the client in one `callJsFunction("setOptions", changes)` call (before the first attach, via the element property `initialOptions`). Field names follow the FullCalendar option name, with "event" replaced by "entry" (`eventColor` becomes `entryColor`). Options without a field are set with `options().setRawOption(name, value)`. The options of one view type are set with `options().view(view)`. --- ## 4. Testing ### Unit Tests (JUnit 5 + Mockito) - Located in `addon/src/test/java/` and `addon-scheduler/src/test/java/` - Test entry model, JSON serialization, converters, options, builder, data providers - Run: `mvn test` (all modules) or `mvn test -pl addon -Dtest=EntryTest` (single class) ### E2E Tests (Playwright) - **Test app**: `e2e-test-app/` — Spring Boot Vaadin app with test views - **Test suite**: `e2e-tests/tests/*.spec.js` — Playwright specs - **Run**: `cd e2e-test-app && mvn clean verify -Pit` (starts app + runs Playwright) - Tests cover: views, toolbar, entry interactions, drag-and-drop, responsiveness, accessibility, scheduler features, event sources, etc. ### Visual Verification (Playwright MCP) - During development, use the Playwright MCP server to visually verify changes - Default resolution: 1920x1080 - See [`verification.md`](verification.md) for the process --- ## 5. Key Design Decisions 1. **Light DOM** — FullCalendar manages its own DOM; shadow DOM would break FullCalendar's style injection and DOM queries. The component uses light DOM for full compatibility. 2. **Option fields on one options object** — The FullCalendar options are typed fields of the data classes behind `calendar.options()`, not individual methods on the component. This keeps the component's API surface small. Adding an option means adding a field to the data class. 3. **Reflection-based JSON** — `BeanProperties` uses reflection + annotation caching to serialize `Entry` fields to JSON. This allows subclasses (like `ResourceEntry`) to add fields without modifying serialization code. 4. **Entry ≠ Event** — FullCalendar JS calls them "events"; this addon calls them **"entries"** to avoid collision with Vaadin's component event system. This applies to both class names (`Entry`, `ResourceEntry`) and option field names (`entryColor`). See also `README.md` Naming Convention section.