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/04/23 17:22:28 UTC
[PR] CAUSEWAY-3997: [Layout] In-memory Patching of Table Column Order [causeway]
andi-huber opened a new pull request, #3516:
URL: https://github.com/apache/causeway/pull/3516
- [ ] API Design
- [ ] Implement
- [ ] Test
Task-Url: https://issues.apache.org/jira/browse/CAUSEWAY-3997
--
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
Re: [PR] CAUSEWAY-3997: [Layout] In-memory Patching of Table Column Order [causeway]
Posted by "andi-huber (via GitHub)" <gi...@apache.org>.
andi-huber commented on PR #3516:
URL: https://github.com/apache/causeway/pull/3516#issuecomment-4469707769
closing ... not yet tested (de-scoped): table export, standalone tables
--
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
Re: [PR] CAUSEWAY-3997: [Layout] In-memory Patching of Table Column Order [causeway]
Posted by "andi-huber (via GitHub)" <gi...@apache.org>.
andi-huber commented on code in PR #3516:
URL: https://github.com/apache/causeway/pull/3516#discussion_r3218609582
##########
api/applib/src/main/java/org/apache/causeway/applib/services/columnorder/Object_patchColumnOrder.java:
##########
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.causeway.applib.services.columnorder;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+import jakarta.inject.Inject;
+
+import org.apache.causeway.applib.Identifier;
+import org.apache.causeway.applib.annotation.Action;
+import org.apache.causeway.applib.annotation.ActionLayout;
+import org.apache.causeway.applib.annotation.DomainObject;
+import org.apache.causeway.applib.annotation.Introspection;
+import org.apache.causeway.applib.annotation.MemberSupport;
+import org.apache.causeway.applib.annotation.Nature;
+import org.apache.causeway.applib.annotation.Optionality;
+import org.apache.causeway.applib.annotation.Parameter;
+import org.apache.causeway.applib.annotation.ParameterLayout;
+import org.apache.causeway.applib.annotation.PrecedingParamsPolicy;
+import org.apache.causeway.applib.annotation.Publishing;
+import org.apache.causeway.applib.annotation.RestrictTo;
+import org.apache.causeway.applib.annotation.SemanticsOf;
+import org.apache.causeway.applib.layout.LayoutConstants;
+import org.apache.causeway.applib.services.appfeat.ApplicationFeatureId;
+import org.apache.causeway.applib.services.appfeat.ApplicationFeatureRepository;
+import org.apache.causeway.applib.services.metamodel.MetaModelService;
+
+import lombok.RequiredArgsConstructor;
+
+/**
+ * Allows uploading of column order definition, that overrules the default lookup for such information.
+ *
+ * @since 4.0 {@index}
+ */
+@Action(
+ domainEvent = Object_patchColumnOrder.ActionDomainEvent.class,
+ semantics = SemanticsOf.IDEMPOTENT,
+ commandPublishing = Publishing.DISABLED,
+ executionPublishing = Publishing.DISABLED,
+ restrictTo = RestrictTo.PROTOTYPING)
+@ActionLayout(
+ cssClassFa = "solid file-arrow-up",
+ describedAs = "Uploads table column order, to be stored in memory for this object type. "
+ + "It overrules the default lookup. "
+ + "On application restart this information is lost.",
+ fieldSetId = LayoutConstants.FieldSetId.METADATA,
+ position = ActionLayout.Position.PANEL_DROPDOWN,
+ sequence = "700.2.4"
+)
+//framework provided domain objects and mixins should explicitly specify their introspection policy
+@DomainObject(nature=Nature.MIXIN, mixinMethod = "act", introspection = Introspection.ANNOTATION_REQUIRED)
+@RequiredArgsConstructor
+public class Object_patchColumnOrder {
+
+ public static class ActionDomainEvent
+ extends org.apache.causeway.applib.CausewayModuleApplib.ActionDomainEvent<Object_patchColumnOrder> {}
+
+ @Inject MetaModelService metaModelService;
+ @Inject ApplicationFeatureRepository applicationFeatureRepository;
+
+ private final Object mixee;
+
+ @MemberSupport public Object act(
Review Comment:
general open question: how to deal with cases, where the concrete domain-object is an instance of the table's element type, but not the exact same type?
we'd need another parameter, that reflects type inheritance and provides a means for users to make their element-type choice
--
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
Re: [PR] CAUSEWAY-3997: [Layout] In-memory Patching of Table Column Order [causeway]
Posted by "andi-huber (via GitHub)" <gi...@apache.org>.
andi-huber commented on code in PR #3516:
URL: https://github.com/apache/causeway/pull/3516#discussion_r3272979433
##########
core/metamodel/src/main/java/org/apache/causeway/core/metamodel/spec/impl/_MembersAsColumns.java:
##########
@@ -18,99 +18,113 @@
*/
package org.apache.causeway.core.metamodel.spec.impl;
+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.jspecify.annotations.NonNull;
+
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.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 static org.apache.causeway.applib.annotation.Where.PARENTED_TABLES;
-import static org.apache.causeway.applib.annotation.Where.STANDALONE_TABLES;
-
-import lombok.Getter;
-import org.jspecify.annotations.NonNull;
-import lombok.RequiredArgsConstructor;
+record _MembersAsColumns(
+ boolean isColumnOrderPatchingEnabled,
+ Can<TableColumnVisibilityService> tableColumnVisibilityServices,
+ Can<TableColumnOrderService> tableColumnOrderServices) {
-@RequiredArgsConstructor
-class _MembersAsColumns implements HasMetaModelContext {
+ _MembersAsColumns(final MetaModelContext mmc) {
+ this(
+ mmc.getSystemEnvironment().isPrototyping(),
+ mmc.getServiceRegistry().select(TableColumnVisibilityService.class),
+ mmc.getServiceRegistry().select(TableColumnOrderService.class));
+ }
- @Getter(onMethod_ = {@Override})
- private final MetaModelContext metaModelContext;
-
- public final Stream<ObjectAction> streamActionsForColumnRendering(
+ 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
Re: [PR] CAUSEWAY-3997: [Layout] In-memory Patching of Table Column Order [causeway]
Posted by "andi-huber (via GitHub)" <gi...@apache.org>.
andi-huber merged PR #3516:
URL: https://github.com/apache/causeway/pull/3516
--
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
Re: [PR] CAUSEWAY-3997: [Layout] In-memory Patching of Table Column Order [causeway]
Posted by "andi-huber (via GitHub)" <gi...@apache.org>.
andi-huber commented on code in PR #3516:
URL: https://github.com/apache/causeway/pull/3516#discussion_r3223874220
##########
api/applib/src/main/java/org/apache/causeway/applib/services/columnorder/Object_patchColumnOrder.java:
##########
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.causeway.applib.services.columnorder;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+import jakarta.inject.Inject;
+
+import org.apache.causeway.applib.Identifier;
+import org.apache.causeway.applib.annotation.Action;
+import org.apache.causeway.applib.annotation.ActionLayout;
+import org.apache.causeway.applib.annotation.DomainObject;
+import org.apache.causeway.applib.annotation.Introspection;
+import org.apache.causeway.applib.annotation.MemberSupport;
+import org.apache.causeway.applib.annotation.Nature;
+import org.apache.causeway.applib.annotation.Optionality;
+import org.apache.causeway.applib.annotation.Parameter;
+import org.apache.causeway.applib.annotation.ParameterLayout;
+import org.apache.causeway.applib.annotation.PrecedingParamsPolicy;
+import org.apache.causeway.applib.annotation.Publishing;
+import org.apache.causeway.applib.annotation.RestrictTo;
+import org.apache.causeway.applib.annotation.SemanticsOf;
+import org.apache.causeway.applib.layout.LayoutConstants;
+import org.apache.causeway.applib.services.appfeat.ApplicationFeatureId;
+import org.apache.causeway.applib.services.appfeat.ApplicationFeatureRepository;
+import org.apache.causeway.applib.services.metamodel.MetaModelService;
+
+import lombok.RequiredArgsConstructor;
+
+/**
+ * Allows uploading of column order definition, that overrules the default lookup for such information.
+ *
+ * @since 4.0 {@index}
+ */
+@Action(
+ domainEvent = Object_patchColumnOrder.ActionDomainEvent.class,
+ semantics = SemanticsOf.IDEMPOTENT,
+ commandPublishing = Publishing.DISABLED,
+ executionPublishing = Publishing.DISABLED,
+ restrictTo = RestrictTo.PROTOTYPING)
+@ActionLayout(
+ cssClassFa = "solid file-arrow-up",
+ describedAs = "Uploads table column order, to be stored in memory for this object type. "
+ + "It overrules the default lookup. "
+ + "On application restart this information is lost.",
+ fieldSetId = LayoutConstants.FieldSetId.METADATA,
+ position = ActionLayout.Position.PANEL_DROPDOWN,
+ sequence = "700.2.4"
+)
+//framework provided domain objects and mixins should explicitly specify their introspection policy
+@DomainObject(nature=Nature.MIXIN, mixinMethod = "act", introspection = Introspection.ANNOTATION_REQUIRED)
+@RequiredArgsConstructor
+public class Object_patchColumnOrder {
+
+ public static class ActionDomainEvent
+ extends org.apache.causeway.applib.CausewayModuleApplib.ActionDomainEvent<Object_patchColumnOrder> {}
+
+ @Inject MetaModelService metaModelService;
+ @Inject ApplicationFeatureRepository applicationFeatureRepository;
+
+ private final Object mixee;
+
+ @MemberSupport public Object act(
Review Comment:
redesign allows wildcards for PARENTED and type selection for STANDALONE
--
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
Re: [PR] CAUSEWAY-3997: [Layout] In-memory Patching of Table Column Order [causeway]
Posted by "andi-huber (via GitHub)" <gi...@apache.org>.
andi-huber commented on code in PR #3516:
URL: https://github.com/apache/causeway/pull/3516#discussion_r3218575556
##########
api/applib/src/main/java/org/apache/causeway/applib/services/metamodel/MetaModelService.java:
##########
@@ -166,13 +166,61 @@ enum Mode {
*
* @param config - restricts/filters to a subsets of the metamodel.
*/
- MetamodelDto exportMetaModel(final Config config);
+ MetamodelDto exportMetaModel(Config config);
/**
* Can be used to create object relation diagrams (e.g. Plantuml).
*
* @param filter by {@link BeanSort} and {@link LogicalType} what to include in the resulting graph
*/
- ObjectGraph exportObjectGraph(final @NonNull BiPredicate<BeanSort, LogicalType> filter);
+ ObjectGraph exportObjectGraph(@NonNull BiPredicate<BeanSort, LogicalType> filter);
+
+ /**
+ * Stream of {@link Identifier} representing the <i>Actions</i> of given domainType, including mixed-in ones,
+ * but excluding <i>Actions</i>, that are only available for PROTOTYPING.
+ * @since 4.0
+ */
+ Stream<Identifier> streamActions(@Nullable Class<?> domainType);
+
+ /**
+ * Stream of {@link Identifier} representing the <i>Properties</i> of given domainType, including mixed-in ones.
+ * @since 4.0
+ */
+ Stream<Identifier> streamProperties(@Nullable Class<?> domainType);
+
+ /**
+ * Stream of {@link Identifier} representing the <i>Collections</i> of given domainType, including mixed-in ones.
+ * @since 4.0
+ */
+ Stream<Identifier> streamCollections(@Nullable Class<?> domainType);
+
+ /**
+ * Stream of {@link Identifier} representing the <i>Columns</i> of given domainType and <i>Member</i> of interest.
+ *
+ * <p> Where columns returned are those that are in principle available. Also those are returned in no particular order.
+ *
+ * <p> If domainType is null returns an empty {@link Stream}.
+ *
+ * <p> Otherwise, if memberIdentifier is null returns <i>Columns</i> for the standalone table of element-type == domainType.
+ *
+ * @since 4.0
+ */
+ Stream<Identifier> streamAvailableAssociationsForColumnRendering(@Nullable Class<?> domainType, @Nullable Identifier memberIdentifier);
Review Comment:
Not totally happy with that yet, as
1. distinction between PARENTED and STANDALONE could be more explicit (separate methods)
2. column-order-txt feature supports identifier wildcards, which could be reflected by leaving the memberId empty here
(same applies to the next method below)
--
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