You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@empire-db.apache.org by do...@apache.org on 2026/05/22 08:55:03 UTC
(empire-db) branch master updated: EMPIREDB-493 ControlTag: allow label change with update rendering
This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits 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 12f3a964 EMPIREDB-493 ControlTag: allow label change with update rendering
12f3a964 is described below
commit 12f3a9645ed0b14068d7e0f2814754a7123ebdfa
Author: Rainer Döbele <do...@apache.org>
AuthorDate: Fri May 22 10:54:59 2026 +0200
EMPIREDB-493
ControlTag: allow label change with update rendering
---
.../empire/jakarta/utils/TagEncodingHelper.java | 40 +++++++++++++++++-----
.../empire/jsf2/utils/TagEncodingHelper.java | 40 +++++++++++++++++-----
2 files changed, 62 insertions(+), 18 deletions(-)
diff --git a/empire-db-jakarta-faces/src/main/java/org/apache/empire/jakarta/utils/TagEncodingHelper.java b/empire-db-jakarta-faces/src/main/java/org/apache/empire/jakarta/utils/TagEncodingHelper.java
index 961f27ac..9bd44d89 100644
--- a/empire-db-jakarta-faces/src/main/java/org/apache/empire/jakarta/utils/TagEncodingHelper.java
+++ b/empire-db-jakarta-faces/src/main/java/org/apache/empire/jakarta/utils/TagEncodingHelper.java
@@ -1734,9 +1734,13 @@ public class TagEncodingHelper implements NamingContainer
label=column.getTitle();
// translate
label = getDisplayText(column, label);
- }
+ }
+ else if (label.endsWith(":"))
+ { // already has a colon
+ colon = false;
+ }
// handle empty string
- if (StringUtils.isEmpty(label))
+ if (StringUtils.isEmpty(label) || label.equals("-"))
return "";
// getColon
if (colon)
@@ -1857,13 +1861,31 @@ public class TagEncodingHelper implements NamingContainer
label.setStyleClass(completeLabelStyleClass(styleClass, required));
// set mark
boolean hasMark = (label.getChildCount()>0);
- if (required==hasMark)
- return;
- // Add or remove the mark
- if (required && InputControlManager.isShowLabelRequiredMark())
- addRequiredMark(label);
- else
- label.getChildren().clear();
+ if (required!=hasMark)
+ { // Add or remove the mark
+ if (required && InputControlManager.isShowLabelRequiredMark())
+ addRequiredMark(label);
+ else if(hasMark)
+ label.getChildren().clear();
+ }
+ // Update label if provided with component
+ String labelText = getTagAttributeString("label", null);
+ if (labelText!=null)
+ { // Label has changed
+ if (!labelText.equals("-"))
+ { // add a colon?
+ boolean colon = (!labelText.endsWith(":") ? ObjectUtils.getBoolean(getTagAttributeValue("colon"), true) : false);
+ if (colon)
+ labelText = labelText.trim() + ":";
+ label.setValue(labelText);
+ // make visible
+ label.setRendered(true);
+ }
+ else
+ { // hide label
+ label.setRendered(false);
+ }
+ }
}
protected String completeLabelStyleClass(String styleClasses, boolean required)
diff --git a/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/utils/TagEncodingHelper.java b/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/utils/TagEncodingHelper.java
index 3cd69a5f..f9cb7c83 100644
--- a/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/utils/TagEncodingHelper.java
+++ b/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/utils/TagEncodingHelper.java
@@ -1734,9 +1734,13 @@ public class TagEncodingHelper implements NamingContainer
label=column.getTitle();
// translate
label = getDisplayText(column, label);
- }
+ }
+ else if (label.endsWith(":"))
+ { // already has a colon
+ colon = false;
+ }
// handle empty string
- if (StringUtils.isEmpty(label))
+ if (StringUtils.isEmpty(label) || label.equals("-"))
return "";
// getColon
if (colon)
@@ -1857,13 +1861,31 @@ public class TagEncodingHelper implements NamingContainer
label.setStyleClass(completeLabelStyleClass(styleClass, required));
// set mark
boolean hasMark = (label.getChildCount()>0);
- if (required==hasMark)
- return;
- // Add or remove the mark
- if (required && InputControlManager.isShowLabelRequiredMark())
- addRequiredMark(label);
- else
- label.getChildren().clear();
+ if (required!=hasMark)
+ { // Add or remove the mark
+ if (required && InputControlManager.isShowLabelRequiredMark())
+ addRequiredMark(label);
+ else if(hasMark)
+ label.getChildren().clear();
+ }
+ // Update label if provided with component
+ String labelText = getTagAttributeString("label", null);
+ if (labelText!=null)
+ { // Label has changed
+ if (!labelText.equals("-"))
+ { // add a colon?
+ boolean colon = (!labelText.endsWith(":") ? ObjectUtils.getBoolean(getTagAttributeValue("colon"), true) : false);
+ if (colon)
+ labelText = labelText.trim() + ":";
+ label.setValue(labelText);
+ // make visible
+ label.setRendered(true);
+ }
+ else
+ { // hide label
+ label.setRendered(false);
+ }
+ }
}
protected String completeLabelStyleClass(String styleClasses, boolean required)