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/12 07:11:56 UTC

[isis] branch master updated: ISIS-2361: make the workaround as side-effect free as possible

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 f9af986  ISIS-2361: make the workaround as side-effect free as possible
f9af986 is described below

commit f9af986b58eba8b2442ebe1212741a77b3d5c233
Author: Andi Huber <ah...@apache.org>
AuthorDate: Tue May 12 09:11:47 2020 +0200

    ISIS-2361: make the workaround as side-effect free as possible
---
 .../widgets/select2/Select2MultiChoiceExt.java         | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/select2/Select2MultiChoiceExt.java b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/select2/Select2MultiChoiceExt.java
index 668b65a..ecbd58b 100644
--- a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/select2/Select2MultiChoiceExt.java
+++ b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/select2/Select2MultiChoiceExt.java
@@ -20,7 +20,6 @@ package org.apache.isis.viewer.wicket.ui.components.widgets.select2;
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 
 import org.apache.wicket.model.IModel;
 import org.wicketstuff.select2.Select2MultiChoice;
@@ -48,6 +47,7 @@ implements ChoiceExt {
     }
 
     private final ObjectSpecId specId;
+    
 
     Select2MultiChoiceExt(
             final String id,
@@ -67,18 +67,28 @@ implements ChoiceExt {
         return specId;
     }
     
+    // -- bug in wicket 8.8.0 -------------------------------------------
+    
+    private boolean workaround;
     
     @Override
     public void updateModel() {
+        workaround = true;
         super.updateModel();
+        workaround = false;
     }
     
     @Override
     public Collection<ObjectMemento> getModelObject() {
         val modelObj = super.getModelObject();
-        return modelObj==null
-                ? Collections.emptyList() 
-                : new ArrayList<>(modelObj);
+        if(workaround) {
+            return modelObj==null
+                    ? null 
+                    : new ArrayList<>(modelObj);    
+        }
+        return modelObj;
     }
     
+    // ------------------------------------------------------------------
+    
 }