This is an automated email from the ASF dual-hosted git repository.
nmalin pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/trunk by this push:
new 8b5bd93 Fixed: Use platform specific failed on CompoundWidget
(OFBIZ-12283)
8b5bd93 is described below
commit 8b5bd93d3a3d7e9516ec5059a0c5a496b5c1b9b3
Author: Nicolas Malin <[email protected]>
AuthorDate: Thu Jul 22 21:37:09 2021 +0200
Fixed: Use platform specific failed on CompoundWidget (OFBIZ-12283)
When you use a platform-specific element on CompoundWidget like this :
<ws:platform-specific>
<ws:html><ws:html-template location="component ..."/></ws:html>
</ws:platform-specific>
the ModelScreenWidget failed to resolve the attended type due to the
namespace presence (ws:html != html) and finally failed to rendering the
screen
Complete the previous commit where I forgot this part
---
.../java/org/apache/ofbiz/widget/model/HtmlWidget.java | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git
a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java
b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java
index f175044..45bb9fa 100644
---
a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java
+++
b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java
@@ -29,6 +29,7 @@ import freemarker.template.TemplateModelException;
import freemarker.template.Version;
import org.apache.ofbiz.base.util.Debug;
import org.apache.ofbiz.base.util.GeneralException;
+import org.apache.ofbiz.base.util.StringUtil;
import org.apache.ofbiz.base.util.UtilCodec;
import org.apache.ofbiz.base.util.UtilGenerics;
import org.apache.ofbiz.base.util.UtilHtml;
@@ -128,13 +129,19 @@ public class HtmlWidget extends ModelScreenWidget {
} else {
List<ModelScreenWidget> subWidgets = new
ArrayList<>(childElementList.size());
for (Element childElement : childElementList) {
- if ("html-template".equals(childElement.getNodeName())) {
+ String childNodeName = childElement.getNodeName().contains(":")
+ ? StringUtil.split(childElement.getNodeName(),
":").get(1)
+ : childElement.getNodeName();
+ switch (childNodeName) {
+ case "html-template":
subWidgets.add(new HtmlTemplate(modelScreen,
childElement));
- } else if
("html-template-decorator".equals(childElement.getNodeName())) {
+ break;
+ case "html-template-decorator":
subWidgets.add(new HtmlTemplateDecorator(modelScreen,
childElement));
- } else {
- throw new IllegalArgumentException("Tag not supported
under the platform-specific -> html tag with name: "
- + childElement.getNodeName());
+ break;
+ default:
+ throw new IllegalArgumentException("Tag not supported
under the platform-specific -> html tag with name: " +
+ childElement.getNodeName());
}
}
this.subWidgets = Collections.unmodifiableList(subWidgets);