This is an automated email from the ASF dual-hosted git repository. danhaywood pushed a commit to branch CAUSEWAY-3575 in repository https://gitbox.apache.org/repos/asf/causeway.git
commit fe71cba133ce3a8e42f370bef355a609f1222b6e Author: danhaywood <[email protected]> AuthorDate: Thu Sep 28 15:28:32 2023 +0100 CAUSEWAY-3575: adds unbound/missing properties or collections in alphabetical order rather than according to their sequence. Because the sequence (independent of its group) is hard to reason about --- .../grid/bootstrap/GridSystemServiceBootstrap.java | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/services/grid/bootstrap/GridSystemServiceBootstrap.java b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/services/grid/bootstrap/GridSystemServiceBootstrap.java index f64e3d0d96..74366d7403 100644 --- a/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/services/grid/bootstrap/GridSystemServiceBootstrap.java +++ b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/services/grid/bootstrap/GridSystemServiceBootstrap.java @@ -18,8 +18,10 @@ */ package org.apache.causeway.core.metamodel.services.grid.bootstrap; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.Collections; import java.util.List; import java.util.Optional; import java.util.Set; @@ -311,9 +313,16 @@ extends GridSystemServiceAbstract<BSGrid> { val fieldSet = gridModel.getFieldSetForUnreferencedPropertiesRef(); if(fieldSet != null) { unboundPropertyIds.removeAll(unboundMetadataContributingIds); + + // add unbound properties alphabetically to fieldset + List<String> sortedUnboundPropertyIds = + unboundPropertyIds.stream() + .sorted() + .collect(Collectors.toList()); + addPropertiesTo( fieldSet, - unboundPropertyIds, + sortedUnboundPropertyIds, layoutDataFactory::createPropertyLayoutData, propertyLayoutDataById::put); } @@ -331,13 +340,12 @@ extends GridSystemServiceAbstract<BSGrid> { } if(!missingCollectionIds.isEmpty()) { - final List<OneToManyAssociation> sortedCollections = - _Lists.map(missingCollectionIds, oneToManyAssociationById::get); - - sortedCollections.sort(ObjectMember.Comparators.byMemberOrderSequence(false)); + // add missing collections alphabetically to either tab group or column final List<String> sortedMissingCollectionIds = - _Lists.map(sortedCollections, ObjectAssociation::getId); + missingCollectionIds.stream() + .sorted() + .collect(Collectors.toList()); final BSTabGroup bsTabGroup = gridModel.getTabGroupForUnreferencedCollectionsRef(); if(bsTabGroup != null) {
