This is an automated email from the ASF dual-hosted git repository.

papegaaij pushed a commit to branch islands
in repository https://gitbox.apache.org/repos/asf/wicket.git

commit 178c812c89a4811a20ebfae5afb9446fc9461a46
Author: Emond Papegaaij <[email protected]>
AuthorDate: Thu Nov 5 18:52:10 2026 +0100

    Complete the Treasure Hunt example with history, score entry and high scores
    
    The probe history is a second island that shares the highlighted cell
    with the board through a client store. When a game is over, a plain
    Wicket form with a form island for the player's name and colour saves the
    score; the high-score list is an island fetching the scores through a
    page-less endpoint, refreshed when a score is saved.
    
    Under the js-test profile, jetty:run also reads the generated Vite
    output, so the example works even when target/classes is rebuilt without
    it.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 wicket-examples/pom.xml                            |   9 ++
 .../src/main/frontend/package-lock.json            |  40 ++++++-
 wicket-examples/src/main/frontend/package.json     |   2 +
 .../src/treasurehunt/HighScoreList.css}            |  30 ++++--
 .../frontend/src/treasurehunt/HighScoreList.tsx    |  59 +++++++++++
 .../src/treasurehunt/PlayerEntryForm.css}          |  29 +++--
 .../frontend/src/treasurehunt/PlayerEntryForm.tsx  |  64 +++++++++++
 .../src/treasurehunt/ProbeHistory.css}             |  17 +--
 .../frontend/src/treasurehunt/ProbeHistory.tsx     |  51 +++++++++
 .../frontend/src/treasurehunt/TreasureBoard.css    |   7 +-
 .../frontend/src/treasurehunt/TreasureBoard.tsx    |  23 ++--
 .../src/treasurehunt/shared.ts}                    |  22 ++--
 wicket-examples/src/main/frontend/vite.config.js   |   8 +-
 .../wicket/examples/islands/treasurehunt/Game.java |  27 +++++
 .../islands/treasurehunt/HighScoreList.java}       |  68 +++++-------
 .../examples/islands/treasurehunt/HighScores.java  |  49 +++++++++
 .../islands/treasurehunt/PlayerEntry.java}         |  63 ++++-------
 .../islands/treasurehunt/PlayerEntryField.java     |  76 +++++++++++++
 .../islands/treasurehunt/ProbeHistory.java         |  49 +++++++++
 .../{TreasureHuntPage.css => Score.java}           |  22 ++--
 .../examples/islands/treasurehunt/ScorePanel.html  |  17 +++
 .../examples/islands/treasurehunt/ScorePanel.java  | 118 +++++++++++++++++++++
 .../islands/treasurehunt/ScoresEndpoint.java       |  54 ++++++++++
 .../treasurehunt/TreasureHuntApplication.java      |  17 +++
 .../islands/treasurehunt/TreasureHuntPage.css      |  14 +++
 .../islands/treasurehunt/TreasureHuntPage.html     |  21 ++--
 .../islands/treasurehunt/TreasureHuntPage.java     |  36 ++++++-
 27 files changed, 847 insertions(+), 145 deletions(-)

diff --git a/wicket-examples/pom.xml b/wicket-examples/pom.xml
index 1bc3245d16..8f6f264fe1 100644
--- a/wicket-examples/pom.xml
+++ b/wicket-examples/pom.xml
@@ -347,6 +347,15 @@
                                                        </execution>
                                                </executions>
                                        </plugin>
+                                       <plugin>
+                                               
<groupId>org.eclipse.jetty.ee11</groupId>
+                                               
<artifactId>jetty-ee11-maven-plugin</artifactId>
+                                               <configuration>
+                                                       <webApp>
+                                                               
<extraClasspath>${project.build.directory}/generated-resources/wicket-islands</extraClasspath>
+                                                       </webApp>
+                                               </configuration>
+                                       </plugin>
                                        <plugin>
                                                
<groupId>org.codehaus.mojo</groupId>
                                                
