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 a983c77 Improved: Open Form Widget (Single Type) source file from browser (OFBIZ-12041) a983c77 is described below commit a983c7741cb791301c7aee4f3f4ae73c4418a2a7 Author: James Yong <[hidden email]> AuthorDate: Sun Oct 11 08:37:39 2020 +0800 Improved: Open Form Widget (Single Type) source file from browser (OFBIZ-12041) Add function to open the corresponding Form Widget file with IDE when the named border is clicked from browser. Dependent on widget.dev.namedBorder and widget.dev.cmd.openSourceFile properties. Thanks Jacques for review --- .../org/apache/ofbiz/widget/renderer/FormRenderer.java | 14 ++++++++++++++ .../ofbiz/widget/renderer/html/HtmlWidgetRenderer.java | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/FormRenderer.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/FormRenderer.java index e6b3522..6c61a39 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/FormRenderer.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/FormRenderer.java @@ -55,6 +55,10 @@ import org.apache.ofbiz.widget.model.ModelForm.FieldGroup; import org.apache.ofbiz.widget.model.ModelForm.FieldGroupBase; import org.apache.ofbiz.widget.model.ModelFormField; import org.apache.ofbiz.widget.model.ModelGrid; +import org.apache.ofbiz.widget.model.ModelWidget; +import org.apache.ofbiz.widget.renderer.html.HtmlWidgetRenderer; + +import javax.servlet.http.HttpServletRequest; /** * A form rendering engine. @@ -969,6 +973,12 @@ public class FormRenderer { // render form open if (!modelForm.getSkipStart()) { formStringRenderer.renderFormOpen(writer, context, modelForm); + if (HtmlWidgetRenderer.NAMED_BORDER_TYPE != ModelWidget.NamedBorderType.NONE) { + HttpServletRequest request = (HttpServletRequest) context.get("request"); + writer.append(HtmlWidgetRenderer.beginNamedBorder("Form", + modelForm.getFormLocation() + "#" + modelForm.getName(), + request.getContextPath())); + } } // render all hidden & ignored fields @@ -1185,6 +1195,10 @@ public class FormRenderer { // render form close if (!modelForm.getSkipEnd()) { + if (HtmlWidgetRenderer.NAMED_BORDER_TYPE != ModelWidget.NamedBorderType.NONE) { + writer.append(HtmlWidgetRenderer.endNamedBorder("Form", + modelForm.getFormLocation() + "#" + modelForm.getName())); + } formStringRenderer.renderFormClose(writer, context, modelForm); } diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java index fd78801..a112ed0 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java @@ -94,7 +94,8 @@ public class HtmlWidgetRenderer { String fileName = location.substring(location.lastIndexOf("/") + 1); switch (NAMED_BORDER_TYPE) { case SOURCE: - return "<div class='info-container'><span class='info-overlay-item info-cursor-none' data-source='" + return "<div class='info-container'><span class='info-overlay-item info-cursor-none info-" + + widgetType.toLowerCase().replaceAll(" ", "-") + "' data-source='" + location + "' data-target='" + contextPath + (SeoConfigUtil.isCategoryUrlEnabled(contextPath) ? "" : "/control") + "/openSourceFile'>" |
Free forum by Nabble | Edit this page |