|
52 | 52 | import java.io.IOException; |
53 | 53 | import java.io.OutputStream; |
54 | 54 | import java.io.Serializable; |
55 | | -import java.util.*; |
| 55 | +import java.util.ArrayList; |
| 56 | +import java.util.Iterator; |
| 57 | +import java.util.LinkedHashMap; |
| 58 | +import java.util.List; |
| 59 | +import java.util.Map; |
| 60 | +import java.util.Random; |
56 | 61 | import java.util.stream.Collectors; |
57 | 62 | import java.util.stream.IntStream; |
58 | 63 |
|
@@ -111,12 +116,17 @@ private void defineMPVersionValue() { |
111 | 116 |
|
112 | 117 | private void defineExampleSpecs(MicroProfileVersion version) { |
113 | 118 | specs = new ArrayList<>(); |
| 119 | + List<String> currentSelected = new ArrayList<>(selectedSpecs); |
114 | 120 | selectedSpecs.clear(); |
115 | 121 |
|
116 | 122 | for (MicroprofileSpec microprofileSpec : MicroprofileSpec.values()) { |
117 | 123 | if (microprofileSpec.getMpVersions().contains(version)) { |
118 | 124 | specs.add(new SelectItem(microprofileSpec.getCode(), microprofileSpec.getLabel())); |
119 | | - selectedSpecs.add(microprofileSpec.getCode()); |
| 125 | + if (currentSelected.contains(microprofileSpec.getCode())) { |
| 126 | + // If the spec is currently selected, keep it selected. |
| 127 | + // But if it is not listed anymore in the MP version, it has to go. |
| 128 | + selectedSpecs.add(microprofileSpec.getCode()); |
| 129 | + } |
120 | 130 | } |
121 | 131 | } |
122 | 132 |
|
@@ -247,4 +257,11 @@ public void setSelectedSpecs(List<String> selectedSpecs) { |
247 | 257 | this.selectedSpecs = selectedSpecs; |
248 | 258 | } |
249 | 259 |
|
| 260 | + public void selectAll() { |
| 261 | + selectedSpecs = specs.stream().map(si -> si.getValue().toString()).collect(Collectors.toList()); |
| 262 | + } |
| 263 | + |
| 264 | + public void unselectAll() { |
| 265 | + selectedSpecs.clear(); |
| 266 | + } |
250 | 267 | } |
0 commit comments