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 f52ebfd7d3 CAUSEWAY-3727: proposed fix for select2 disabling
f52ebfd7d3 is described below

commit f52ebfd7d3ec9d23fa009795407773b26a089d94
Author: andi-huber <[email protected]>
AuthorDate: Thu Apr 25 17:53:22 2024 +0200

    CAUSEWAY-3727: proposed fix for select2 disabling
---
 .../components/scalars/ScalarPanelFormFieldAbstract.java  | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git 
a/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/scalars/ScalarPanelFormFieldAbstract.java
 
b/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/scalars/ScalarPanelFormFieldAbstract.java
index a66b6a58cf..59378ab4fa 100644
--- 
a/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/scalars/ScalarPanelFormFieldAbstract.java
+++ 
b/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/scalars/ScalarPanelFormFieldAbstract.java
@@ -212,18 +212,14 @@ extends ScalarPanelAbstract2 {
             //keep inlinePromptLink (if any) enabled
             getFormComponent().setEnabled(false);
         }
-        if(getWicketViewerSettings().isReplaceDisabledTagWithReadonlyTag()) {
-            
Wkt.behaviorAddReplaceDisabledTagWithReadonlyTag(getFormComponent());
-        }
+        replaceDisabledTagWithReadonlyTagIfApplicable();
         clearTooltip();
     }
 
     @Override
     protected void onInitializeReadonly(final String disableReason) {
         formComponentEnable(false);
-        if(getWicketViewerSettings().isReplaceDisabledTagWithReadonlyTag()) {
-            
Wkt.behaviorAddReplaceDisabledTagWithReadonlyTag(getFormComponent());
-        }
+        replaceDisabledTagWithReadonlyTagIfApplicable();
         setTooltip(disableReason);
     }
 
@@ -276,4 +272,11 @@ extends ScalarPanelAbstract2 {
         WktTooltips.clearTooltip(getFormComponent());
         WktTooltips.clearTooltip(inlinePromptLink);
     }
+    
+    private void replaceDisabledTagWithReadonlyTagIfApplicable() {
+        if(!getWicketViewerSettings().isReplaceDisabledTagWithReadonlyTag()) 
return;
+        //[CAUSEWAY-3727] select2 does not seem to support this replacement 
behavior
+        if(this instanceof ScalarPanelSelectAbstract) return;
+        Wkt.behaviorAddReplaceDisabledTagWithReadonlyTag(getFormComponent());
+    }
 }

Reply via email to