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

ahuber pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/causeway.git


The following commit(s) were added to refs/heads/main by this push:
     new 0b7555c9f12 CAUSEWAY-3630: DataTable column order respecting 
member-order from layout
0b7555c9f12 is described below

commit 0b7555c9f128863e56ebf97b74723f2e1b658b77
Author: andi-huber <[email protected]>
AuthorDate: Sat Feb 21 08:00:55 2026 +0100

    CAUSEWAY-3630: DataTable column order respecting member-order from
    layout
    
    - this provides a natural means for controlling column order in
    DataTable serialization e.g. yaml (useful when data processing needs a
    certain desired column order)
---
 .../causeway/core/metamodel/tabular/simple/DataTable.java      | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git 
a/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/tabular/simple/DataTable.java
 
b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/tabular/simple/DataTable.java
index 6c644477a67..3556289c1bd 100644
--- 
a/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/tabular/simple/DataTable.java
+++ 
b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/tabular/simple/DataTable.java
@@ -25,6 +25,7 @@
 import java.util.function.Predicate;
 import java.util.stream.Stream;
 
+import org.jspecify.annotations.NonNull;
 import org.jspecify.annotations.Nullable;
 
 import org.apache.causeway.applib.annotation.Where;
@@ -47,11 +48,10 @@
 import org.apache.causeway.core.metamodel.spec.ObjectSpecification;
 import org.apache.causeway.core.metamodel.spec.feature.MixedIn;
 import org.apache.causeway.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.causeway.core.metamodel.spec.feature.ObjectMember;
 import org.apache.causeway.core.metamodel.spec.feature.OneToOneAssociation;
 import org.apache.causeway.core.metamodel.util.Facets;
 
-import org.jspecify.annotations.NonNull;
-
 /**
  * Represents a collection of domain objects (typically entity instances).
  *
@@ -109,6 +109,7 @@ public DataTable(
                 elementType.getSingularName(),
                 elementType
                     .streamProperties(MixedIn.EXCLUDED)
+                    .sorted(ObjectMember.byMemberOrderSequence(false))
                     .collect(Can.toCan()),
                 Can.empty());
     }
@@ -129,6 +130,7 @@ public DataTable(
                 elementType
                     .streamAssociations(MixedIn.INCLUDED)
                     
.filter(Optional.ofNullable(columnFilter).orElseGet(_Predicates::alwaysTrue))
+                    .sorted(ObjectMember.byMemberOrderSequence(false))
                     .collect(Can.toCan()),
                 Can.empty());
     }
@@ -204,7 +206,7 @@ public DataTable withDataElementsFrom(final @Nullable 
DataTable otherTable) {
      */
     public DataTable withDataElements(final @Nullable Iterable<ManagedObject> 
dataElements) {
         var newDataRows = Can.ofIterable(dataElements)
-            .map(domainObject->new DataRow(domainObject));
+            .map(DataRow::new);
         return new DataTable(elementType, dataColumns, newDataRows, 
tableFriendlyName);
     }
     /**
@@ -327,7 +329,7 @@ public final static Predicate<ObjectAssociation> 
columnFilterExcludingMixins() {
 
     public final static Predicate<ObjectAssociation> 
columnFilterIncludingEnabledForSnapshot() {
         return (final ObjectAssociation assoc) -> 
_Casts.castTo(OneToOneAssociation.class, assoc)
-                .map(prop->prop.isIncludedWithSnapshots())
+                .map(OneToOneAssociation::isIncludedWithSnapshots)
                 .orElse(false);
     }
 

Reply via email to