You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@causeway.apache.org by ah...@apache.org on 2023/06/27 05:18:59 UTC

[causeway] branch master updated: CAUSEWAY-3501: enables DataTableModel's detach

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

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


The following commit(s) were added to refs/heads/master by this push:
     new dc208ef38e CAUSEWAY-3501: enables DataTableModel's detach
dc208ef38e is described below

commit dc208ef38e8320872f2b05d13e36eab04998a991
Author: Andi Huber <ah...@apache.org>
AuthorDate: Tue Jun 27 07:18:54 2023 +0200

    CAUSEWAY-3501: enables DataTableModel's detach
---
 .../models/interaction/coll/DataTableModelWkt.java  | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/viewers/wicket/model/src/main/java/org/apache/causeway/viewer/wicket/model/models/interaction/coll/DataTableModelWkt.java b/viewers/wicket/model/src/main/java/org/apache/causeway/viewer/wicket/model/models/interaction/coll/DataTableModelWkt.java
index 5b2edabd5b..dc357ac1c7 100644
--- a/viewers/wicket/model/src/main/java/org/apache/causeway/viewer/wicket/model/models/interaction/coll/DataTableModelWkt.java
+++ b/viewers/wicket/model/src/main/java/org/apache/causeway/viewer/wicket/model/models/interaction/coll/DataTableModelWkt.java
@@ -126,19 +126,22 @@ implements
 
     @Override
     public final void detach() {
-        /* in support of table sorting, don't detach; instead reuse the already populated model;
-         * however, for troubleshooting allows detaching */
-        if(isDetachEnabled()) {
-            super.detach();
-        }
+        if(isDataTableModelReuse()) return;
+        super.detach();
     }
 
     // -- HELPER
 
-    private final static String PROPERTY_NAME_DETACH_ENABLED = "causeway.viewer.wicket.dataTableModelDetachEnabled";
-    private static boolean isDetachEnabled() {
-        return "true".equalsIgnoreCase(System.getenv(PROPERTY_NAME_DETACH_ENABLED))
-                || "true".equalsIgnoreCase(System.getProperty(PROPERTY_NAME_DETACH_ENABLED));
+    private final static String PROPERTY_NAME_MODEL_REUSE = "causeway.viewer.wicket.dataTableModelReuse";
+    /**
+     * experimental, undocumented feature:
+     * <p>
+     * when enabled, in support of optimized table sorting, don't detach;
+     * instead reuse the already populated model
+     */
+    private static boolean isDataTableModelReuse() {
+        return "true".equalsIgnoreCase(System.getenv(PROPERTY_NAME_MODEL_REUSE))
+                || "true".equalsIgnoreCase(System.getProperty(PROPERTY_NAME_MODEL_REUSE));
     }
 
 }