This is an automated email from the ASF dual-hosted git repository.

doebele pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/empire-db.git


The following commit(s) were added to refs/heads/master by this push:
     new b9793ba5 EMPIREDB-461 JSF render value: omit unit for empty values
b9793ba5 is described below

commit b9793ba598d7ee0646fb979a1247446b2bb19a4c
Author: Rainer Döbele <[email protected]>
AuthorDate: Fri Apr 25 11:22:48 2025 +0200

    EMPIREDB-461
    JSF render value: omit unit for empty values
---
 .../empire/jsf2/controls/TextInputControl.java     | 57 +++-------------------
 1 file changed, 7 insertions(+), 50 deletions(-)

diff --git 
a/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextInputControl.java
 
b/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextInputControl.java
index e61abef4..7ef8aa5d 100644
--- 
a/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextInputControl.java
+++ 
b/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextInputControl.java
@@ -479,6 +479,13 @@ public class TextInputControl extends InputControl
     public void renderValue(Object value, ValueInfo vi, ResponseWriter writer)
         throws IOException
     {
+        boolean escapeHtml = !hasFormatOption(vi, "noescape"); 
+        String text = formatValue(value, vi, escapeHtml);
+        if (StringUtils.isEmpty(text))
+        {   // nothing
+            writer.append(HTML_EXPR_NBSP);
+            return;
+        }
         // append text
         super.renderValue(value, vi, writer);
         // unit?
@@ -490,56 +497,6 @@ public class TextInputControl extends InputControl
         }
     }
 
-    /*
-    @Override
-    public void renderInput(Response writer, ControlInfo ci)
-    {
-        HtmlTag input = writer.startTag("input");
-        input.addAttribute("type", "text");
-        input.addAttribute("id",    ci.getId());
-        input.addAttribute("class", ci.getCssClass());
-        input.addAttribute("style", ci.getCssStyle());
-        if (ci.getDisabled()==false)
-        {   // Name of the field
-            input.addAttribute("name", ci.getName());
-            // Get Max Length
-            int maxLength = getMaxInputLength(ci.getColumn());
-            if (maxLength>0)
-            {
-                input.addAttribute("maxlength", maxLength);
-                input.addAttribute("size", String.valueOf(Math.min(maxLength, 
ci.getHSize())));
-            }   
-        }
-        else
-        {   // Disabled text control
-            input.addAttribute("disabled");
-            // Get Max Length
-            int maxLength = getMaxInputLength(ci.getColumn());
-            if (maxLength>0)
-            {
-                input.addAttribute("size", String.valueOf(Math.min(maxLength, 
ci.getHSize())));
-            }   
-        }
-        // Value
-        input.addAttribute("value", formatValue(ci, ci.getDisabled()));
-        // Event Attributes
-        input.addAttribute("onclick",   ci.getOnclick());
-        input.addAttribute("onchange",  ci.getOnchange());
-        input.addAttribute("onfocus",   ci.getOnfocus());
-        input.addAttribute("onblur",    ci.getOnblur());
-        input.endTag();
-        // Add Unit
-        if (ci.getDisabled()==false)
-        {   
-            String unit = getUnitString(ci);
-            if (unit != null)
-            {   writer.print(" ");
-                writer.print(unit);
-            }
-        }
-    }
-    */
-
     // ------- Input Helpers -------
 
     protected int getMaxInputLength(InputInfo ii)

Reply via email to