You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@causeway.apache.org by "andi-huber (via GitHub)" <gi...@apache.org> on 2026/05/20 09:55:40 UTC

Re: [PR] CAUSEWAY-3997: [v2] Backport of Column Order Patching from v4 to v2 [causeway]

andi-huber commented on code in PR #3566:
URL: https://github.com/apache/causeway/pull/3566#discussion_r3272941738


##########
core/metamodel/src/main/java/org/apache/causeway/core/metamodel/specloader/specimpl/dflt/_MembersAsColumns.java:
##########
@@ -18,102 +18,118 @@
  */
 package org.apache.causeway.core.metamodel.specloader.specimpl.dflt;
 
-import static org.apache.causeway.applib.annotation.Where.PARENTED_TABLES;
-import static org.apache.causeway.applib.annotation.Where.STANDALONE_TABLES;
-
 import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Optional;
 import java.util.stream.Stream;
 
 import org.apache.causeway.applib.Identifier;
 import org.apache.causeway.applib.annotation.Where;
 import org.apache.causeway.applib.layout.component.PropertyLayoutData;
-import org.apache.causeway.applib.layout.grid.bootstrap.BSElement.BSElementVisitor;
-import org.apache.causeway.applib.layout.grid.bootstrap.BSGrid;
 import org.apache.causeway.applib.services.tablecol.TableColumnOrderService;
 import org.apache.causeway.applib.services.tablecol.TableColumnVisibilityService;
-import org.apache.causeway.commons.internal.base._NullSafe;
-import org.apache.causeway.commons.internal.collections._Lists;
-import org.apache.causeway.commons.internal.collections._Maps;
-import org.apache.causeway.core.metamodel.context.HasMetaModelContext;
+import org.apache.causeway.commons.collections.Can;
+import org.apache.causeway.commons.internal.functions._Predicates;
 import org.apache.causeway.core.metamodel.context.MetaModelContext;
+import org.apache.causeway.core.metamodel.facets.collections.layout.columnorder.ColumnOrderPatchingFacet;
 import org.apache.causeway.core.metamodel.facets.object.grid.GridFacet;
-import org.apache.causeway.core.metamodel.object.ManagedObject;
 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.ObjectAction;
 import org.apache.causeway.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.causeway.core.metamodel.util.WhereContexts;
+import org.apache.causeway.core.metamodel.spec.feature.ObjectAssociationContainer.ColumnQuery;
 import org.springframework.lang.NonNull;
 
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
-
-@RequiredArgsConstructor
-class _MembersAsColumns implements HasMetaModelContext {
-
-    @Getter(onMethod_ = {@Override})
-    private final MetaModelContext metaModelContext;
-
-    public final Stream<ObjectAction> streamActionsForColumnRendering(
+import lombok.experimental.Accessors;
+
+@RequiredArgsConstructor @Getter @Accessors(fluent = true)
+public class _MembersAsColumns {
+	
+	final boolean isColumnOrderPatchingEnabled;
+	final Can<TableColumnVisibilityService> tableColumnVisibilityServices;
+	final Can<TableColumnOrderService> tableColumnOrderServices;
+
+	_MembersAsColumns(final MetaModelContext mmc) {
+		this(
+				mmc.getSystemEnvironment().isPrototyping(),
+				mmc.getServiceRegistry().select(TableColumnVisibilityService.class),
+				mmc.getServiceRegistry().select(TableColumnOrderService.class));
+	}
+
+    public Stream<ObjectAction> streamActionsForColumnRendering(
             final ObjectSpecification elementType,
             final Identifier memberIdentifier) {
-        if(elementType.isValue()) return Stream.empty();
+        if(elementType.isValue())
+			return Stream.empty();
 
         return elementType.streamRuntimeActions(MixedIn.INCLUDED)
-            .filter(ObjectAction.Predicates.visibleAccordingToHiddenFacet(WhereContexts.collectionVariant(memberIdentifier)))
+            .filter(ObjectAction.Predicates.visibleAccordingToHiddenFacet(Where.STANDALONE_TABLES))

Review Comment:
   needs fixing: using STANDALONE always here is wrong
   
   also we cannot determine STANDALONE vs PARENTED from just the `Identifier` as we did previously; I believe we need the information explicitly



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@causeway.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org