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


##########
viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/collectioncontents/ajaxtable/columns/ActionColumn.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.viewer.wicket.ui.components.collectioncontents.ajaxtable.columns;
+
+import java.util.Optional;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.model.IModel;
+import org.springframework.lang.NonNull;
+import org.apache.causeway.applib.Identifier;
+import org.apache.causeway.applib.annotation.Where;
+import org.apache.causeway.commons.collections.Can;
+import org.apache.causeway.core.metamodel.spec.ObjectSpecification;
+import org.apache.causeway.core.metamodel.spec.feature.ObjectAction;
+import org.apache.causeway.core.metamodel.tabular.interactive.DataRow;
+import org.apache.causeway.viewer.wicket.model.models.ActionModel;
+import 
org.apache.causeway.viewer.wicket.model.models.ActionModel.ColumnActionModifier;
+import org.apache.causeway.viewer.wicket.model.models.UiObjectWkt;
+import 
org.apache.causeway.viewer.wicket.model.models.interaction.coll.DataRowWkt;
+import 
org.apache.causeway.viewer.wicket.model.models.EntityCollectionModel.Variant;
+import 
org.apache.causeway.viewer.wicket.ui.components.actionmenu.entityactions.ActionLinksPanel;
+import org.apache.causeway.viewer.wicket.ui.util.Wkt;
+
+public final class ActionColumn
+extends GenericColumnAbstract {
+
+    private static final long serialVersionUID = 1L;
+
+    public static Optional<ActionColumn> create(
+            final @NonNull Identifier featureId,
+            final @NonNull ObjectSpecification elementType,
+            final @NonNull Variant collectionVariant) {
+       //BACKPORT skipped
+       //var wktConfig = 
elementType.getMetaModelContext().getConfiguration().getViewer().getWicket();
+        //if(!wktConfig.isActionColumnEnabled()) return Optional.empty();
+       //----
+
+        var actions = elementType.streamActionsForColumnRendering(featureId)
+                .collect(Can.toCan());
+        if(actions.isEmpty()) return Optional.empty();
+
+        return Optional.of(new ActionColumn(elementType, actions, 
collectionVariant));
+    }
+
+    private final Can<String> actionIds;
+    private transient Can<ObjectAction> actions;
+    private final Variant collectionVariant;
+
+    private ActionColumn(
+            final ObjectSpecification elementType,
+            final Can<ObjectAction> actionsForColumnRendering,
+            final Variant collectionVariant) {
+        super(elementType, "Actions");
+        this.actions = actionsForColumnRendering;
+        this.actionIds = actions.map(ObjectAction::getId);
+        this.collectionVariant = collectionVariant;
+    }
+
+    @Override
+    protected Component createCellComponent(
+            final String componentId, final DataRow dataRow, IModel<Boolean> 
dataRowToggle) {
+       
+        //var dataRow = dataRowWkt.getObject();
+        var rowElement = dataRow.getRowElement();
+
+        var objectModel = UiObjectWkt.ofAdapter(rowElement);
+        var elementType = elementType();
+
+//TODO BACKPORT ...        

Review Comment:
   blocked by backport of `ActionModel` refactoring



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to