<artifactId>build-helper-maven-plugin</artifactId>
diff --git a/wicket-examples/src/main/frontend/package-lock.json 
b/wicket-examples/src/main/frontend/package-lock.json
index e9bbce90a4..bc3ceafec1 100644
--- a/wicket-examples/src/main/frontend/package-lock.json
+++ b/wicket-examples/src/main/frontend/package-lock.json
@@ -6,6 +6,8 @@
     "": {
       "name": "wicket-examples-frontend",
       "dependencies": {
+        "@tanstack/query-core": "^5.0.0",
+        "@tanstack/react-query": "^5.0.0",
         "react": "^19.2.0",
         "react-dom": "^19.2.0",
         "wicket-islands": 
"file:../../../../wicket-experimental/wicket-islands/npm/packages/runtime",
@@ -22,6 +24,7 @@
       "version": "0.0.0",
       "license": "Apache-2.0",
       "peerDependencies": {
+        "@tanstack/react-query": "^5.0.0",
         "react": "^19.0.0",
         "react-dom": "^19.0.0",
         "wicket-islands": "0.0.0"
@@ -30,7 +33,10 @@
     "../../../../wicket-experimental/wicket-islands/npm/packages/runtime": {
       "name": "wicket-islands",
       "version": "0.0.0",
-      "license": "Apache-2.0"
+      "license": "Apache-2.0",
+      "peerDependencies": {
+        "@tanstack/query-core": "^5.0.0"
+      }
     },
     "../../../../wicket-experimental/wicket-islands/npm/packages/vite-plugin": 
{
       "name": "vite-plugin-wicket-islands",
@@ -1225,6 +1231,38 @@
         "win32"
       ]
     },
+    "node_modules/@tanstack/query-core": {
+      "version": "5.106.1",
+      "resolved": 
"https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.106.1.tgz";,
+      "integrity": 
"sha512-erYv/UACddcdgjOL2ixmFdK6tO/AVBeUcTCOtX2N51yZpDQ2U7KJ+xgB/bCNfsF3uoCDTqGHEEbDiFsIO9YUmQ==",
+      "license": "MIT",
+      "funding": {
+        "type": "github",
+        "url": "https://github.com/sponsors/tannerlinsley";
+      }
+    },
+    "node_modules/@tanstack/react-query": {
+      "version": "5.106.1",
+      "resolved": 
"https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.106.1.tgz";,
+      "integrity": 
"sha512-ORDvJG/DSfmlFL9lQ8GDkE0VjtQbLeRDY7BL8xjKkQFGLfjFGfNWNuteWgPqA2gPJgLLuWfQ7IX0FlsHCJriyg==",
+      "license": "MIT",
+      "dependencies": {
+        "@tanstack/query-core": "5.106.1"
+      },
+      "funding": {
+        "type": "github",
+        "url": "https://github.com/sponsors/tannerlinsley";
+      },
+      "peerDependencies": {
+        "@types/react": "^18 || ^19",
+        "react": "^18 || ^19"
+      },
+      "peerDependenciesMeta": {
+        "@types/react": {
+          "optional": true
+        }
+      }
+    },
     "node_modules/@types/babel__core": {
       "version": "7.20.5",
       "resolved": 
"https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz";,
diff --git a/wicket-examples/src/main/frontend/package.json 
b/wicket-examples/src/main/frontend/package.json
index 22127ec6b5..4938def211 100644
--- a/wicket-examples/src/main/frontend/package.json
+++ b/wicket-examples/src/main/frontend/package.json
@@ -7,6 +7,8 @@
     "build": "vite build"
   },
   "dependencies": {
+    "@tanstack/query-core": "^5.0.0",
+    "@tanstack/react-query": "^5.0.0",
     "react": "^19.2.0",
     "react-dom": "^19.2.0",
     "wicket-islands": 
"file:../../../../wicket-experimental/wicket-islands/npm/packages/runtime",
diff --git 
a/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/TreasureHuntPage.css
 b/wicket-examples/src/main/frontend/src/treasurehunt/HighScoreList.css
similarity index 72%
copy from 
wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/TreasureHuntPage.css
copy to wicket-examples/src/main/frontend/src/treasurehunt/HighScoreList.css
index 4c20d623c7..1398c7b2f8 100644
--- 
a/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/TreasureHuntPage.css
+++ b/wicket-examples/src/main/frontend/src/treasurehunt/HighScoreList.css
@@ -14,12 +14,30 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-.treasure-game {
-       margin-top: 1em;
+.highscore-list {
+       min-width: 14em;
 }
 
-.treasure-notice {
-       padding: 0.5em 1em;
-       border: 1px solid #c90;
-       background: #fff6e0;
+.highscore-list ol {
+       padding-left: 1.5em;
+}
+
+.highscore-list li {
+       display: flex;
+       gap: 0.5em;
+       align-items: center;
+}
+
+.highscore-list .dot {
+       width: 0.8em;
+       height: 0.8em;
+       border-radius: 50%;
+}
+
+.highscore-list .name {
+       flex: 1;
+}
+
+.highscore-list .error {
+       color: #b00;
 }
diff --git 
a/wicket-examples/src/main/frontend/src/treasurehunt/HighScoreList.tsx 
b/wicket-examples/src/main/frontend/src/treasurehunt/HighScoreList.tsx
new file mode 100644
index 0000000000..1ef22041cb
--- /dev/null
+++ b/wicket-examples/src/main/frontend/src/treasurehunt/HighScoreList.tsx
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ */
+
+import { useIslandQuery } from 'wicket-islands-react';
+import './HighScoreList.css';
+
+/**
+ * An entry, as Score.java declares it.
+ */
+interface Score {
+       name: string;
+       colour: string;
+       score: number;
+}
+
+/**
+ * The props of the list, as HighScoreList.java's ListProps sends them.
+ */
+interface ListProps {
+       size: string;
+}
+
+export default function HighScoreList({ size }: ListProps) {
+       const scores = useIslandQuery<Score[]>('scores', { size });
+
+       return (
+               <div className="highscore-list">
+                       <h3>High scores ({size.toLowerCase()} board)</h3>
+                       {scores.isPending && <p>Loading…</p>}
+                       {scores.isError && <p 
className="error">{scores.error.messages.join(' ')}</p>}
+                       {scores.data && scores.data.length === 0 && <p>No 
scores yet.</p>}
+                       {scores.data && scores.data.length > 0 && (
+                               <ol>
+                                       {scores.data.map((score, index) => (
+                                               <li key={index}>
+                                                       <span className="dot" 
style={{ backgroundColor: score.colour }} />
+                                                       <span 
className="name">{score.name}</span>
+                                                       <span 
className="score">{score.score}</span>
+                                               </li>
+                                       ))}
+                               </ol>
+                       )}
+               </div>
+       );
+}
diff --git 
a/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/TreasureHuntPage.css
 b/wicket-examples/src/main/frontend/src/treasurehunt/PlayerEntryForm.css
similarity index 69%
copy from 
wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/TreasureHuntPage.css
copy to wicket-examples/src/main/frontend/src/treasurehunt/PlayerEntryForm.css
index 4c20d623c7..fad5baaace 100644
--- 
a/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/TreasureHuntPage.css
+++ b/wicket-examples/src/main/frontend/src/treasurehunt/PlayerEntryForm.css
@@ -14,12 +14,29 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-.treasure-game {
-       margin-top: 1em;
+.player-entry {
+       margin: 0.5em 0;
 }
 
-.treasure-notice {
-       padding: 0.5em 1em;
-       border: 1px solid #c90;
-       background: #fff6e0;
+.player-entry .swatches {
+       display: flex;
+       gap: 0.4em;
+       margin: 0.5em 0;
+}
+
+.player-entry .swatch {
+       width: 1.6em;
+       height: 1.6em;
+       border: 2px solid transparent;
+       border-radius: 50%;
+       cursor: pointer;
+}
+
+.player-entry .swatch.selected {
+       border-color: #000;
+}
+
+.player-entry .errors {
+       color: #b00;
+       margin: 0.3em 0;
 }
diff --git 
a/wicket-examples/src/main/frontend/src/treasurehunt/PlayerEntryForm.tsx 
b/wicket-examples/src/main/frontend/src/treasurehunt/PlayerEntryForm.tsx
new file mode 100644
index 0000000000..2225026bbc
--- /dev/null
+++ b/wicket-examples/src/main/frontend/src/treasurehunt/PlayerEntryForm.tsx
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ */
+
+import { useFormState, useFormValue } from 'wicket-islands-react';
+import './PlayerEntryForm.css';
+
+/**
+ * The value of the form island, as PlayerEntry.java declares it.
+ */
+interface PlayerEntry {
+       name: string;
+       colour: string;
+}
+
+/**
+ * The props of the form island, as PlayerEntryField.java's EntryProps sends 
them.
+ */
+interface EntryProps {
+       palette: string[];
+}
+
+export default function PlayerEntryForm({ palette }: EntryProps) {
+       const [entry, setEntry] = useFormValue<PlayerEntry>();
+       const { enabled, errors } = useFormState();
+       const name = entry?.name ?? '';
+       const colour = entry?.colour ?? palette[0];
+
+       return (
+               <div className="player-entry">
+                       <label>
+                               Name <input type="text" value={name} 
maxLength={30} disabled={!enabled}
+                                       onChange={event => setEntry({ name: 
event.target.value, colour })} />
+                       </label>
+                       <div className="swatches" role="radiogroup" 
aria-label="Colour">
+                               {palette.map(choice => (
+                                       <button key={choice} type="button" 
role="radio" aria-checked={choice === colour}
+                                               aria-label={choice} 
disabled={!enabled}
+                                               className={choice === colour ? 
'swatch selected' : 'swatch'}
+                                               style={{ backgroundColor: 
choice }}
+                                               onClick={() => setEntry({ name, 
colour: choice })} />
+                               ))}
+                       </div>
+                       {errors.length > 0 && (
+                               <ul className="errors">
+                                       {errors.map(error => <li 
key={error}>{error}</li>)}
+                               </ul>
+                       )}
+               </div>
+       );
+}
diff --git 
a/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/TreasureHuntPage.css
 b/wicket-examples/src/main/frontend/src/treasurehunt/ProbeHistory.css
similarity index 82%
copy from 
wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/TreasureHuntPage.css
copy to wicket-examples/src/main/frontend/src/treasurehunt/ProbeHistory.css
index 4c20d623c7..4b5d07c486 100644
--- 
a/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/TreasureHuntPage.css
+++ b/wicket-examples/src/main/frontend/src/treasurehunt/ProbeHistory.css
@@ -14,12 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-.treasure-game {
-       margin-top: 1em;
+.probe-history {
+       min-width: 12em;
+       margin: 1em 0;
 }
 
-.treasure-notice {
-       padding: 0.5em 1em;
-       border: 1px solid #c90;
-       background: #fff6e0;
+.probe-history li {
+       padding: 0.1em 0.4em;
+       cursor: default;
+}
+
+.probe-history li.hover {
+       background: #333;
+       color: #fff;
 }
diff --git 
a/wicket-examples/src/main/frontend/src/treasurehunt/ProbeHistory.tsx 
b/wicket-examples/src/main/frontend/src/treasurehunt/ProbeHistory.tsx
new file mode 100644
index 0000000000..5d5dc8ff7d
--- /dev/null
+++ b/wicket-examples/src/main/frontend/src/treasurehunt/ProbeHistory.tsx
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ */
+
+import { useStore } from 'wicket-islands-react';
+import { HOVER_STORE, type Cell, type ProbeOutcome } from './shared';
+import './ProbeHistory.css';
+
+/**
+ * The props of the history, as ProbeHistory.java's HistoryProps sends them.
+ */
+interface HistoryProps {
+       probes: ProbeOutcome[];
+}
+
+export default function ProbeHistory({ probes }: HistoryProps) {
+       const [hover, setHover] = useStore<Cell | null>(HOVER_STORE);
+
+       if (probes.length === 0) {
+               return <p className="probe-history empty">No probes yet.</p>;
+       }
+
+       return (
+               <ol className="probe-history" reversed>
+                       {probes.map(probe => {
+                               const highlighted = hover?.x === probe.x && 
hover?.y === probe.y;
+                               return (
+                                       <li key={`${probe.x},${probe.y}`} 
className={highlighted ? 'hover' : undefined}
+                                               data-x={probe.x} 
data-y={probe.y}
+                                               onMouseEnter={() => setHover({ 
x: probe.x, y: probe.y })}
+                                               onMouseLeave={() => 
setHover(null)}>
+                                               {probe.x}, {probe.y}: 
{probe.treasure ? 'treasure!' : `distance ${probe.distance}`}
+                                       </li>
+                               );
+                       })}
+               </ol>
+       );
+}
diff --git 
a/wicket-examples/src/main/frontend/src/treasurehunt/TreasureBoard.css 
b/wicket-examples/src/main/frontend/src/treasurehunt/TreasureBoard.css
index 6a283fc2a2..32d322e9f0 100644
--- a/wicket-examples/src/main/frontend/src/treasurehunt/TreasureBoard.css
+++ b/wicket-examples/src/main/frontend/src/treasurehunt/TreasureBoard.css
@@ -31,7 +31,7 @@
        cursor: pointer;
 }
 
-.treasure-board .cell:disabled {
+.treasure-board .cell[aria-disabled="true"] {
        cursor: default;
 }
 
@@ -60,3 +60,8 @@
 .treasure-board .message button {
        margin-left: 1em;
 }
+
+.treasure-board .cell.hover {
+       outline: 3px solid #333;
+       outline-offset: 1px;
+}
diff --git 
a/wicket-examples/src/main/frontend/src/treasurehunt/TreasureBoard.tsx 
b/wicket-examples/src/main/frontend/src/treasurehunt/TreasureBoard.tsx
index 32c9819011..aaf3663628 100644
--- a/wicket-examples/src/main/frontend/src/treasurehunt/TreasureBoard.tsx
+++ b/wicket-examples/src/main/frontend/src/treasurehunt/TreasureBoard.tsx
@@ -16,21 +16,12 @@
  */
 
 import { useState, type CSSProperties } from 'react';
-import { IslandCallError, useIsland } from 'wicket-islands-react';
+import { IslandCallError, useIsland, useStore } from 'wicket-islands-react';
+import { HOVER_STORE, type Cell, type ProbeOutcome } from './shared';
 import './TreasureBoard.css';
 
 type GameStatus = 'RUNNING' | 'WON' | 'LOST';
 
-interface Cell {
-       x: number;
-       y: number;
-}
-
-interface ProbeOutcome extends Cell {
-       treasure: boolean;
-       distance: number;
-}
-
 /**
  * The props of the board, as TreasureBoard.java's BoardProps sends them.
  */
@@ -59,6 +50,7 @@ export default function TreasureBoard({ width, height, 
status, probes, treasures
        const [pending, setPending] = useState<string | null>(null);
        const [message, setMessage] = useState<string | null>(null);
        const [expired, setExpired] = useState(false);
+       const [hover, setHover] = useStore<Cell | null>(HOVER_STORE);
 
        const probed = new Map(probes.map(outcome => [cellKey(outcome.x, 
outcome.y), outcome]));
        const treasureCells = new Set(treasures.map(treasure => 
cellKey(treasure.x, treasure.y)));
@@ -97,11 +89,16 @@ export default function TreasureBoard({ width, height, 
status, probes, treasures
                        if (pending === key) {
                                className += ' pending';
                        }
+                       if (hover && hover.x === x && hover.y === y) {
+                               className += ' hover';
+                       }
+                       const playable = running && !expired && outcome === 
undefined && pending === null;
                        cells.push(
                                <button key={key} type="button" 
className={className} style={style}
                                        data-x={x} data-y={y} aria-label={`Cell 
${x}, ${y}`}
-                                       disabled={!running || expired || 
outcome !== undefined || pending !== null}
-                                       onClick={() => void probe(x, y)}>
+                                       aria-disabled={!playable}
+                                       onClick={() => playable && void 
probe(x, y)}
+                                       onMouseEnter={() => setHover({ x, y })} 
onMouseLeave={() => setHover(null)}>
                                        {label}
                                </button>);
                }
diff --git 
a/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/TreasureHuntPage.css
 b/wicket-examples/src/main/frontend/src/treasurehunt/shared.ts
similarity index 71%
copy from 
wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/TreasureHuntPage.css
copy to wicket-examples/src/main/frontend/src/treasurehunt/shared.ts
index 4c20d623c7..da5390979e 100644
--- 
a/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/TreasureHuntPage.css
+++ b/wicket-examples/src/main/frontend/src/treasurehunt/shared.ts
@@ -14,12 +14,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-.treasure-game {
-       margin-top: 1em;
+
+/**
+ * What the Treasure Hunt islands share.
+ */
+
+export interface Cell {
+       x: number;
+       y: number;
 }
 
-.treasure-notice {
-       padding: 0.5em 1em;
-       border: 1px solid #c90;
-       background: #fff6e0;
+export interface ProbeOutcome extends Cell {
+       treasure: boolean;
+       distance: number;
 }
+
+/**
+ * The client store holding the cell highlighted on the board and in the 
history.
+ */
+export const HOVER_STORE = 'treasure-hover';
diff --git a/wicket-examples/src/main/frontend/vite.config.js 
b/wicket-examples/src/main/frontend/vite.config.js
index 2f349521c3..25e0074146 100644
--- a/wicket-examples/src/main/frontend/vite.config.js
+++ b/wicket-examples/src/main/frontend/vite.config.js
@@ -29,14 +29,18 @@ export default defineConfig({
                react(),
                wicketIslands({
                        islands: {
-                               'treasure-board': 
'src/treasurehunt/TreasureBoard.tsx'
+                               'treasure-board': 
'src/treasurehunt/TreasureBoard.tsx',
+                               'probe-history': 
'src/treasurehunt/ProbeHistory.tsx',
+                               'player-entry': 
'src/treasurehunt/PlayerEntryForm.tsx',
+                               'highscore-list': 
'src/treasurehunt/HighScoreList.tsx'
                        },
                        ...reactIslands
                })
        ],
        resolve: {
                // the island packages are linked from the Wicket source tree; 
their imports resolve here
-               dedupe: ['react', 'react-dom', 'wicket-islands']
+               dedupe: ['react', 'react-dom', 'wicket-islands', 
'@tanstack/query-core',
+                       '@tanstack/react-query']
        },
        server: {
                port: 5173,
diff --git 
a/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/Game.java
 
b/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/Game.java
index 86ff367ada..72a0d2e911 100644
--- 
a/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/Game.java
+++ 
b/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/Game.java
@@ -41,6 +41,8 @@ public class Game implements IClusterable
 
        private final List<ProbeOutcome> probes = new ArrayList<>();
 
+       private PlayerEntry savedBy;
+
        Game(BoardSize size, Set<Cell> treasures)
        {
                this.size = size;
@@ -140,6 +142,31 @@ public class Game implements IClusterable
                return Collections.unmodifiableList(probes);
        }
 
+       /**
+        * Records that the score of this game was saved for a player.
+        *
+        * @throws IllegalStateException
+        *             if the game is still running or its score was saved 
already
+        */
+       public void saveScore(PlayerEntry player)
+       {
+               if (getStatus() == GameStatus.RUNNING || savedBy != null)
+               {
+                       throw new IllegalStateException("The score of this game 
cannot be saved.");
+               }
+               savedBy = player;
+       }
+
+       public boolean isScoreSaved()
+       {
+               return savedBy != null;
+       }
+
+       public PlayerEntry getSavedBy()
+       {
+               return savedBy;
+       }
+
        /**
         * @return the treasures found while the game runs, all of them once it 
is over
         */
diff --git 
a/wicket-examples/src/main/frontend/src/treasurehunt/TreasureBoard.css 
b/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/HighScoreList.java
similarity index 51%
copy from wicket-examples/src/main/frontend/src/treasurehunt/TreasureBoard.css
copy to 
wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/HighScoreList.java
index 6a283fc2a2..f4d6a8cb3a 100644
--- a/wicket-examples/src/main/frontend/src/treasurehunt/TreasureBoard.css
+++ 
b/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/HighScoreList.java
@@ -14,49 +14,31 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-.treasure-board .grid {
-       display: grid;
-       gap: 2px;
-       margin: 1em 0;
-}
-
-.treasure-board .cell {
-       width: 2.2em;
-       height: 2.2em;
-       padding: 0;
-       border: 1px solid #888;
-       border-radius: 3px;
-       background: #e8e2d0;
-       font-weight: bold;
-       cursor: pointer;
-}
-
-.treasure-board .cell:disabled {
-       cursor: default;
-}
-
-.treasure-board .cell.probed {
-       color: #fff;
-}
+package org.apache.wicket.examples.islands.treasurehunt;
 
-.treasure-board .cell.found {
-       background: #f5c518;
-       color: #6b4f00;
-}
+import org.apache.wicket.islands.Island;
+import org.apache.wicket.model.IModel;
 
-.treasure-board .cell.missed {
-       background: #fff;
-       color: #c90;
-}
-
-.treasure-board .cell.pending {
-       background: #bbb;
-}
-
-.treasure-board .message {
-       color: #b00;
-}
-
-.treasure-board .message button {
-       margin-left: 1em;
+/**
+ * The high-score list, rendered by the React component 
<code>HighScoreList.tsx</code>. It fetches
+ * the scores itself through the page-less <code>scores</code> endpoint, and 
fetches them again
+ * when the server marks them as stale.
+ */
+public class HighScoreList extends Island<HighScoreList.ListProps>
+{
+       private static final long serialVersionUID = 1L;
+
+       /**
+        * @param size
+        *            the board size to list the scores of
+        */
+       public record ListProps(BoardSize size)
+       {
+       }
+
+       public HighScoreList(String id, IModel<BoardSize> size)
+       {
+               super(id, "highscore-list", size.map(ListProps::new));
+               usePageless("scores");
+       }
 }
diff --git 
a/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/HighScores.java
 
b/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/HighScores.java
new file mode 100644
index 0000000000..e4ee651ff2
--- /dev/null
+++ 
b/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/HighScores.java
@@ -0,0 +1,49 @@
+/*
+ * 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.wicket.examples.islands.treasurehunt;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.EnumMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * The best scores per board size, shared by every session of the application.
+ */
+public class HighScores
+{
+       private static final int KEPT = 10;
+
+       private final Map<BoardSize, List<Score>> scores = new 
EnumMap<>(BoardSize.class);
+
+       public synchronized void add(BoardSize size, Score score)
+       {
+               List<Score> list = scores.computeIfAbsent(size, unused -> new 
ArrayList<>());
+               list.add(score);
+               list.sort(Comparator.comparingInt(Score::score).reversed());
+               if (list.size() > KEPT)
+               {
+                       list.subList(KEPT, list.size()).clear();
+               }
+       }
+
+       public synchronized List<Score> top(BoardSize size)
+       {
+               return List.copyOf(scores.getOrDefault(size, List.of()));
+       }
+}
diff --git 
a/wicket-examples/src/main/frontend/src/treasurehunt/TreasureBoard.css 
b/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/PlayerEntry.java
similarity index 53%
copy from wicket-examples/src/main/frontend/src/treasurehunt/TreasureBoard.css
copy to 
wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/PlayerEntry.java
index 6a283fc2a2..565cef5006 100644
--- a/wicket-examples/src/main/frontend/src/treasurehunt/TreasureBoard.css
+++ 
b/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/PlayerEntry.java
@@ -14,49 +14,26 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-.treasure-board .grid {
-       display: grid;
-       gap: 2px;
-       margin: 1em 0;
-}
-
-.treasure-board .cell {
-       width: 2.2em;
-       height: 2.2em;
-       padding: 0;
-       border: 1px solid #888;
-       border-radius: 3px;
-       background: #e8e2d0;
-       font-weight: bold;
-       cursor: pointer;
-}
-
-.treasure-board .cell:disabled {
-       cursor: default;
-}
-
-.treasure-board .cell.probed {
-       color: #fff;
-}
-
-.treasure-board .cell.found {
-       background: #f5c518;
-       color: #6b4f00;
-}
-
-.treasure-board .cell.missed {
-       background: #fff;
-       color: #c90;
-}
-
-.treasure-board .cell.pending {
-       background: #bbb;
-}
+package org.apache.wicket.examples.islands.treasurehunt;
 
-.treasure-board .message {
-       color: #b00;
-}
+import java.io.Serializable;
+import java.util.List;
 
-.treasure-board .message button {
-       margin-left: 1em;
+/**
+ * The name and colour a player enters for the high-score list. It is the 
value of the
+ * <code>player-entry</code> form island, so it arrives from the browser and 
is validated before
+ * it is used.
+ *
+ * @param name
+ *            the player's name
+ * @param colour
+ *            the player's colour, one of {@link #PALETTE}
+ */
+public record PlayerEntry(String name, String colour) implements Serializable
+{
+       /**
+        * The colours a player can choose from.
+        */
+       public static final List<String> PALETTE = List.of("#e6194b", 
"#3cb44b", "#ffe119", "#4363d8",
+               "#f58231", "#911eb4");
 }
diff --git 
a/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/PlayerEntryField.java
 
b/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/PlayerEntryField.java
new file mode 100644
index 0000000000..83d7ad7472
--- /dev/null
+++ 
b/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/PlayerEntryField.java
@@ -0,0 +1,76 @@
+/*
+ * 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.wicket.examples.islands.treasurehunt;
+
+import java.io.Serializable;
+import java.util.List;
+
+import org.apache.wicket.islands.FormIsland;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.validation.IValidatable;
+import org.apache.wicket.validation.IValidator;
+import org.apache.wicket.validation.ValidationError;
+
+/**
+ * The player's name and colour, edited by the React component 
<code>PlayerEntryForm.tsx</code>
+ * and submitted with the Wicket form around it.
+ */
+public class PlayerEntryField extends FormIsland<PlayerEntry, 
PlayerEntryField.EntryProps>
+{
+       private static final long serialVersionUID = 1L;
+
+       /**
+        * @param palette
+        *            the colours to choose from
+        */
+       public record EntryProps(List<String> palette) implements Serializable
+       {
+       }
+
+       public PlayerEntryField(String id, IModel<PlayerEntry> model)
+       {
+               super(id, "player-entry", model, PlayerEntry.class,
+                       Model.of(new EntryProps(PlayerEntry.PALETTE)));
+               setRequired(true);
+               setLabel(Model.of("Your name"));
+               add(new EntryValidator());
+       }
+
+       /**
+        * Checks what the browser sent: a name of 2 to 20 characters and a 
colour of the palette.
+        */
+       private static class EntryValidator implements IValidator<PlayerEntry>
+       {
+               private static final long serialVersionUID = 1L;
+
+               @Override
+               public void validate(IValidatable<PlayerEntry> validatable)
+               {
+                       PlayerEntry entry = validatable.getValue();
+                       String name = entry.name() == null ? "" : 
entry.name().strip();
+                       if (name.length() < 2 || name.length() > 20)
+                       {
+                               validatable.error(new ValidationError("Enter a 
name of 2 to 20 characters."));
+                       }
+                       if (!PlayerEntry.PALETTE.contains(entry.colour()))
+                       {
+                               validatable.error(new ValidationError("Choose 
one of the colours."));
+                       }
+               }
+       }
+}
diff --git 
a/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/ProbeHistory.java
 
b/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/ProbeHistory.java
new file mode 100644
index 0000000000..3822a92a62
--- /dev/null
+++ 
b/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/ProbeHistory.java
@@ -0,0 +1,49 @@
+/*
+ * 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.wicket.examples.islands.treasurehunt;
+
+import java.util.List;
+
+import org.apache.wicket.islands.Island;
+import org.apache.wicket.model.IModel;
+
+/**
+ * The list of probes, rendered by the React component 
<code>ProbeHistory.tsx</code>. It has no
+ * calls of its own: the board's probe call sends it new props, and it shares 
the highlighted cell
+ * with the board through a client store, without involving the server.
+ */
+public class ProbeHistory extends Island<ProbeHistory.HistoryProps>
+{
+       private static final long serialVersionUID = 1L;
+
+       /**
+        * @param probes
+        *            the probes, newest first
+        */
+       public record HistoryProps(List<ProbeOutcome> probes)
+       {
+               static HistoryProps of(Game game)
+               {
+                       return new HistoryProps(game.getProbes().reversed());
+               }
+       }
+
+       public ProbeHistory(String id, IModel<Game> game)
+       {
+               super(id, "probe-history", game.map(HistoryProps::of));
+       }
+}
diff --git 
a/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/TreasureHuntPage.css
 
b/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/Score.java
similarity index 69%
copy from 
wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/TreasureHuntPage.css
copy to 
wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/Score.java
index 4c20d623c7..86ada9481c 100644
--- 
a/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/TreasureHuntPage.css
+++ 
b/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/Score.java
@@ -14,12 +14,20 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-.treasure-game {
-       margin-top: 1em;
-}
+package org.apache.wicket.examples.islands.treasurehunt;
+
+import java.io.Serializable;
 
-.treasure-notice {
-       padding: 0.5em 1em;
-       border: 1px solid #c90;
-       background: #fff6e0;
+/**
+ * An entry of the high-score list.
+ *
+ * @param name
+ *            the player's name
+ * @param colour
+ *            the player's colour
+ * @param score
+ *            the score
+ */
+public record Score(String name, String colour, int score) implements 
Serializable
+{
 }
diff --git 
a/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/ScorePanel.html
 
b/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/ScorePanel.html
new file mode 100644
index 0000000000..1d00b65be9
--- /dev/null
+++ 
b/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/ScorePanel.html
@@ -0,0 +1,17 @@
+<html xmlns:wicket="http://wicket.apache.org";>
+<body>
+<wicket:panel>
+       <div class="treasure-score">
+               <p>Your score: <strong wicket:id="score"></strong></p>
+               <div wicket:id="entry">
+                       <form wicket:id="form">
+                               <div wicket:id="feedback"></div>
+                               <div wicket:id="player"></div>
+                               <button wicket:id="save">Save my score</button>
+                       </form>
+               </div>
+               <p wicket:id="saved"></p>
+       </div>
+</wicket:panel>
+</body>
+</html>
diff --git 
a/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/ScorePanel.java
 
b/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/ScorePanel.java
new file mode 100644
index 0000000000..b74f0ca688
--- /dev/null
+++ 
b/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/ScorePanel.java
@@ -0,0 +1,118 @@
+/*
+ * 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.wicket.examples.islands.treasurehunt;
+
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.markup.html.form.AjaxButton;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.panel.FeedbackPanel;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+
+/**
+ * Shown when a game is over: a plain Wicket form with a form island for the 
player's name and
+ * colour, to put the score on the high-score list.
+ */
+public class ScorePanel extends Panel
+{
+       private static final long serialVersionUID = 1L;
+
+       private final IModel<Game> game;
+
+       public ScorePanel(String id, IModel<Game> game)
+       {
+               super(id);
+               this.game = game;
+               setOutputMarkupPlaceholderTag(true);
+
+               add(new Label("score", () -> game.getObject().getScore()));
+
+               WebMarkupContainer entry = new WebMarkupContainer("entry")
+               {
+                       private static final long serialVersionUID = 1L;
+
+                       @Override
+                       protected void onConfigure()
+                       {
+                               super.onConfigure();
+                               setVisible(!game.getObject().isScoreSaved());
+                       }
+               };
+               add(entry);
+
+               Form<Void> form = new Form<>("form");
+               entry.add(form);
+               FeedbackPanel feedback = new FeedbackPanel("feedback");
+               feedback.setOutputMarkupId(true);
+               form.add(feedback);
+               IModel<PlayerEntry> player = Model.of();
+               form.add(new PlayerEntryField("player", player));
+               form.add(new AjaxButton("save")
+               {
+                       private static final long serialVersionUID = 1L;
+
+                       @Override
+                       protected void onSubmit(AjaxRequestTarget target)
+                       {
+                               game.getObject().saveScore(player.getObject());
+                               onScoreSaved(target);
+                               target.add(ScorePanel.this);
+                       }
+
+                       @Override
+                       protected void onError(AjaxRequestTarget target)
+                       {
+                               target.add(feedback);
+                       }
+               });
+
+               add(new Label("saved", () -> {
+                       PlayerEntry saved = game.getObject().getSavedBy();
+                       return saved == null ? "" : "Saved for " + saved.name() 
+ ".";
+               })
+               {
+                       private static final long serialVersionUID = 1L;
+
+                       @Override
+                       protected void onConfigure()
+                       {
+                               super.onConfigure();
+                               setVisible(game.getObject().isScoreSaved());
+                       }
+               });
+       }
+
+       /**
+        * Called after the score of the game was saved.
+        *
+        * @param target
+        *            the Ajax request target
+        */
+       protected void onScoreSaved(AjaxRequestTarget target)
+       {
+       }
+
+       @Override
+       protected void onConfigure()
+       {
+               super.onConfigure();
+               setVisible(game.getObject().getStatus() != GameStatus.RUNNING);
+       }
+}
diff --git 
a/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/ScoresEndpoint.java
 
b/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/ScoresEndpoint.java
new file mode 100644
index 0000000000..5593cc5df1
--- /dev/null
+++ 
b/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/ScoresEndpoint.java
@@ -0,0 +1,54 @@
+/*
+ * 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.wicket.examples.islands.treasurehunt;
+
+import java.util.List;
+
+import org.apache.wicket.islands.IPagelessEndpoint;
+import org.apache.wicket.islands.PagelessCall;
+
+/**
+ * The page-less endpoint behind the high-score list. It reads 
application-wide data, so it needs
+ * no page: its calls run in parallel with the page's, without its lock.
+ */
+public class ScoresEndpoint implements 
IPagelessEndpoint<ScoresEndpoint.ScoreQuery, List<Score>>
+{
+       /**
+        * @param size
+        *            the board size to list the scores of
+        */
+       public record ScoreQuery(BoardSize size)
+       {
+       }
+
+       private final HighScores highScores;
+
+       public ScoresEndpoint(HighScores highScores)
+       {
+               this.highScores = highScores;
+       }
+
+       @Override
+       public List<Score> handle(ScoreQuery query, PagelessCall call)
+       {
+               if (query.size() == null)
+               {
+                       throw call.reject("Name a board size.");
+               }
+               return highScores.top(query.size());
+       }
+}
diff --git 
a/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/TreasureHuntApplication.java
 
b/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/TreasureHuntApplication.java
index a295733af8..02363e0578 100644
--- 
a/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/TreasureHuntApplication.java
+++ 
b/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/TreasureHuntApplication.java
@@ -16,9 +16,11 @@
  */
 package org.apache.wicket.examples.islands.treasurehunt;
 
+import org.apache.wicket.Application;
 import org.apache.wicket.Page;
 import org.apache.wicket.csp.CSPDirective;
 import org.apache.wicket.examples.WicketExampleApplication;
+import org.apache.wicket.islands.IPagelessAuthorization;
 import org.apache.wicket.islands.IslandSettings;
 
 /**
@@ -35,6 +37,18 @@ public class TreasureHuntApplication extends 
WicketExampleApplication
         */
        public static final String DEV_SERVER_PROPERTY = 
"wicket.islands.devServer";
 
+       private final HighScores highScores = new HighScores();
+
+       public static TreasureHuntApplication get()
+       {
+               return (TreasureHuntApplication)Application.get();
+       }
+
+       public HighScores getHighScores()
+       {
+               return highScores;
+       }
+
        @Override
        public Class<? extends Page> getHomePage()
        {
@@ -47,6 +61,9 @@ public class TreasureHuntApplication extends 
WicketExampleApplication
                super.init();
 
                IslandSettings islands = IslandSettings.install(this);
+               islands.getPagelessEndpoints()
+                       .register("scores", ScoresEndpoint.ScoreQuery.class, 
new ScoresEndpoint(highScores),
+                               IPagelessAuthorization.PERMIT_ALL);
 
                String devServer = System.getProperty(DEV_SERVER_PROPERTY);
                if (devServer != null && usesDevelopmentConfig())
diff --git 
a/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/TreasureHuntPage.css
 
b/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/TreasureHuntPage.css
index 4c20d623c7..3669dc5d3e 100644
--- 
a/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/TreasureHuntPage.css
+++ 
b/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/TreasureHuntPage.css
@@ -23,3 +23,17 @@
        border: 1px solid #c90;
        background: #fff6e0;
 }
+
+.treasure-playfield {
+       display: flex;
+       flex-wrap: wrap;
+       gap: 2em;
+       align-items: flex-start;
+}
+
+.treasure-layout {
+       display: flex;
+       flex-wrap: wrap;
+       gap: 3em;
+       align-items: flex-start;
+}
diff --git 
a/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/TreasureHuntPage.html
 
b/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/TreasureHuntPage.html
index 05b8c00046..d540d5008e 100644
--- 
a/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/TreasureHuntPage.html
+++ 
b/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/TreasureHuntPage.html
@@ -16,13 +16,20 @@
                <label>Board size <select wicket:id="size"></select></label>
        </form>
 
-       <div wicket:id="game" class="treasure-game">
-               <p>
-                       <span wicket:id="status"></span>
-                       Probes left: <span wicket:id="probesLeft"></span>.
-                       <a wicket:id="newGame" href="#">New game</a>
-               </p>
-               <div wicket:id="board"></div>
+       <div class="treasure-layout">
+               <div wicket:id="game" class="treasure-game">
+                       <p>
+                               <span wicket:id="status"></span>
+                               Probes left: <span 
wicket:id="probesLeft"></span>.
+                               <a wicket:id="newGame" href="#">New game</a>
+                       </p>
+                       <div class="treasure-playfield">
+                               <div wicket:id="board"></div>
+                               <div wicket:id="history"></div>
+                       </div>
+                       <div wicket:id="score"></div>
+               </div>
+               <div wicket:id="highScores"></div>
        </div>
 </wicket:extend>
 </body>
diff --git 
a/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/TreasureHuntPage.java
 
b/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/TreasureHuntPage.java
index bacbb08d82..91b2396335 100644
--- 
a/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/TreasureHuntPage.java
+++ 
b/wicket-examples/src/main/java/org/apache/wicket/examples/islands/treasurehunt/TreasureHuntPage.java
@@ -23,6 +23,7 @@ import 
org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
 import org.apache.wicket.ajax.markup.html.AjaxLink;
 import org.apache.wicket.examples.WicketExamplePage;
 import org.apache.wicket.islands.IslandSettings;
+import org.apache.wicket.islands.IslandTargets;
 import org.apache.wicket.islands.modules.ViteManifestModuleLoader;
 import org.apache.wicket.markup.head.CssHeaderItem;
 import org.apache.wicket.markup.head.IHeaderResponse;
@@ -53,6 +54,12 @@ public class TreasureHuntPage extends WicketExamplePage
 
        private final Label probesLeft;
 
+       private final ProbeHistory history;
+
+       private final ScorePanel scorePanel;
+
+       private final HighScoreList highScores;
+
        private TreasureBoard board;
 
        public TreasureHuntPage()
@@ -81,8 +88,25 @@ public class TreasureHuntPage extends WicketExamplePage
                status.setOutputMarkupId(true);
                probesLeft = new Label("probesLeft", () -> 
game.getObject().getProbesLeft());
                probesLeft.setOutputMarkupId(true);
-               board = new TreasureBoard("board", game, status, probesLeft);
-               gamePanel.add(status, probesLeft, board);
+               history = new ProbeHistory("history", game);
+               scorePanel = new ScorePanel("score", game)
+               {
+                       private static final long serialVersionUID = 1L;
+
+                       @Override
+                       protected void onScoreSaved(AjaxRequestTarget target)
+                       {
+                               Game saved = game.getObject();
+                               PlayerEntry player = saved.getSavedBy();
+                               TreasureHuntApplication.get()
+                                       .getHighScores()
+                                       .add(saved.getSize(),
+                                               new 
Score(player.name().strip(), player.colour(), saved.getScore()));
+                               IslandTargets.invalidate(target, "scores");
+                       }
+               };
+               board = new TreasureBoard("board", game, status, probesLeft, 
history, scorePanel);
+               gamePanel.add(status, probesLeft, history, scorePanel, board);
 
                gamePanel.add(new AjaxLink<Void>("newGame")
                {
@@ -96,6 +120,9 @@ public class TreasureHuntPage extends WicketExamplePage
                        }
                });
 
+               highScores = new HighScoreList("highScores", size);
+               add(highScores);
+
                add(new WebMarkupContainer("noBuild")
                {
                        private static final long serialVersionUID = 1L;
@@ -118,11 +145,12 @@ public class TreasureHuntPage extends WicketExamplePage
        private void changeSize(AjaxRequestTarget target)
        {
                game.setObject(Game.start(size.getObject()));
-               TreasureBoard newBoard = new TreasureBoard("board", game, 
status, probesLeft);
+               TreasureBoard newBoard = new TreasureBoard("board", game, 
status, probesLeft, history,
+                       scorePanel);
                newBoard.setMarkupId(board.getMarkupId());
                board.replaceWith(newBoard);
                board = newBoard;
-               target.add(newBoard, status, probesLeft);
+               target.add(newBoard, status, probesLeft, history, scorePanel, 
highScores);
        }
 
        private String getStatusText()

Reply via email to