You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by de...@apache.org on 2018/08/10 18:23:11 UTC
svn commit: r1837827 - in /ofbiz/ofbiz-framework/trunk: framework/widget/dtd/
framework/widget/src/main/java/org/apache/ofbiz/widget/model/
framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/
themes/common-theme/template/macro/
Author: deepak
Date: Fri Aug 10 18:23:11 2018
New Revision: 1837827
URL: http://svn.apache.org/viewvc?rev=1837827&view=rev
Log:
Improved: Rendering different HTML container types with ScreenRenderer
(OFBIZ-10495)
Applied slightly modified patch
Thanks Dennis Balkir for your contribution
Modified:
ofbiz/ofbiz-framework/trunk/framework/widget/dtd/widget-screen.xsd
ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelScreenWidget.java
ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenRenderer.java
ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/CsvScreenMacroLibrary.ftl
ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/FoScreenMacroLibrary.ftl
ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/HtmlScreenMacroLibrary.ftl
ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/TextScreenMacroLibrary.ftl
ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/XlsScreenMacroLibrary.ftl
Modified: ofbiz/ofbiz-framework/trunk/framework/widget/dtd/widget-screen.xsd
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/dtd/widget-screen.xsd?rev=1837827&r1=1837826&r2=1837827&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/widget/dtd/widget-screen.xsd (original)
+++ ofbiz/ofbiz-framework/trunk/framework/widget/dtd/widget-screen.xsd Fri Aug 10 18:23:11 2018
@@ -263,6 +263,13 @@ under the License.
</xs:documentation>
</xs:annotation>
</xs:attribute>
+ <xs:attribute type="xs:string" name="type">
+ <xs:annotation>
+ <xs:documentation>With the type it is possible to render different containers
+ than div like section.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
<xs:attribute type="xs:string" name="auto-update-interval">
<xs:annotation>
<xs:documentation>The auto-update interval, in seconds.</xs:documentation>
Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelScreenWidget.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelScreenWidget.java?rev=1837827&r1=1837826&r2=1837827&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelScreenWidget.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelScreenWidget.java Fri Aug 10 18:23:11 2018
@@ -433,6 +433,7 @@ public abstract class ModelScreenWidget
public static final class Container extends ModelScreenWidget {
public static final String TAG_NAME = "container";
private final FlexibleStringExpander idExdr;
+ private final FlexibleStringExpander typeExdr;
private final FlexibleStringExpander styleExdr;
private final FlexibleStringExpander autoUpdateTargetExdr;
private final FlexibleStringExpander autoUpdateInterval;
@@ -441,6 +442,7 @@ public abstract class ModelScreenWidget
public Container(ModelScreen modelScreen, Element containerElement) {
super(modelScreen, containerElement);
this.idExdr = FlexibleStringExpander.getInstance(containerElement.getAttribute("id"));
+ this.typeExdr = FlexibleStringExpander.getInstance(containerElement.getAttribute("type"));
this.styleExdr = FlexibleStringExpander.getInstance(containerElement.getAttribute("style"));
this.autoUpdateTargetExdr = FlexibleStringExpander.getInstance(containerElement.getAttribute("auto-update-target"));
String autoUpdateInterval = containerElement.getAttribute("auto-update-interval");
@@ -473,6 +475,10 @@ public abstract class ModelScreenWidget
return this.idExdr.expandString(context);
}
+ public String getType(Map<String, Object> context) {
+ return this.typeExdr.expandString(context);
+ }
+
public String getStyle(Map<String, Object> context) {
return this.styleExdr.expandString(context);
}
@@ -498,6 +504,10 @@ public abstract class ModelScreenWidget
return idExdr;
}
+ public FlexibleStringExpander getTypeExdr() {
+ return typeExdr;
+ }
+
public FlexibleStringExpander getStyleExdr() {
return styleExdr;
}
Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenRenderer.java?rev=1837827&r1=1837826&r2=1837827&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenRenderer.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenRenderer.java Fri Aug 10 18:23:11 2018
@@ -183,6 +183,7 @@ public class MacroScreenRenderer impleme
public void renderContainerBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.Container container) throws IOException {
String containerId = container.getId(context);
+ String containerType = container.getType(context);
String autoUpdateTarget = container.getAutoUpdateTargetExdr(context);
HttpServletRequest request = (HttpServletRequest) context.get("request");
String autoUpdateLink = "";
@@ -197,6 +198,7 @@ public class MacroScreenRenderer impleme
}
Map<String, Object> parameters = new HashMap<>();
parameters.put("id", containerId);
+ parameters.put("type", containerType);
parameters.put("style", container.getStyle(context));
parameters.put("autoUpdateLink", autoUpdateLink);
parameters.put("autoUpdateInterval", container.getAutoUpdateInterval(context));
@@ -204,7 +206,8 @@ public class MacroScreenRenderer impleme
}
public void renderContainerEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.Container container) throws IOException {
- executeMacro(writer, "renderContainerEnd", null);
+ String containerType = container.getType(context);
+ executeMacro(writer, "renderContainerEnd", UtilMisc.toMap("type", containerType));
}
public void renderLabel(Appendable writer, Map<String, Object> context, ModelScreenWidget.Label label) throws IOException {
Modified: ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/CsvScreenMacroLibrary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/CsvScreenMacroLibrary.ftl?rev=1837827&r1=1837826&r2=1837827&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/CsvScreenMacroLibrary.ftl (original)
+++ ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/CsvScreenMacroLibrary.ftl Fri Aug 10 18:23:11 2018
@@ -29,8 +29,8 @@ under the License.
<#macro renderSectionEnd boundaryComment>
</#macro>
-<#macro renderContainerBegin id style autoUpdateLink autoUpdateInterval></#macro>
-<#macro renderContainerEnd></#macro>
+<#macro renderContainerBegin id style autoUpdateLink type autoUpdateInterval></#macro>
+<#macro renderContainerEnd type></#macro>
<#macro renderContentBegin editRequest enableEditValue editContainerStyle></#macro>
<#macro renderContentBody></#macro>
<#macro renderContentEnd urlString editMode editContainerStyle editRequest enableEditValue></#macro>
Modified: ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/FoScreenMacroLibrary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/FoScreenMacroLibrary.ftl?rev=1837827&r1=1837826&r2=1837827&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/FoScreenMacroLibrary.ftl (original)
+++ ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/FoScreenMacroLibrary.ftl Fri Aug 10 18:23:11 2018
@@ -51,8 +51,8 @@ under the License.
<#macro renderSectionEnd boundaryComment>
</#macro>
-<#macro renderContainerBegin id autoUpdateLink autoUpdateInterval style=""><fo:block <#if style?has_content><@getFoStyle style/></#if>></#macro>
-<#macro renderContainerEnd></fo:block></#macro>
+<#macro renderContainerBegin id autoUpdateLink type autoUpdateInterval style=""><fo:block <#if style?has_content><@getFoStyle style/></#if>></#macro>
+<#macro renderContainerEnd type></fo:block></#macro>
<#macro renderContentBegin editRequest enableEditValue editContainerStyle></#macro>
<#macro renderContentBody></#macro>
<#macro renderContentEnd></#macro>
Modified: ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/HtmlScreenMacroLibrary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/HtmlScreenMacroLibrary.ftl?rev=1837827&r1=1837826&r2=1837827&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/HtmlScreenMacroLibrary.ftl (original)
+++ ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/HtmlScreenMacroLibrary.ftl Fri Aug 10 18:23:11 2018
@@ -35,13 +35,14 @@ under the License.
</#if>
</#macro>
-<#macro renderContainerBegin id autoUpdateInterval style="" autoUpdateLink="">
+<#macro renderContainerBegin id autoUpdateInterval type="" style="" autoUpdateLink="">
<#if autoUpdateLink?has_content>
<script type="application/javascript">ajaxUpdateAreaPeriodic('${id}', '${autoUpdateLink}', '', '${autoUpdateInterval}');</script>
</#if>
-<div<#if id?has_content> id="${id}"</#if><#if style?has_content> class="${style}"</#if>>
+<#if !type?has_content><#local type="div"/> </#if>
+<${type}<#if id?has_content> id="${id}"</#if><#if style?has_content> class="${style}"</#if>>
</#macro>
-<#macro renderContainerEnd></div></#macro>
+<#macro renderContainerEnd type=""><#if !type?has_content><#local type="div"/> </#if></${type}></#macro>
<#macro renderContentBegin enableEditValue editContainerStyle editRequest=""><#if editRequest?has_content && "true" == enableEditValue><div class=${editContainerStyle}></#if></#macro>
<#macro renderContentBody></#macro>
<#macro renderContentEnd editMode editContainerStyle enableEditValue editRequest="" urlString="" >
Modified: ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/TextScreenMacroLibrary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/TextScreenMacroLibrary.ftl?rev=1837827&r1=1837826&r2=1837827&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/TextScreenMacroLibrary.ftl (original)
+++ ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/TextScreenMacroLibrary.ftl Fri Aug 10 18:23:11 2018
@@ -29,8 +29,8 @@ under the License.
<#macro renderSectionEnd boundaryComment>
</#macro>
-<#macro renderContainerBegin id style autoUpdateLink autoUpdateInterval></#macro>
-<#macro renderContainerEnd></#macro>
+<#macro renderContainerBegin id style autoUpdateLink type autoUpdateInterval></#macro>
+<#macro renderContainerEnd type></#macro>
<#macro renderContentBegin editRequest enableEditValue editContainerStyle></#macro>
<#macro renderContentBody></#macro>
<#macro renderContentEnd urlString editMode editContainerStyle editRequest enableEditValue></#macro>
Modified: ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/XlsScreenMacroLibrary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/XlsScreenMacroLibrary.ftl?rev=1837827&r1=1837826&r2=1837827&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/XlsScreenMacroLibrary.ftl (original)
+++ ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/XlsScreenMacroLibrary.ftl Fri Aug 10 18:23:11 2018
@@ -25,8 +25,8 @@ under the License.
<#macro renderSectionEnd boundaryComment></#macro>
-<#macro renderContainerBegin id style autoUpdateLink autoUpdateInterval></#macro>
-<#macro renderContainerEnd></#macro>
+<#macro renderContainerBegin id style autoUpdateLink type autoUpdateInterval></#macro>
+<#macro renderContainerEnd type></#macro>
<#macro renderContentBegin editRequest enableEditValue editContainerStyle></#macro>
<#macro renderContentBody></#macro>
<#macro renderContentEnd urlString editMode editContainerStyle editRequest enableEditValue></#macro>