This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/causeway.git
The following commit(s) were added to refs/heads/master by this push:
new 0ceeb00b99 CAUSEWAY-3355: fixes collection handling within grid layout
0ceeb00b99 is described below
commit 0ceeb00b99a081aed1265a802ba2de0a1aa9538d
Author: Andi Huber <[email protected]>
AuthorDate: Thu Feb 9 14:02:54 2023 +0100
CAUSEWAY-3355: fixes collection handling within grid layout
- using a LinkedHasMap instead of a HashMap does the trick to preserve
the order of appearance within layout.xml resources
---
.../viewer/wicket/ui/components/layout/bs/col/Col.java | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git
a/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/layout/bs/col/Col.java
b/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/layout/bs/col/Col.java
index 536406eafd..5cd98364d0 100644
---
a/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/layout/bs/col/Col.java
+++
b/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/layout/bs/col/Col.java
@@ -18,9 +18,8 @@
*/
package org.apache.causeway.viewer.wicket.ui.components.layout.bs.col;
+import java.util.LinkedHashMap;
import java.util.List;
-import java.util.Map;
-import java.util.function.UnaryOperator;
import java.util.stream.Collectors;
import org.apache.wicket.Component;
@@ -236,11 +235,12 @@ implements HasDynamicallyVisibleContent {
val ownerSpec = entityModel.getManagedObject().getSpecification();
// collection layout data by collection id (the collection's member-id)
- final Map<String, CollectionLayoutData> collectionLayoutById =
- _NullSafe.stream(bsCol.getCollections())
- .filter(collectionLayoutData ->
collectionLayoutData.getMetadataError() == null)
- .filter(collectionLayoutData ->
!ownerSpec.getCollection(collectionLayoutData.getId()).isEmpty())
-
.collect(Collectors.toUnmodifiableMap(CollectionLayoutData::getId,
UnaryOperator.identity()));
+ // preserving order, as order matters
+ val collectionLayoutById = new LinkedHashMap<String,
CollectionLayoutData>();
+ _NullSafe.stream(bsCol.getCollections())
+ .filter(colLayoutData->colLayoutData.getMetadataError() == null)
+
.filter(colLayoutData->!ownerSpec.getCollection(colLayoutData.getId()).isEmpty())
+
.forEach(colLayoutData->collectionLayoutById.put(colLayoutData.getId(),
colLayoutData));
if(!collectionLayoutById.isEmpty()) {
final RepeatingViewWithDynamicallyVisibleContent collectionRv =