You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2020/05/14 07:57:32 UTC

[isis] branch master updated: ISIS-2340: revert changes from last commit (too early to remove this hack)

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/isis.git


The following commit(s) were added to refs/heads/master by this push:
     new d50db9a  ISIS-2340: revert changes from last commit (too early to remove this hack)
d50db9a is described below

commit d50db9a1ee38d389d40c9056a31a9933004d202b
Author: Andi Huber <ah...@apache.org>
AuthorDate: Thu May 14 09:57:05 2020 +0200

    ISIS-2340: revert changes from last commit (too early to remove this
    hack)
---
 .../components/scalars/ScalarPanelAbstract2.java   | 44 +++++++++++++---------
 1 file changed, 26 insertions(+), 18 deletions(-)

diff --git a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelAbstract2.java b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelAbstract2.java
index 8015be2..e1372b8 100644
--- a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelAbstract2.java
+++ b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelAbstract2.java
@@ -117,24 +117,24 @@ implements ScalarModelSubscriber2 {
         NOTHING
     }
 
-//    /** this is a hack for the ScalarParameterModel, which does not support usability constraints in the model*/
-//    private transient Runnable postInit;
-//    @Deprecated // properly implement ScalarParameterModel
-//    public void postInit(@NonNull final FormPendingParamUiModel argAndConsents) {
-//        this.postInit = () ->{
-//            // visibility
-//            val visibilityConsent = argAndConsents.getVisibilityConsent();
-//            setVisible(visibilityConsent.isAllowed());
-//
-//            // usability
-//            val usabilityConsent = argAndConsents.getUsabilityConsent();
-//            if(usabilityConsent.isAllowed()) {
-//                onInitializeEditable();
-//            } else {
-//                onInitializeReadonly(usabilityConsent.getReason());
-//            }            
-//        }; 
-//    }
+    /** this is a hack for the ScalarParameterModel, which does not support usability constraints in the model*/
+    private transient Runnable postInit;
+    @Deprecated // properly implement ScalarParameterModel
+    public void postInit(@NonNull final FormPendingParamUiModel argAndConsents) {
+        this.postInit = () ->{
+            // visibility
+            val visibilityConsent = argAndConsents.getVisibilityConsent();
+            setVisible(visibilityConsent.isAllowed());
+
+            // usability
+            val usabilityConsent = argAndConsents.getUsabilityConsent();
+            if(usabilityConsent.isAllowed()) {
+                onInitializeEditable();
+            } else {
+                onInitializeReadonly(usabilityConsent.getReason());
+            }            
+        }; 
+    }
     
     /**
      *
@@ -268,6 +268,12 @@ implements ScalarModelSubscriber2 {
 
         final ScalarModel scalarModel = getModel();
 
+        if(postInit!=null) {
+            // ScalarParameterModel hack
+            postInit.run();
+            postInit=null;
+        } else {
+        
         final String disableReasonIfAny = scalarModel.whetherDisabled();
         final boolean mustBeEditable = scalarModel.mustBeEditable();
         if (disableReasonIfAny != null) {
@@ -283,6 +289,8 @@ implements ScalarModelSubscriber2 {
                 onInitializeEditable();
             }
         }
+        }
+
 
     }