You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@causeway.apache.org by da...@apache.org on 2026/08/25 14:10:36 UTC
(causeway) branch maintenance-branch updated (16833838789 -> d03e1269e20)
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a change to branch maintenance-branch
in repository https://gitbox.apache.org/repos/asf/causeway.git
from 16833838789 Merge pull request #3678 from apache/CAUSEWAY-4042
new 2eaee34ec10 maintenance-branch: archives isolate mixin domain events
new 31b5802d902 maintenance-branch: proposes Wicket MOTD banner
new d03e1269e20 maintenance-branch: adds Wicket MOTD banner
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
api/applib/src/main/java/module-info.java | 1 +
.../applib/services/motd/MessageOfTheDay.java | 88 +++++++++++++
.../MessageOfTheDayProvider.java} | 13 +-
.../{layout => services/motd}/package-info.java | 11 +-
.../applib/services/motd/MessageOfTheDayTest.java | 73 +++++++++++
.../pages/sections/causeway.viewer.wicket.adoc | 4 +-
.../core/config/CausewayConfiguration.java | 2 +-
.../.openspec.yaml | 2 +-
openspec/changes/add-wicket-motd-banner/design.md | 87 +++++++++++++
.../changes/add-wicket-motd-banner/proposal.md | 29 +++++
.../specs/wicket-footer-motd/spec.md | 97 ++++++++++++++
openspec/changes/add-wicket-motd-banner/tasks.md | 23 ++++
.../.openspec.yaml | 0
.../design.md | 0
.../proposal.md | 0
.../parented-collection-selector-actions/spec.md | 0
.../tasks.md | 0
.../parented-collection-selector-actions/spec.md | 54 ++++++++
.../footer/MessageOfTheDayPanelTest.java | 110 ++++++++++++++++
.../wicket/ui/components/footer/FooterPanel.html | 4 +-
.../wicket/ui/components/footer/FooterPanel.java | 6 +
.../MessageOfTheDayPanel.css} | 17 ++-
.../MessageOfTheDayPanel.html} | 21 +--
.../ui/components/footer/MessageOfTheDayPanel.java | 142 +++++++++++++++++++++
24 files changed, 755 insertions(+), 29 deletions(-)
create mode 100644 api/applib/src/main/java/org/apache/causeway/applib/services/motd/MessageOfTheDay.java
copy api/applib/src/main/java/org/apache/causeway/applib/services/{sitemap/SitemapService.java => motd/MessageOfTheDayProvider.java} (71%)
copy api/applib/src/main/java/org/apache/causeway/applib/{layout => services/motd}/package-info.java (59%)
create mode 100644 api/applib/src/test/java/org/apache/causeway/applib/services/motd/MessageOfTheDayTest.java
copy openspec/changes/{archive/2026-06-04-configure-replay-result-conflict-handling => add-wicket-motd-banner}/.openspec.yaml (50%)
create mode 100644 openspec/changes/add-wicket-motd-banner/design.md
create mode 100644 openspec/changes/add-wicket-motd-banner/proposal.md
create mode 100644 openspec/changes/add-wicket-motd-banner/specs/wicket-footer-motd/spec.md
create mode 100644 openspec/changes/add-wicket-motd-banner/tasks.md
rename openspec/changes/{isolate-mixin-domain-events => archive/2026-08-25-isolate-mixin-domain-events}/.openspec.yaml (100%)
rename openspec/changes/{isolate-mixin-domain-events => archive/2026-08-25-isolate-mixin-domain-events}/design.md (100%)
rename openspec/changes/{isolate-mixin-domain-events => archive/2026-08-25-isolate-mixin-domain-events}/proposal.md (100%)
rename openspec/changes/{isolate-mixin-domain-events => archive/2026-08-25-isolate-mixin-domain-events}/specs/parented-collection-selector-actions/spec.md (100%)
rename openspec/changes/{isolate-mixin-domain-events => archive/2026-08-25-isolate-mixin-domain-events}/tasks.md (100%)
create mode 100644 viewers/wicket/ui-test/src/test/java/org/apache/causeway/viewer/wicket/ui/components/footer/MessageOfTheDayPanelTest.java
copy viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/{widgets/entitysimplelink/EntityLinkSimplePanel.css => footer/MessageOfTheDayPanel.css} (80%)
copy viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/{widgets/zclip/ZeroClipboardPanel.html => footer/MessageOfTheDayPanel.html} (76%)
create mode 100644 viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/footer/MessageOfTheDayPanel.java
(causeway) 01/03: maintenance-branch: archives isolate mixin domain events
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a commit to branch maintenance-branch
in repository https://gitbox.apache.org/repos/asf/causeway.git
commit 2eaee34ec10ba79cf66853933fe320ebc514b91e
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Tue Aug 25 14:54:12 2026 +0100
maintenance-branch: archives isolate mixin domain events
---
.../.openspec.yaml | 0
.../design.md | 0
.../proposal.md | 0
.../parented-collection-selector-actions/spec.md | 0
.../tasks.md | 0
.../parented-collection-selector-actions/spec.md | 54 ++++++++++++++++++++++
6 files changed, 54 insertions(+)
diff --git a/openspec/changes/isolate-mixin-domain-events/.openspec.yaml b/openspec/changes/archive/2026-08-25-isolate-mixin-domain-events/.openspec.yaml
similarity index 100%
rename from openspec/changes/isolate-mixin-domain-events/.openspec.yaml
rename to openspec/changes/archive/2026-08-25-isolate-mixin-domain-events/.openspec.yaml
diff --git a/openspec/changes/isolate-mixin-domain-events/design.md b/openspec/changes/archive/2026-08-25-isolate-mixin-domain-events/design.md
similarity index 100%
rename from openspec/changes/isolate-mixin-domain-events/design.md
rename to openspec/changes/archive/2026-08-25-isolate-mixin-domain-events/design.md
diff --git a/openspec/changes/isolate-mixin-domain-events/proposal.md b/openspec/changes/archive/2026-08-25-isolate-mixin-domain-events/proposal.md
similarity index 100%
rename from openspec/changes/isolate-mixin-domain-events/proposal.md
rename to openspec/changes/archive/2026-08-25-isolate-mixin-domain-events/proposal.md
diff --git a/openspec/changes/isolate-mixin-domain-events/specs/parented-collection-selector-actions/spec.md b/openspec/changes/archive/2026-08-25-isolate-mixin-domain-events/specs/parented-collection-selector-actions/spec.md
similarity index 100%
rename from openspec/changes/isolate-mixin-domain-events/specs/parented-collection-selector-actions/spec.md
rename to openspec/changes/archive/2026-08-25-isolate-mixin-domain-events/specs/parented-collection-selector-actions/spec.md
diff --git a/openspec/changes/isolate-mixin-domain-events/tasks.md b/openspec/changes/archive/2026-08-25-isolate-mixin-domain-events/tasks.md
similarity index 100%
rename from openspec/changes/isolate-mixin-domain-events/tasks.md
rename to openspec/changes/archive/2026-08-25-isolate-mixin-domain-events/tasks.md
diff --git a/openspec/specs/parented-collection-selector-actions/spec.md b/openspec/specs/parented-collection-selector-actions/spec.md
index 3f59d05c457..0876a1c8993 100644
--- a/openspec/specs/parented-collection-selector-actions/spec.md
+++ b/openspec/specs/parented-collection-selector-actions/spec.md
@@ -494,3 +494,57 @@ The synthetic selector action MUST NOT fall back to child property declaration o
- **WHEN** the framework synthesizes the selector action for `Lease.items`
- **THEN** the generated filter parameters appear in the order `name`, `checkbox`, and `sequence`
+### Requirement: Synthetic navigation post-processing isolates mixed-in domain-event facets
+
+When command-log recording support synthesizes navigation actions for parented collections or scalar references, the post-processing sweep SHALL keep generated navigation actions domain-event neutral.
+Generated navigation actions MUST NOT expose an owner type's action domain-event default.
+Generated navigation actions MUST retain their safe semantics and command publishing metadata when recording support is enabled.
+Synthetic navigation action synthesis MUST NOT install or update action domain-event facets on unrelated pre-existing mixed-in actions.
+Synthetic navigation action synthesis MUST NOT cause a mixee-specific action domain-event type discovered while processing one domain type to appear on a non-navigation action contributed to another domain type.
+When a mixed-in action's effective action domain-event type depends on the current mixee type, the system SHALL keep that effective event type isolated to the mixed-in member for that mixee.
+The system MUST NOT mutate the shared mixin method's action domain-event facet with a concrete mixee's type-level domain-event default.
+
+#### Scenario: Parented collection navigation action is domain-event neutral
+
+- **GIVEN** an entity type has a parented collection of child entities
+- **AND** command-log recording support is `ENABLED`
+- **AND** the entity type declares a type-level action domain-event default
+- **WHEN** the framework synthesizes the parented collection navigation action
+- **THEN** the generated navigation action does not expose the entity type's action domain-event default
+- **AND** the generated navigation action remains safe and command-published for recording support
+
+#### Scenario: Scalar reference navigation action is domain-event neutral
+
+- **GIVEN** an entity type has a scalar reference to another entity
+- **AND** command-log recording support is `ENABLED`
+- **AND** the entity type declares a type-level action domain-event default
+- **WHEN** the framework synthesizes the scalar reference navigation action
+- **THEN** the generated navigation action does not expose the entity type's action domain-event default
+- **AND** the generated navigation action remains safe and command-published for recording support
+
+#### Scenario: Generic mixed-in action keeps mixee-specific event type isolated
+
+- **GIVEN** command-log recording support is `ENABLED`
+- **AND** a generic mixed-in action is contributed to two unrelated domain types
+- **AND** only the first domain type declares a type-level action domain-event default
+- **WHEN** the framework runs metamodel post-processing for both domain types
+- **THEN** the mixed-in action on the first domain type may use that first domain type's action domain-event default
+- **AND** the mixed-in action on the second domain type does not expose the first domain type's action domain-event default
+
+#### Scenario: Navigation synthesis does not contaminate unrelated generic mixins
+
+- **GIVEN** command-log recording support is `ENABLED`
+- **AND** one domain type declares a type-level action domain-event default
+- **AND** an unrelated generic mixed-in action is contributed to multiple domain types
+- **WHEN** the framework synthesizes generated navigation actions for eligible one-to-many collection associations and one-to-one reference associations
+- **THEN** the unrelated generic mixed-in action does not receive an action domain-event facet whose event type came from a different mixee type
+- **AND** generated navigation actions are still available for eligible one-to-many collection associations and one-to-one reference associations
+
+#### Scenario: Application-authored explicit mixed-in domain-event semantics are preserved
+
+- **GIVEN** an application-authored mixed-in action explicitly declares an action domain-event type
+- **AND** command-log recording support is `ENABLED`
+- **WHEN** the framework runs synthetic navigation action post-processing
+- **THEN** synthetic navigation action processing does not replace the application-authored mixed-in action's explicit domain-event type
+- **AND** synthetic navigation action processing does not add a navigation-specific domain-event marker to the application-authored mixed-in action
+
(causeway) 02/03: maintenance-branch: proposes Wicket MOTD banner
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a commit to branch maintenance-branch
in repository https://gitbox.apache.org/repos/asf/causeway.git
commit 31b5802d902db9209d594b1a774b377e55a82fd3
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Tue Aug 25 14:30:23 2026 +0100
maintenance-branch: proposes Wicket MOTD banner
---
.../changes/add-wicket-motd-banner/.openspec.yaml | 2 +
openspec/changes/add-wicket-motd-banner/design.md | 87 +++++++++++++++++++
.../changes/add-wicket-motd-banner/proposal.md | 29 +++++++
.../specs/wicket-footer-motd/spec.md | 97 ++++++++++++++++++++++
openspec/changes/add-wicket-motd-banner/tasks.md | 23 +++++
5 files changed, 238 insertions(+)
diff --git a/openspec/changes/add-wicket-motd-banner/.openspec.yaml b/openspec/changes/add-wicket-motd-banner/.openspec.yaml
new file mode 100644
index 00000000000..e685d45e5ff
--- /dev/null
+++ b/openspec/changes/add-wicket-motd-banner/.openspec.yaml
@@ -0,0 +1,2 @@
+schema: spec-driven
+created: 2026-08-25
diff --git a/openspec/changes/add-wicket-motd-banner/design.md b/openspec/changes/add-wicket-motd-banner/design.md
new file mode 100644
index 00000000000..0cdb913230e
--- /dev/null
+++ b/openspec/changes/add-wicket-motd-banner/design.md
@@ -0,0 +1,87 @@
+## Context
+
+The Wicket viewer footer currently renders a Select2 breadcrumb/history dropdown when `causeway.viewer.wicket.bookmarked-pages.show-drop-down-on-footer` is enabled, and that property currently defaults to `true`.
+Applications have no viewer-neutral SPI for supplying a scheduled operational notice.
+The footer is a stateful Wicket component, so a notice can become active or inactive after a page instance has been initialized.
+The repository targets Java 11 and already exposes `Instant`, `Duration`, `ClockService`, service-registry lookup, trusted HTML rendering, and a reusable Bootstrap modal dialog without requiring another dependency.
+
+## Goals / Non-Goals
+
+**Goals:**
+
+- Define a viewer-neutral applib SPI for supplying zero or one message of the day.
+- Encapsulate the message title, trusted HTML detail, display start, positive display duration, derived display end, and active-time test in an immutable applib value.
+- Render an active message as a compact, clickable title in the Wicket footer and show its detail in a modal dialog.
+- Re-evaluate the provider and current time on page render so a reused Wicket page reflects scheduling and content changes.
+- Keep the footer history dropdown available while making it hidden by default.
+
+**Non-Goals:**
+
+- Supporting multiple simultaneous messages, ordering, or conflict resolution.
+- Polling, server-sent events, or other live appearance while the browser remains idle.
+- Per-user dismissal, acknowledgement, severity levels, or audience targeting.
+- Sanitizing application-provided HTML.
+- Changing the existing rules that show or suppress the footer itself.
+
+## Decisions
+
+### Define the SPI in regular applib
+
+Add a `MessageOfTheDayProvider` service contract and an immutable `MessageOfTheDay` value under a dedicated applib service package.
+The provider returns an `Optional<MessageOfTheDay>`, allowing the service to be absent or to report no candidate without requiring a framework default implementation.
+The Wicket viewer resolves the provider through the service registry so applications that do not implement the SPI retain an empty footer notice area.
+This location keeps the contract independent of Wicket and permits another viewer to consume it later.
+A Wicket-specific SPI was rejected because the supplied data and schedule are not inherently Wicket concepts.
+
+### Model scheduling with an instant and duration
+
+The value stores `displayFrom` as an `Instant` and `displayDuration` as a strictly positive `Duration`.
+It derives `displayUntil` as `displayFrom.plus(displayDuration)` and defines activity using the half-open interval `displayFrom <= now < displayUntil`.
+The value owns this logic so consumers do not reproduce boundary semantics.
+A pair of start and end instants was rejected in favor of the duration-based contract requested for convenient construction with `Duration.ofHours`, `Duration.ofMinutes`, and related factories.
+A third-party interval type was rejected to avoid another public API dependency.
+
+### Treat the title as text and the detail as trusted HTML
+
+The title is escaped and rendered as the compact clickable content in the footer.
+The detail is a plainly named HTML string that the dialog renders without escaping or sanitizing.
+The API documentation will identify the detail as trusted application content because rendering untrusted input would create a cross-site-scripting vulnerability.
+Causeway's `Markup` and optional AsciiDoc value types were rejected to keep the contract elementary and avoid coupling this capability to an optional value-type module.
+
+### Resolve the message at render time
+
+The footer consults the provider and `ClockService` during Wicket configuration for each page render rather than only during component initialization.
+This allows an existing page instance to reflect a newly supplied, changed, started, or expired message on its next render.
+The viewer does not install a browser timer, so an idle page changes only after another request causes rendering.
+
+### Use the existing modal infrastructure
+
+The footer title is rendered as a keyboard-accessible Ajax link or button.
+Activating it opens the existing Bootstrap-based Wicket modal with the same title in its header and the trusted HTML detail in its body.
+Reusing the existing modal infrastructure preserves established focus, keyboard, sizing, and Ajax behavior.
+
+### Let the MOTD and history dropdown coexist
+
+The existing `show-drop-down-on-footer` property remains the sole control for the footer history dropdown, but its default changes from `true` to `false`.
+When explicitly enabled, the dropdown and an active MOTD are both rendered, with the MOTD occupying the footer's flexible region.
+Removing or renaming the existing property was rejected because applications may still value the history dropdown and already know its configuration key.
+
+## Risks / Trade-offs
+
+- [Risk] Trusted HTML can execute unwanted markup or script if an application passes untrusted administrator input → Document the trust boundary prominently and require provider implementations to sanitize externally managed content before returning it.
+- [Risk] A long title can crowd the other footer controls, especially when the history dropdown is enabled → Constrain the title region with responsive styling and ellipsis while keeping the complete detail available in the dialog.
+- [Risk] A provider backed by a database or remote system can add work to every page render → Document that providers should be inexpensive or internally cached and perform only one lookup per render.
+- [Risk] Adding `displayDuration` to `displayFrom` can overflow the supported `Instant` range → Validate construction and reject values whose derived end cannot be calculated.
+- [Trade-off] The banner does not appear or disappear at an exact wall-clock instant on an idle browser page → Accept page-render semantics to avoid polling or push infrastructure.
+- [Trade-off] Changing the history dropdown default alters existing applications that rely on the implicit default → Retain the property and document the explicit opt-in migration.
+
+## Migration Plan
+
+Applications that want the current footer history behavior set `causeway.viewer.wicket.bookmarked-pages.show-drop-down-on-footer=true` explicitly.
+Applications that do not provide `MessageOfTheDayProvider` require no migration and render no MOTD.
+Applications adopting the feature register one provider and ensure every returned message has a valid start, positive duration, plain-text title, and trusted HTML detail.
+Rollback consists of removing the provider and restoring the previous configuration default or explicitly enabling the history dropdown.
+
+## Open Questions
+
+None.
diff --git a/openspec/changes/add-wicket-motd-banner/proposal.md b/openspec/changes/add-wicket-motd-banner/proposal.md
new file mode 100644
index 00000000000..e89db246e50
--- /dev/null
+++ b/openspec/changes/add-wicket-motd-banner/proposal.md
@@ -0,0 +1,29 @@
+## Why
+
+Applications need a simple way for developers and administrators to notify end users about pertinent operational information such as scheduled daytime downtime.
+The Wicket footer currently gives prominent space to a little-used history dropdown while offering no application-defined, time-limited notice mechanism.
+
+## What Changes
+
+- Add an applib SPI through which an application can provide at most one message of the day with a plain-text title, trusted HTML detail, a display start instant, and a positive display duration.
+- Add a Wicket footer banner that shows the active message title and opens its detailed HTML in a dialog when clicked.
+- Evaluate message activity at page-render time using Causeway's `ClockService` and a half-open interval from the display start, inclusive, until the start plus the duration, exclusive.
+- Keep the existing footer history dropdown and allow it to coexist with the MOTD banner when explicitly enabled.
+- **BREAKING** Change `causeway.viewer.wicket.bookmarked-pages.show-drop-down-on-footer` to default to `false`, while retaining the property so applications can opt back in.
+
+## Capabilities
+
+### New Capabilities
+
+- `wicket-footer-motd`: Defines the application-provided, time-limited MOTD and its title-banner and detail-dialog behavior in the Wicket footer, including coexistence with the configurable history dropdown.
+
+### Modified Capabilities
+
+None.
+
+## Impact
+
+- Adds a public SPI and MOTD value type to regular applib without introducing a new external dependency.
+- Changes the default Wicket viewer configuration for the footer history dropdown.
+- Affects Wicket footer composition, rendering, Ajax dialog behavior, styling, tests, and viewer configuration documentation.
+- Treats the SPI-provided detail HTML as trusted and unsanitized application content.
diff --git a/openspec/changes/add-wicket-motd-banner/specs/wicket-footer-motd/spec.md b/openspec/changes/add-wicket-motd-banner/specs/wicket-footer-motd/spec.md
new file mode 100644
index 00000000000..ce0c5e1ebbb
--- /dev/null
+++ b/openspec/changes/add-wicket-motd-banner/specs/wicket-footer-motd/spec.md
@@ -0,0 +1,97 @@
+## ADDED Requirements
+
+### Requirement: Application-provided message of the day
+The system SHALL expose a regular applib SPI through which an application can provide zero or one message of the day.
+A message SHALL contain a plain-text title, trusted HTML detail, a display start `Instant`, and a strictly positive display `Duration`.
+
+#### Scenario: No provider is registered
+- **WHEN** no message-of-the-day provider is registered
+- **THEN** the Wicket footer renders no MOTD banner
+
+#### Scenario: Provider supplies no message
+- **WHEN** the registered provider returns no message
+- **THEN** the Wicket footer renders no MOTD banner
+
+#### Scenario: Valid message is supplied
+- **WHEN** the registered provider returns a message with a title, HTML detail, display start, and positive display duration
+- **THEN** the system makes that single message available for activity evaluation
+
+#### Scenario: Non-positive duration is supplied
+- **WHEN** a message is constructed with a zero or negative display duration
+- **THEN** the system rejects the invalid message
+
+### Requirement: Scheduled message activity
+The system SHALL derive a message's display end by adding its display duration to its display start.
+The system SHALL consider the message active from its display start inclusive until its derived display end exclusive.
+The Wicket viewer SHALL obtain the current instant through `ClockService`.
+
+#### Scenario: Before the display start
+- **WHEN** the current instant is before the message display start
+- **THEN** the message is inactive and the Wicket footer does not show its banner
+
+#### Scenario: At the display start
+- **WHEN** the current instant equals the message display start
+- **THEN** the message is active and the Wicket footer shows its banner
+
+#### Scenario: During the display duration
+- **WHEN** the current instant is after the display start and before the derived display end
+- **THEN** the message is active and the Wicket footer shows its banner
+
+#### Scenario: At the derived display end
+- **WHEN** the current instant equals the derived display end
+- **THEN** the message is inactive and the Wicket footer does not show its banner
+
+### Requirement: MOTD title banner
+The Wicket footer SHALL display the active message's title as escaped plain text in a compact, keyboard-accessible clickable control.
+The title region SHALL constrain overflowing content so that it does not displace the footer's other controls unnecessarily.
+
+#### Scenario: Active message is rendered
+- **WHEN** an active message is available during page rendering
+- **THEN** the footer shows its escaped title as a clickable MOTD banner
+
+#### Scenario: Title exceeds the available footer width
+- **WHEN** the active message title is wider than the available MOTD region
+- **THEN** the footer constrains the displayed title while preserving access to the message detail
+
+### Requirement: MOTD detail dialog
+Activating the MOTD title SHALL open a modal dialog whose heading is the message title and whose body renders the message detail as trusted, unescaped HTML.
+The framework SHALL document that the SPI does not sanitize the detail HTML.
+
+#### Scenario: User opens the active message
+- **WHEN** the user activates the MOTD title using a pointer or keyboard
+- **THEN** a modal dialog opens with the message title and rendered HTML detail
+
+#### Scenario: Detail contains HTML formatting and links
+- **WHEN** the message detail contains trusted HTML formatting or links
+- **THEN** the dialog renders that markup rather than displaying escaped HTML source
+
+### Requirement: Render-time refresh
+The Wicket footer SHALL consult the provider and evaluate message activity during each page render.
+The system SHALL NOT require polling or push updates while a rendered browser page remains idle.
+
+#### Scenario: Candidate message changes between renders
+- **WHEN** the provider returns a different candidate message on a subsequent page render
+- **THEN** the footer reflects the newly returned message and its current activity
+
+#### Scenario: Message expires between renders
+- **WHEN** a previously active message has reached its derived display end before the next page render
+- **THEN** the footer hides the MOTD banner on that render
+
+### Requirement: Footer history dropdown defaults to hidden
+The existing `causeway.viewer.wicket.bookmarked-pages.show-drop-down-on-footer` property SHALL remain available and SHALL default to `false`.
+Setting the property to `true` SHALL display the existing footer history dropdown.
+
+#### Scenario: Property is not configured
+- **WHEN** an application does not configure `show-drop-down-on-footer`
+- **THEN** the Wicket footer does not show the history dropdown
+
+#### Scenario: Property is explicitly enabled
+- **WHEN** an application configures `show-drop-down-on-footer=true`
+- **THEN** the Wicket footer shows the existing history dropdown
+
+### Requirement: MOTD and history coexistence
+An explicitly enabled footer history dropdown SHALL coexist with an active MOTD rather than replacing or suppressing it.
+
+#### Scenario: Both features are active
+- **WHEN** `show-drop-down-on-footer=true` and the provider supplies an active message
+- **THEN** the Wicket footer displays both the history dropdown and the MOTD title
diff --git a/openspec/changes/add-wicket-motd-banner/tasks.md b/openspec/changes/add-wicket-motd-banner/tasks.md
new file mode 100644
index 00000000000..7ca3fb7cc99
--- /dev/null
+++ b/openspec/changes/add-wicket-motd-banner/tasks.md
@@ -0,0 +1,23 @@
+## 1. Applib MOTD Contract
+
+- [ ] 1.1 Add the immutable `MessageOfTheDay` applib value with title, trusted HTML detail, display start, positive display duration, derived display end, and half-open `isActiveAt` semantics.
+- [ ] 1.2 Add unit tests for valid construction, non-positive-duration rejection, derived-end overflow rejection, and activity before, at, during, and at the end of the interval.
+- [ ] 1.3 Add the `MessageOfTheDayProvider` applib SPI returning an optional single message, and expose and document its package through the applib module metadata.
+
+## 2. Wicket Footer MOTD
+
+- [ ] 2.1 Add the Wicket MOTD title component and markup with escaped text, keyboard-accessible activation, responsive overflow styling, and an initially hidden state.
+- [ ] 2.2 Add the MOTD detail modal using the existing Wicket Bootstrap modal infrastructure, with the message title as its heading and trusted unescaped HTML as its body.
+- [ ] 2.3 Integrate the MOTD component into `FooterPanel` so it resolves the optional provider, obtains the current instant from `ClockService`, and refreshes visibility and content during each page render.
+- [ ] 2.4 Ensure an explicitly enabled footer history dropdown and an active MOTD render together without either suppressing the other.
+
+## 3. Wicket Configuration and Documentation
+
+- [ ] 3.1 Change the default of `causeway.viewer.wicket.bookmarked-pages.show-drop-down-on-footer` to `false` while retaining its explicit opt-in behavior.
+- [ ] 3.2 Update Wicket configuration and applib documentation for the new dropdown default, MOTD SPI, render-time scheduling semantics, positive duration requirement, and trusted-HTML security boundary.
+
+## 4. Verification
+
+- [ ] 4.1 Add Wicket viewer tests covering absent and empty providers, inactive and active messages, escaped titles, trusted HTML detail dialogs, render-time expiry, and history-dropdown coexistence.
+- [ ] 4.2 Run focused applib and Wicket viewer builds and tests, and resolve any compilation, module-export, markup, or inspection failures.
+- [ ] 4.3 Validate the completed OpenSpec change and confirm every normative scenario is represented by implementation or automated coverage.
(causeway) 03/03: maintenance-branch: adds Wicket MOTD banner
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a commit to branch maintenance-branch
in repository https://gitbox.apache.org/repos/asf/causeway.git
commit d03e1269e205fcb4ca5c6269417a19eed5b1b89d
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Tue Aug 25 15:08:30 2026 +0100
maintenance-branch: adds Wicket MOTD banner
---
api/applib/src/main/java/module-info.java | 1 +
.../applib/services/motd/MessageOfTheDay.java | 88 +++++++++++++
.../services/motd/MessageOfTheDayProvider.java | 35 +++++
.../applib/services/motd/package-info.java | 30 +++++
.../applib/services/motd/MessageOfTheDayTest.java | 73 +++++++++++
.../pages/sections/causeway.viewer.wicket.adoc | 4 +-
.../core/config/CausewayConfiguration.java | 2 +-
openspec/changes/add-wicket-motd-banner/tasks.md | 24 ++--
.../footer/MessageOfTheDayPanelTest.java | 110 ++++++++++++++++
.../wicket/ui/components/footer/FooterPanel.html | 4 +-
.../wicket/ui/components/footer/FooterPanel.java | 6 +
.../ui/components/footer/MessageOfTheDayPanel.css | 33 +++++
.../ui/components/footer/MessageOfTheDayPanel.html | 31 +++++
.../ui/components/footer/MessageOfTheDayPanel.java | 142 +++++++++++++++++++++
14 files changed, 567 insertions(+), 16 deletions(-)
diff --git a/api/applib/src/main/java/module-info.java b/api/applib/src/main/java/module-info.java
index ae2e493efdd..84e8380077e 100644
--- a/api/applib/src/main/java/module-info.java
+++ b/api/applib/src/main/java/module-info.java
@@ -89,6 +89,7 @@
exports org.apache.causeway.applib.services.metamodel;
exports org.apache.causeway.applib.services.metamodel.objgraph;
exports org.apache.causeway.applib.services.metrics;
+ exports org.apache.causeway.applib.services.motd;
exports org.apache.causeway.applib.services.placeholder;
exports org.apache.causeway.applib.services.publishing.log;
exports org.apache.causeway.applib.services.publishing.spi;
diff --git a/api/applib/src/main/java/org/apache/causeway/applib/services/motd/MessageOfTheDay.java b/api/applib/src/main/java/org/apache/causeway/applib/services/motd/MessageOfTheDay.java
new file mode 100644
index 00000000000..ad2cf2173bf
--- /dev/null
+++ b/api/applib/src/main/java/org/apache/causeway/applib/services/motd/MessageOfTheDay.java
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.causeway.applib.services.motd;
+
+import java.io.Serializable;
+import java.time.DateTimeException;
+import java.time.Duration;
+import java.time.Instant;
+import java.util.Objects;
+
+import lombok.Builder;
+import lombok.Value;
+
+/**
+ * An application-provided message to show during a bounded period.
+ *
+ * <p>The title is plain text, while {@link #getDetailHtml() detailHtml}
+ * is trusted HTML that viewers render without sanitizing.</p>
+ *
+ * @since 2.x {@index}
+ */
+@Value
+public class MessageOfTheDay implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ String title;
+ String detailHtml;
+ Instant displayFrom;
+ Duration displayDuration;
+ Instant displayUntil;
+
+ @Builder
+ public MessageOfTheDay(
+ final String title,
+ final String detailHtml,
+ final Instant displayFrom,
+ final Duration displayDuration) {
+ this.title = Objects.requireNonNull(title, "title");
+ this.detailHtml = Objects.requireNonNull(detailHtml, "detailHtml");
+ this.displayFrom = Objects.requireNonNull(displayFrom, "displayFrom");
+ this.displayDuration = requirePositive(displayDuration);
+ this.displayUntil = deriveDisplayUntil(displayFrom, displayDuration);
+ }
+
+ /**
+ * Tests against the half-open interval from {@link #getDisplayFrom()}, inclusive,
+ * until {@link #getDisplayUntil()}, exclusive.
+ */
+ public boolean isActiveAt(final Instant instant) {
+ Objects.requireNonNull(instant, "instant");
+ return !instant.isBefore(displayFrom)
+ && instant.isBefore(displayUntil);
+ }
+
+ private static Duration requirePositive(final Duration duration) {
+ Objects.requireNonNull(duration, "displayDuration");
+ if(duration.isZero() || duration.isNegative()) {
+ throw new IllegalArgumentException("displayDuration must be positive");
+ }
+ return duration;
+ }
+
+ private static Instant deriveDisplayUntil(final Instant displayFrom, final Duration displayDuration) {
+ try {
+ return displayFrom.plus(displayDuration);
+ } catch (DateTimeException | ArithmeticException ex) {
+ throw new IllegalArgumentException("displayFrom plus displayDuration is outside the Instant range", ex);
+ }
+ }
+
+}
diff --git a/api/applib/src/main/java/org/apache/causeway/applib/services/motd/MessageOfTheDayProvider.java b/api/applib/src/main/java/org/apache/causeway/applib/services/motd/MessageOfTheDayProvider.java
new file mode 100644
index 00000000000..b6f5c8a6eb4
--- /dev/null
+++ b/api/applib/src/main/java/org/apache/causeway/applib/services/motd/MessageOfTheDayProvider.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.causeway.applib.services.motd;
+
+import java.util.Optional;
+
+/**
+ * Supplies at most one candidate message of the day.
+ *
+ * <p>Viewers determine whether the candidate is active using the framework clock.</p>
+ *
+ * @since 2.x {@index}
+ */
+@FunctionalInterface
+public interface MessageOfTheDayProvider {
+
+ Optional<MessageOfTheDay> getMessageOfTheDay();
+
+}
diff --git a/api/applib/src/main/java/org/apache/causeway/applib/services/motd/package-info.java b/api/applib/src/main/java/org/apache/causeway/applib/services/motd/package-info.java
new file mode 100644
index 00000000000..fe773a670c2
--- /dev/null
+++ b/api/applib/src/main/java/org/apache/causeway/applib/services/motd/package-info.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/**
+ * Provides an SPI for supplying a scheduled message of the day to viewers.
+ *
+ * <p>A viewer evaluates the candidate on each page render using the framework clock.
+ * The message is active from its display start, inclusive, until its display start plus
+ * its positive display duration, exclusive.</p>
+ *
+ * <p>The message title is plain text.
+ * Its detail is trusted HTML that the framework does not sanitize, so providers that
+ * obtain content from an external source are responsible for sanitizing that content.</p>
+ */
+package org.apache.causeway.applib.services.motd;
diff --git a/api/applib/src/test/java/org/apache/causeway/applib/services/motd/MessageOfTheDayTest.java b/api/applib/src/test/java/org/apache/causeway/applib/services/motd/MessageOfTheDayTest.java
new file mode 100644
index 00000000000..7fddb1d54dc
--- /dev/null
+++ b/api/applib/src/test/java/org/apache/causeway/applib/services/motd/MessageOfTheDayTest.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.causeway.applib.services.motd;
+
+import java.time.Duration;
+import java.time.Instant;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class MessageOfTheDayTest {
+
+ private static final Instant DISPLAY_FROM = Instant.parse("2026-07-10T09:00:00Z");
+
+ @Test
+ void derivesDisplayUntilAndUsesHalfOpenInterval() {
+ final MessageOfTheDay message = messageWith(Duration.ofHours(6));
+
+ assertEquals(Instant.parse("2026-07-10T15:00:00Z"), message.getDisplayUntil());
+ assertFalse(message.isActiveAt(DISPLAY_FROM.minusNanos(1)));
+ assertTrue(message.isActiveAt(DISPLAY_FROM));
+ assertTrue(message.isActiveAt(DISPLAY_FROM.plus(Duration.ofHours(3))));
+ assertFalse(message.isActiveAt(message.getDisplayUntil()));
+ }
+
+ @Test
+ void rejectsZeroDuration() {
+ assertThrows(IllegalArgumentException.class, () -> messageWith(Duration.ZERO));
+ }
+
+ @Test
+ void rejectsNegativeDuration() {
+ assertThrows(IllegalArgumentException.class, () -> messageWith(Duration.ofHours(-1)));
+ }
+
+ @Test
+ void rejectsDerivedEndOutsideInstantRange() {
+ assertThrows(IllegalArgumentException.class, () -> new MessageOfTheDay(
+ "Scheduled maintenance",
+ "<p>Details</p>",
+ Instant.MAX,
+ Duration.ofNanos(1)));
+ }
+
+ private static MessageOfTheDay messageWith(final Duration duration) {
+ return new MessageOfTheDay(
+ "Scheduled maintenance",
+ "<p>Details</p>",
+ DISPLAY_FROM,
+ duration);
+ }
+
+}
diff --git a/core/config/src/main/adoc/modules/config/pages/sections/causeway.viewer.wicket.adoc b/core/config/src/main/adoc/modules/config/pages/sections/causeway.viewer.wicket.adoc
index ff25ca1296d..c6f29645399 100644
--- a/core/config/src/main/adoc/modules/config/pages/sections/causeway.viewer.wicket.adoc
+++ b/core/config/src/main/adoc/modules/config/pages/sections/causeway.viewer.wicket.adoc
@@ -66,9 +66,11 @@ causeway.viewer.wicket. +
bookmarked-pages. +
show-drop-down-on-footer
-| true
+| false
| Whether the drop-down list of previously visited objects should be shown in the footer.
+The drop-down is hidden by default and can be explicitly enabled alongside the message-of-the-day banner.
+
|
[[causeway.viewer.wicket.breadcrumbs.enabled]]
diff --git a/core/config/src/main/java/org/apache/causeway/core/config/CausewayConfiguration.java b/core/config/src/main/java/org/apache/causeway/core/config/CausewayConfiguration.java
index 3236cf566f4..2b83789d16a 100644
--- a/core/config/src/main/java/org/apache/causeway/core/config/CausewayConfiguration.java
+++ b/core/config/src/main/java/org/apache/causeway/core/config/CausewayConfiguration.java
@@ -3346,7 +3346,7 @@ public static class BookmarkedPages {
/**
* Whether the drop-down list of previously visited objects should be shown in the footer.
*/
- private boolean showDropDownOnFooter = true;
+ private boolean showDropDownOnFooter = false;
}
diff --git a/openspec/changes/add-wicket-motd-banner/tasks.md b/openspec/changes/add-wicket-motd-banner/tasks.md
index 7ca3fb7cc99..a8cdd825b44 100644
--- a/openspec/changes/add-wicket-motd-banner/tasks.md
+++ b/openspec/changes/add-wicket-motd-banner/tasks.md
@@ -1,23 +1,23 @@
## 1. Applib MOTD Contract
-- [ ] 1.1 Add the immutable `MessageOfTheDay` applib value with title, trusted HTML detail, display start, positive display duration, derived display end, and half-open `isActiveAt` semantics.
-- [ ] 1.2 Add unit tests for valid construction, non-positive-duration rejection, derived-end overflow rejection, and activity before, at, during, and at the end of the interval.
-- [ ] 1.3 Add the `MessageOfTheDayProvider` applib SPI returning an optional single message, and expose and document its package through the applib module metadata.
+- [x] 1.1 Add the immutable `MessageOfTheDay` applib value with title, trusted HTML detail, display start, positive display duration, derived display end, and half-open `isActiveAt` semantics.
+- [x] 1.2 Add unit tests for valid construction, non-positive-duration rejection, derived-end overflow rejection, and activity before, at, during, and at the end of the interval.
+- [x] 1.3 Add the `MessageOfTheDayProvider` applib SPI returning an optional single message, and expose and document its package through the applib module metadata.
## 2. Wicket Footer MOTD
-- [ ] 2.1 Add the Wicket MOTD title component and markup with escaped text, keyboard-accessible activation, responsive overflow styling, and an initially hidden state.
-- [ ] 2.2 Add the MOTD detail modal using the existing Wicket Bootstrap modal infrastructure, with the message title as its heading and trusted unescaped HTML as its body.
-- [ ] 2.3 Integrate the MOTD component into `FooterPanel` so it resolves the optional provider, obtains the current instant from `ClockService`, and refreshes visibility and content during each page render.
-- [ ] 2.4 Ensure an explicitly enabled footer history dropdown and an active MOTD render together without either suppressing the other.
+- [x] 2.1 Add the Wicket MOTD title component and markup with escaped text, keyboard-accessible activation, responsive overflow styling, and an initially hidden state.
+- [x] 2.2 Add the MOTD detail modal using the existing Wicket Bootstrap modal infrastructure, with the message title as its heading and trusted unescaped HTML as its body.
+- [x] 2.3 Integrate the MOTD component into `FooterPanel` so it resolves the optional provider, obtains the current instant from `ClockService`, and refreshes visibility and content during each page render.
+- [x] 2.4 Ensure an explicitly enabled footer history dropdown and an active MOTD render together without either suppressing the other.
## 3. Wicket Configuration and Documentation
-- [ ] 3.1 Change the default of `causeway.viewer.wicket.bookmarked-pages.show-drop-down-on-footer` to `false` while retaining its explicit opt-in behavior.
-- [ ] 3.2 Update Wicket configuration and applib documentation for the new dropdown default, MOTD SPI, render-time scheduling semantics, positive duration requirement, and trusted-HTML security boundary.
+- [x] 3.1 Change the default of `causeway.viewer.wicket.bookmarked-pages.show-drop-down-on-footer` to `false` while retaining its explicit opt-in behavior.
+- [x] 3.2 Update Wicket configuration and applib documentation for the new dropdown default, MOTD SPI, render-time scheduling semantics, positive duration requirement, and trusted-HTML security boundary.
## 4. Verification
-- [ ] 4.1 Add Wicket viewer tests covering absent and empty providers, inactive and active messages, escaped titles, trusted HTML detail dialogs, render-time expiry, and history-dropdown coexistence.
-- [ ] 4.2 Run focused applib and Wicket viewer builds and tests, and resolve any compilation, module-export, markup, or inspection failures.
-- [ ] 4.3 Validate the completed OpenSpec change and confirm every normative scenario is represented by implementation or automated coverage.
+- [x] 4.1 Add Wicket viewer tests covering absent and empty providers, inactive and active messages, escaped titles, trusted HTML detail dialogs, render-time expiry, and history-dropdown coexistence.
+- [x] 4.2 Run focused applib and Wicket viewer builds and tests, and resolve any compilation, module-export, markup, or inspection failures.
+- [x] 4.3 Validate the completed OpenSpec change and confirm every normative scenario is represented by implementation or automated coverage.
diff --git a/viewers/wicket/ui-test/src/test/java/org/apache/causeway/viewer/wicket/ui/components/footer/MessageOfTheDayPanelTest.java b/viewers/wicket/ui-test/src/test/java/org/apache/causeway/viewer/wicket/ui/components/footer/MessageOfTheDayPanelTest.java
new file mode 100644
index 00000000000..ce41a82c1e4
--- /dev/null
+++ b/viewers/wicket/ui-test/src/test/java/org/apache/causeway/viewer/wicket/ui/components/footer/MessageOfTheDayPanelTest.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.causeway.viewer.wicket.ui.components.footer;
+
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.time.Duration;
+import java.time.Instant;
+import java.util.Optional;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import org.apache.causeway.applib.services.motd.MessageOfTheDay;
+import org.apache.causeway.applib.services.motd.MessageOfTheDayProvider;
+import org.apache.causeway.core.config.CausewayConfiguration;
+
+import org.apache.wicket.util.tester.WicketTester;
+
+class MessageOfTheDayPanelTest {
+
+ private static final Instant DISPLAY_FROM = Instant.parse("2026-07-10T09:00:00Z");
+ private static final MessageOfTheDay MESSAGE = new MessageOfTheDay(
+ "<strong>Scheduled maintenance</strong>",
+ "<p>Trusted <a href=\"https://status.example.com\">detail</a></p>",
+ DISPLAY_FROM,
+ Duration.ofHours(6));
+
+ @Test
+ void noProviderProducesNoCandidate() {
+ assertTrue(MessageOfTheDayPanel.candidateFrom(Optional.empty()).isEmpty());
+ }
+
+ @Test
+ void emptyProviderProducesNoCandidate() {
+ final MessageOfTheDayProvider provider = Optional::empty;
+
+ assertTrue(MessageOfTheDayPanel.candidateFrom(Optional.of(provider)).isEmpty());
+ }
+
+ @Test
+ void providerCandidateIsSelectedOnlyWhileActive() {
+ final Optional<MessageOfTheDay> candidate = Optional.of(MESSAGE);
+
+ assertTrue(MessageOfTheDayPanel.selectActive(candidate, DISPLAY_FROM.minusNanos(1)).isEmpty());
+ assertTrue(MessageOfTheDayPanel.selectActive(candidate, DISPLAY_FROM).isPresent());
+ assertTrue(MessageOfTheDayPanel.selectActive(candidate, DISPLAY_FROM.plus(Duration.ofHours(3))).isPresent());
+ assertTrue(MessageOfTheDayPanel.selectActive(candidate, MESSAGE.getDisplayUntil()).isEmpty());
+ }
+
+ @Test
+ void subsequentSelectionReflectsExpiry() {
+ final Optional<MessageOfTheDay> candidate = Optional.of(MESSAGE);
+
+ assertTrue(MessageOfTheDayPanel.selectActive(candidate, DISPLAY_FROM).isPresent());
+ assertTrue(MessageOfTheDayPanel.selectActive(candidate, MESSAGE.getDisplayUntil()).isEmpty());
+ }
+
+ @Test
+ void titleIsEscapedAndDetailHtmlIsNotEscaped() {
+ final WicketTester tester = new WicketTester();
+ try {
+ assertTrue(MessageOfTheDayPanel.newTitleLabel("title", MESSAGE.getTitle()).getEscapeModelStrings());
+ assertFalse(MessageOfTheDayPanel.newDetailLabel("detail", MESSAGE.getDetailHtml()).getEscapeModelStrings());
+ } finally {
+ tester.destroy();
+ }
+ }
+
+ @Test
+ void historyDropdownDefaultsToHiddenAndCanBeEnabled() {
+ final CausewayConfiguration configuration = new CausewayConfiguration(null, Optional.empty());
+
+ assertFalse(configuration.getViewer().getWicket().getBookmarkedPages().isShowDropDownOnFooter());
+ configuration.getViewer().getWicket().getBookmarkedPages().setShowDropDownOnFooter(true);
+ assertTrue(configuration.getViewer().getWicket().getBookmarkedPages().isShowDropDownOnFooter());
+ }
+
+ @Test
+ void footerMarkupAccommodatesHistoryAndMessageTogether() throws IOException {
+ final String markup;
+ try (var input = FooterPanel.class.getResourceAsStream("FooterPanel.html")) {
+ assertNotNull(input);
+ markup = new String(input.readAllBytes(), StandardCharsets.UTF_8);
+ }
+
+ assertTrue(markup.contains("wicket:id=\"breadcrumbs\""));
+ assertTrue(markup.contains("wicket:id=\"messageOfTheDay\""));
+ }
+
+}
diff --git a/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/footer/FooterPanel.html b/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/footer/FooterPanel.html
index 192cc3f3494..2f614a793a4 100644
--- a/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/footer/FooterPanel.html
+++ b/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/footer/FooterPanel.html
@@ -41,8 +41,8 @@
<form class="navbar-nav form-inline">
<span wicket:id="breadcrumbs"></span>
</form>
- <ul class="navbar-nav mr-auto">
- </ul>
+ <div class="navbar-nav flex-grow-1 motd-footer-item"
+ wicket:id="messageOfTheDay"></div>
<span class="navbar-text"> <span class="powered-by"
wicket:id="creditsLabel">Credits:</span>
</span>
diff --git a/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/footer/FooterPanel.java b/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/footer/FooterPanel.java
index 14976e0ef4d..0c75d6d0587 100644
--- a/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/footer/FooterPanel.java
+++ b/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/footer/FooterPanel.java
@@ -53,6 +53,7 @@ public class FooterPanel
private static final long serialVersionUID = 1L;
private static final String ID_BREADCRUMBS = "breadcrumbs";
+ private static final String ID_MESSAGE_OF_THE_DAY = "messageOfTheDay";
private static final String ID_ABOUT_LINK = "aboutLink";
private static final String ID_ABOUT_MESSAGE = "aboutMessage";
private static final String ID_THEME_PICKER = "themePicker";
@@ -72,6 +73,7 @@ protected void onInitialize() {
super.onInitialize();
addBreadcrumbs();
+ addMessageOfTheDay();
addCredits();
addAboutLink();
addThemePicker();
@@ -141,6 +143,10 @@ private void addBreadcrumbs() {
addOrReplace(breadcrumbPanel);
}
+ private void addMessageOfTheDay() {
+ add(new MessageOfTheDayPanel(ID_MESSAGE_OF_THE_DAY));
+ }
+
@Override
protected void onConfigure() {
super.onConfigure();
diff --git a/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/footer/MessageOfTheDayPanel.css b/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/footer/MessageOfTheDayPanel.css
new file mode 100644
index 00000000000..19bc7041a28
--- /dev/null
+++ b/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/footer/MessageOfTheDayPanel.css
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+.motd-footer-item,
+.motd-container {
+ min-width: 0;
+}
+
+.motd-container {
+ overflow: hidden;
+}
+
+.motd-title {
+ display: block;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
diff --git a/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/footer/MessageOfTheDayPanel.html b/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/footer/MessageOfTheDayPanel.html
new file mode 100644
index 00000000000..0c701f13727
--- /dev/null
+++ b/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/footer/MessageOfTheDayPanel.html
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<html xmlns:wicket="http://wicket.apache.org">
+<body>
+ <wicket:panel>
+ <div class="motd-container">
+ <a wicket:id="titleLink" class="nav-link motd-title" href="#">
+ <span wicket:id="title"></span>
+ </a>
+ </div>
+ <div wicket:id="detailDialog"></div>
+ </wicket:panel>
+</body>
+</html>
diff --git a/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/footer/MessageOfTheDayPanel.java b/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/footer/MessageOfTheDayPanel.java
new file mode 100644
index 00000000000..e46930dc7c7
--- /dev/null
+++ b/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/footer/MessageOfTheDayPanel.java
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.causeway.viewer.wicket.ui.components.footer;
+
+import java.time.Instant;
+import java.util.Optional;
+
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.markup.html.AjaxLink;
+import org.apache.wicket.markup.head.CssHeaderItem;
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.request.resource.CssResourceReference;
+
+import org.apache.causeway.applib.services.clock.ClockService;
+import org.apache.causeway.applib.services.motd.MessageOfTheDay;
+import org.apache.causeway.applib.services.motd.MessageOfTheDayProvider;
+import org.apache.causeway.viewer.wicket.ui.components.widgets.bootstrap.ModalDialog;
+import org.apache.causeway.viewer.wicket.ui.panels.PanelAbstract;
+
+import lombok.val;
+
+/**
+ * Displays the active message of the day and opens its trusted HTML detail.
+ */
+public class MessageOfTheDayPanel
+extends PanelAbstract<String, Model<String>> {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String ID_TITLE_LINK = "titleLink";
+ private static final String ID_TITLE = "title";
+ private static final String ID_DETAIL_DIALOG = "detailDialog";
+
+ private static final CssResourceReference CSS_RESOURCE =
+ new CssResourceReference(MessageOfTheDayPanel.class, "MessageOfTheDayPanel.css");
+
+ private MessageOfTheDay activeMessage;
+ private Label titleLabel;
+ private ModalDialog<Void> detailDialog;
+
+ public MessageOfTheDayPanel(final String id) {
+ super(id);
+ setOutputMarkupPlaceholderTag(true);
+ }
+
+ @Override
+ protected void onInitialize() {
+ super.onInitialize();
+
+ titleLabel = newTitleLabel(ID_TITLE, "");
+
+ final AjaxLink<Void> titleLink = new AjaxLink<Void>(ID_TITLE_LINK) {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target) {
+ showDetail(target);
+ }
+ };
+ titleLink.add(titleLabel);
+ add(titleLink);
+
+ detailDialog = new ModalDialog<>(ID_DETAIL_DIALOG);
+ detailDialog.setVisible(false);
+ add(detailDialog);
+ }
+
+ @Override
+ protected void onConfigure() {
+ super.onConfigure();
+
+ val candidate = candidateFrom(getServiceRegistry()
+ .lookupService(MessageOfTheDayProvider.class));
+ val now = getServiceRegistry()
+ .lookupServiceElseFail(ClockService.class)
+ .getClock()
+ .nowAsInstant();
+
+ activeMessage = selectActive(candidate, now).orElse(null);
+ titleLabel.setDefaultModelObject(activeMessage != null ? activeMessage.getTitle() : "");
+ setVisible(activeMessage != null);
+ }
+
+ @Override
+ public void renderHead(final IHeaderResponse response) {
+ super.renderHead(response);
+ response.render(CssHeaderItem.forReference(CSS_RESOURCE));
+ }
+
+ static Optional<MessageOfTheDay> candidateFrom(
+ final Optional<MessageOfTheDayProvider> provider) {
+ return provider.flatMap(MessageOfTheDayProvider::getMessageOfTheDay);
+ }
+
+ static Optional<MessageOfTheDay> selectActive(
+ final Optional<MessageOfTheDay> candidate,
+ final Instant now) {
+ return candidate.filter(message -> message.isActiveAt(now));
+ }
+
+ static Label newTitleLabel(final String id, final String title) {
+ return new Label(id, Model.of(title));
+ }
+
+ static Label newDetailLabel(final String id, final String detailHtml) {
+ final Label detail = new Label(id, Model.of(detailHtml));
+ detail.setEscapeModelStrings(false);
+ return detail;
+ }
+
+ private void showDetail(final AjaxRequestTarget target) {
+ if(activeMessage == null) {
+ return;
+ }
+
+ detailDialog.setTitle(
+ newTitleLabel(detailDialog.getTitleId(), activeMessage.getTitle()),
+ target);
+ detailDialog.setPanel(
+ newDetailLabel(detailDialog.getContentId(), activeMessage.getDetailHtml()),
+ target);
+ }
+
+}