[ofbiz-framework] branch trunk updated: Fixed: Open Screen file from browser (OFBIZ-12038)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ofbiz-framework] branch trunk updated: Fixed: Open Screen file from browser (OFBIZ-12038)

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

jamesyong 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 f484b0d  Fixed: Open Screen file from browser (OFBIZ-12038)
f484b0d is described below

commit f484b0d3184c3312bd4e70a69c26e154d86ce1a4
Author: James Yong <[hidden email]>
AuthorDate: Wed Jan 6 23:23:35 2021 +0800

    Fixed: Open Screen file from browser (OFBIZ-12038)
   
    Fix named borders not rendered for sub-screens.
---
 .../ofbiz/widget/renderer/macro/MacroScreenRenderer.java       | 10 ++++++++++
 .../ofbiz/widget/renderer/macro/MacroScreenViewHandler.java    | 10 ----------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenRenderer.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenRenderer.java
index 810bf44..7cc9ed1 100644
--- a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenRenderer.java
+++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenRenderer.java
@@ -64,6 +64,7 @@ import org.apache.ofbiz.widget.renderer.MenuStringRenderer;
 import org.apache.ofbiz.widget.renderer.Paginator;
 import org.apache.ofbiz.widget.renderer.ScreenStringRenderer;
 import org.apache.ofbiz.widget.renderer.VisualTheme;
+import org.apache.ofbiz.widget.renderer.html.HtmlWidgetRenderer;
 import org.xml.sax.SAXException;
 
 import freemarker.core.Environment;
@@ -172,9 +173,18 @@ public class MacroScreenRenderer implements ScreenStringRenderer {
             parameters.put("boundaryComment", sb.toString());
             executeMacro(writer, "renderSectionBegin", parameters);
         }
+        if (HtmlWidgetRenderer.NAMED_BORDER_TYPE != ModelWidget.NamedBorderType.NONE && section.isMainSection()) {
+            // render start of named border for screen
+            writer.append(HtmlWidgetRenderer.beginNamedBorder("Screen",
+                    section.getBoundaryCommentName(), ((HttpServletRequest) context.get("request")).getContextPath()));
+        }
     }
     @Override
     public void renderSectionEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.Section section) throws IOException {
+        if (HtmlWidgetRenderer.NAMED_BORDER_TYPE != ModelWidget.NamedBorderType.NONE && section.isMainSection()) {
+            // render end of named border for screen
+            writer.append(HtmlWidgetRenderer.endNamedBorder("Screen", section.getBoundaryCommentName()));
+        }
         if (this.widgetCommentsEnabled) {
             Map<String, Object> parameters = new HashMap<>();
             StringBuilder sb = new StringBuilder();
diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenViewHandler.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenViewHandler.java
index fd09b24..6972238 100644
--- a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenViewHandler.java
+++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenViewHandler.java
@@ -36,14 +36,12 @@ import org.apache.ofbiz.base.util.collections.MapStack;
 import org.apache.ofbiz.webapp.view.AbstractViewHandler;
 import org.apache.ofbiz.webapp.view.ViewHandlerException;
 import org.apache.ofbiz.widget.model.ModelTheme;
-import org.apache.ofbiz.widget.model.ModelWidget;
 import org.apache.ofbiz.widget.renderer.FormStringRenderer;
 import org.apache.ofbiz.widget.renderer.MenuStringRenderer;
 import org.apache.ofbiz.widget.renderer.ScreenRenderer;
 import org.apache.ofbiz.widget.renderer.ScreenStringRenderer;
 import org.apache.ofbiz.widget.renderer.TreeStringRenderer;
 import org.apache.ofbiz.widget.renderer.VisualTheme;
-import org.apache.ofbiz.widget.renderer.html.HtmlWidgetRenderer;
 import org.xml.sax.SAXException;
 
 import freemarker.template.TemplateException;
@@ -115,15 +113,7 @@ public class MacroScreenViewHandler extends AbstractViewHandler {
             context.put("screens", screens);
             context.put("simpleEncoder", UtilCodec.getEncoder(visualTheme.getModelTheme().getEncoder(getName())));
             screenStringRenderer.renderScreenBegin(writer, context);
-            if (HtmlWidgetRenderer.NAMED_BORDER_TYPE != ModelWidget.NamedBorderType.NONE) {
-                // render start of named border for screen
-                writer.append(HtmlWidgetRenderer.beginNamedBorder("Screen", page, request.getContextPath()));
-            }
             screens.render(page);
-            if (HtmlWidgetRenderer.NAMED_BORDER_TYPE != ModelWidget.NamedBorderType.NONE) {
-                // render end of named border for screen
-                writer.append(HtmlWidgetRenderer.endNamedBorder("Screen", page));
-            }
             screenStringRenderer.renderScreenEnd(writer, context);
             writer.flush();
         } catch (TemplateException e) {