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/09/11 09:32:39 UTC

[causeway] branch master updated: CAUSEWAY-3566: code quality: make TextMode default explicit

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 b68ab14ce2 CAUSEWAY-3566: code quality: make TextMode default explicit
b68ab14ce2 is described below

commit b68ab14ce2a512f250549529d28c4ccb4f305055
Author: Andi Huber <ah...@apache.org>
AuthorDate: Mon Sep 11 11:32:35 2023 +0200

    CAUSEWAY-3566: code quality: make TextMode default explicit
---
 .../java/org/apache/causeway/core/config/CausewayConfiguration.java  | 2 +-
 .../java/org/apache/causeway/core/config/viewer/web/TextMode.java    | 2 ++
 .../java/org/apache/causeway/viewer/wicket/ui/util/WktTooltips.java  | 5 ++---
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/core/config/src/main/java/org/apache/causeway/core/config/CausewayConfiguration.java b/core/config/src/main/java/org/apache/causeway/core/config/CausewayConfiguration.java
index 5fc719bdd8..27094f36cb 100644
--- a/core/config/src/main/java/org/apache/causeway/core/config/CausewayConfiguration.java
+++ b/core/config/src/main/java/org/apache/causeway/core/config/CausewayConfiguration.java
@@ -2420,7 +2420,7 @@ public class CausewayConfiguration {
             /**
              * How to interpret tooltip content, e.g. as HTML or TEXT. default = TEXT
              */
-            private TextMode tooltipTextMode = TextMode.TEXT;
+            private TextMode tooltipTextMode = TextMode.defaults();
 
             /**
              * Whether to show an indicator for a form submit button that it has been clicked.
diff --git a/core/config/src/main/java/org/apache/causeway/core/config/viewer/web/TextMode.java b/core/config/src/main/java/org/apache/causeway/core/config/viewer/web/TextMode.java
index b7bde47239..01c6443bb7 100644
--- a/core/config/src/main/java/org/apache/causeway/core/config/viewer/web/TextMode.java
+++ b/core/config/src/main/java/org/apache/causeway/core/config/viewer/web/TextMode.java
@@ -28,6 +28,8 @@ public enum TextMode {
      */
     HTML;
 
+    public static TextMode defaults() { return TEXT; }
+
     public boolean isText() { return this == TEXT; }
     public boolean isHtml() { return this == HTML; }
 }
\ No newline at end of file
diff --git a/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/util/WktTooltips.java b/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/util/WktTooltips.java
index 526012d57a..b36dd89591 100644
--- a/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/util/WktTooltips.java
+++ b/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/util/WktTooltips.java
@@ -206,7 +206,6 @@ public class WktTooltips {
     private TextMode getTooltipTextMode() {
         val textMode = Optional.ofNullable(WktContext.getMetaModelContext())
                 .map(mmc->mmc.getConfiguration().getViewer().getWicket().getTooltipTextMode())
-                .orElse(TextMode.TEXT);
-        return textMode;
-    }
+                .orElseGet(TextMode::defaults);
+        return textMode;    }
 }