WIP
authorKai Moritz <kai@juplo.de>
Tue, 21 Jan 2020 19:15:06 +0000 (20:15 +0100)
committerKai Moritz <kai@juplo.de>
Fri, 7 Apr 2023 11:21:44 +0000 (13:21 +0200)
pom.xml
src/main/java/de/juplo/demo/Form.java
src/main/resources/templates/form.html

diff --git a/pom.xml b/pom.xml
index 982eb2f..826a489 100644 (file)
--- a/pom.xml
+++ b/pom.xml
                        <groupId>io.projectreactor</groupId>
                        <artifactId>reactor-test</artifactId>
                        <scope>test</scope>
+    </dependency>
+
+               <dependency>
+                       <groupId>org.springframework.boot</groupId>
+                       <artifactId>spring-boot-devtools</artifactId>
+                       <optional>true</optional>
                </dependency>
 
                <dependency>
index 382c335..7dceac3 100644 (file)
@@ -1,7 +1,9 @@
 package de.juplo.demo;
 
 
+import java.util.HashMap;
 import java.util.Map;
+import java.util.TreeMap;
 
 
 /**
@@ -10,8 +12,8 @@ import java.util.Map;
  */
 public class Form
 {
-  Map<Integer, Map<String, Boolean>> cards;
-  Map<Integer, String> row;
+  Map<Integer, Map<String, Boolean>> cards = new TreeMap<>();
+  Map<Integer, String> row = new HashMap<>();
 
 
   public Map<Integer, Map<String, Boolean>> getCards()
index 586a812..b1f53d8 100644 (file)
     </nav>
     <main class="container mt-5">
       <form action="#" th:action="@{/}" th:object="${form}" method="get">
-        <div class="card" th:each="card : *{cards.rowSet()}">
+        <div class="card" th:each="card : *{cards.entrySet()}">
           <div class="card-header"><h1 th:text="|Card #${card.key}|">Card #X</h1></div>
           <div class="card-body">
             <div class="card-text">
-              <div class="form-group" th:each="row : ${card.value.rowSet()}">
+              <div class="form-group" th:each="row : ${card.value.entrySet()}">
                 <input type="checkbox" id="x" class="form-control" th:field="*{cards[__${card.key}__][__${row.key}__]}" />
                 <label for="x" th:for="${#ids.prev('cards[__${card.key}__][__${row.key}__]')}" th:text="${row.value}">ROW_NAME</label>
                 <button type="submit" name="removeRow" class="btn btn-primary" th:value="|${card.key}:${row.key}|">Remove</button>