EN · DE · RU · FR · ES

#2779: Config.java

projectforge-wicket/src/main/java/net/ftlines/wicket/fullcalendar/Config.java Java Configuration Model (FullCalendar) · projectforge-wicket/src/main/java/net/ftlines/wicket/fullcalendar/Config.java 428 lines · 267 code · 79 comments · 82 blank
The comprehensive configuration model for the Wicket FullCalendar component — the single object that captures all calendar settings and is serialized to JSON for the client-side FullCalendar initialization call. This class models every configurable aspect of the calendar widget: event sources, header layout, button text labels, callback scripts (for drop, resize, click, render, select, view display events), time display settings, column format strings, and interaction flags (editable, selectable, draggable, resizable). Jackson annotations control the JSON serialization: @JsonRawValue prevents double-escaping of JavaScript callback text, @JsonIgnore hides internal Wicket models from serialization, and @JsonProperty controls field naming.

Architecture

Callback Script Management

Seven callback models use IModel<String> — Wicket's model abstraction for dynamic values. Each callback getter is annotated with @JsonRawValue, which tells Jackson to insert the model's string content directly into the JSON output without quoting. This is critical because the callback strings are JavaScript function bodies (e.g., function(event, delta, revertFunc) { ... }) and must appear as raw code in the FullCalendar initialization, not as double-quoted strings. The setter methods provide convenience (setEventDrop(String) wraps in Model.of()) and advanced (setEventDropModel(IModel) for dynamic models).

Wicket Model Integration

The use of IModel for callback scripts enables dynamic script generation — critical because these scripts contain Wicket Ajax callback URLs that change between requests (due to anti-cache tokens and page versioning). The setupCallbacks() method in FullCalendar.java populates these models with generated script text, and Wicket's model resolution mechanism ensures fresh values on each render.

Time Configuration

Uses Joda-Time types (LocalTime for minTime/maxTime) that are serialized via the custom serializers in AbstractFullCalendar. The ColumnFormat enum maps to FullCalendar's column header format options for day, week, and month views.

Fluent Builder

The add(EventSource) method returns this, supporting chained configuration. Multiple event sources can be added fluently: new Config().add(holidaysSource).add(meetingsSource).

Git History

CommitWhat changed
868d6abb7 through ceb63e8a1Six annual copyright header updates. The configuration model has been stable — all FullCalendar settings needed by the application are captured in this class, and no new configuration options have been required beyond the initial design.