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 2022/03/03 13:56:49 UTC

[isis] branch master updated: ISIS-2877: don't require creation of both COMPACT and REGULAR components

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 5afa936  ISIS-2877: don't require creation of both COMPACT and REGULAR components
5afa936 is described below

commit 5afa93694224b167761c4d0f7c24e7507aba64bb
Author: Andi Huber <ah...@apache.org>
AuthorDate: Thu Mar 3 14:53:55 2022 +0100

    ISIS-2877: don't require creation of both COMPACT and REGULAR components
    
    - only one of these should be sufficient
---
 .../ui/components/scalars/ScalarPanelAbstract.java | 38 ++++++++++------------
 .../scalars/ScalarPanelSelectAbstract.java         |  2 --
 2 files changed, 17 insertions(+), 23 deletions(-)

diff --git a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelAbstract.java b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelAbstract.java
index 59ecf50..5c8727d 100644
--- a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelAbstract.java
+++ b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelAbstract.java
@@ -321,12 +321,26 @@ implements ScalarModelSubscriber {
         scalarTypeContainer = Wkt.containerAdd(this, ID_SCALAR_TYPE_CONTAINER);
         Wkt.cssAppend(scalarTypeContainer, getCssClassName());
 
-        componentIfRegular = createComponentForRegular();
-        componentIfCompact = createComponentForCompact();
+        switch(scalarModel.getRenderingHint()) {
+        case REGULAR:
+            componentIfRegular = createComponentForRegular();
+            componentIfCompact = Wkt.container(ID_SCALAR_IF_COMPACT); // empty component
+            componentIfRegular.setVisible(true);
+            componentIfCompact.setVisible(false);
+            break;
+        default:
+            componentIfRegular = Wkt.container(ID_SCALAR_IF_REGULAR); // empty component
+            componentIfCompact = createComponentForCompact();
+            componentIfRegular.setVisible(false);
+            componentIfCompact.setVisible(true);
+            Components.permanentlyHide(componentIfRegular, ID_SCALAR_NAME);
+            break;
+        }
 
         componentIfRegular.setOutputMarkupId(true); // enable as AJAX target
 
-        scalarTypeContainer.addOrReplace(componentIfCompact, componentIfRegular);
+        scalarTypeContainer.addOrReplace(componentIfCompact, componentIfRegular,
+                scalarIfRegularInlinePromptForm = createInlinePromptForm());
 
         // find associated actions for this scalar property (only properties will have any.)
         final ScalarModel.AssociatedActions associatedActions =
@@ -343,8 +357,6 @@ implements ScalarModelSubscriber {
         val inlinePromptConfig = getInlinePromptConfig();
         if(inlinePromptConfig.isSupported()) {
 
-            scalarTypeContainer
-                .addOrReplace(scalarIfRegularInlinePromptForm = createInlinePromptForm());
             componentIfRegular
                 .add(inlinePromptLink = createInlinePromptLink());
 
@@ -400,22 +412,6 @@ implements ScalarModelSubscriber {
         addEditPropertyTo(componentIfRegular);
         addFeedbackOnlyTo(componentIfRegular, getValidationFeedbackReceiver());
 
-        switch(scalarModel.getRenderingHint()) {
-        case REGULAR:
-            //componentIfRegular = createComponentForRegular();
-            //componentIfCompact = Wkt.container(ID_SCALAR_IF_COMPACT); // empty component
-            componentIfRegular.setVisible(true);
-            componentIfCompact.setVisible(false);
-            break;
-        default:
-            //componentIfRegular = Wkt.container(ID_SCALAR_IF_REGULAR); // empty component
-            //componentIfCompact = createComponentForCompact();
-            componentIfRegular.setVisible(false);
-            componentIfCompact.setVisible(true);
-            Components.permanentlyHide(componentIfRegular, ID_SCALAR_NAME);
-            break;
-        }
-
         addCssFromMetaModel();
 
         notifyOnChange(this);
diff --git a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelSelectAbstract.java b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelSelectAbstract.java
index 0f8c985..a351aad 100644
--- a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelSelectAbstract.java
+++ b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelSelectAbstract.java
@@ -24,7 +24,6 @@ import java.util.Optional;
 import org.apache.wicket.Component;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.markup.html.form.FormComponent;
 import org.apache.wicket.model.Model;
 import org.apache.wicket.validation.IValidatable;
@@ -38,7 +37,6 @@ import org.apache.isis.viewer.wicket.model.models.ScalarModel;
 import org.apache.isis.viewer.wicket.ui.components.widgets.bootstrap.FormGroup;
 import org.apache.isis.viewer.wicket.ui.components.widgets.select2.Select2;
 import org.apache.isis.viewer.wicket.ui.components.widgets.select2.providers.ObjectAdapterMementoProviderAbstract;
-import org.apache.isis.viewer.wicket.ui.util.Tooltips;
 import org.apache.isis.viewer.wicket.ui.util.Wkt;
 import org.apache.isis.viewer.wicket.ui.util.Wkt.EventTopic;