Author: lektran
Date: Sat Jul 24 23:15:45 2010
New Revision: 978944
URL:
http://svn.apache.org/viewvc?rev=978944&view=revLog:
Add a new method for constructing a freemarker macro call string, should simplify the code needed to generate a macro call and centralize the double quote encoding of parameter values. I'll be working to switch all of the render* methods over to using this today.
Modified:
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java?rev=978944&r1=978943&r2=978944&view=diff==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java Sat Jul 24 23:15:45 2010
@@ -102,6 +102,22 @@ public class MacroScreenRenderer impleme
}
}
+ private void executeMacro(Appendable writer, String macroName, Map<String, String> parameters) throws IOException {
+ StringBuilder sb = new StringBuilder("<@");
+ sb.append(macroName);
+ if (parameters != null) {
+ for (Map.Entry<String, String> parameter : parameters.entrySet()) {
+ sb.append(' ');
+ sb.append(parameter.getKey());
+ sb.append("=\"");
+ sb.append(parameter.getValue().replaceAll("\"", "\\\\\""));
+ sb.append('"');
+ }
+ }
+ sb.append(" />");
+ executeMacro(writer, sb.toString());
+ }
+
private Environment getEnvironment(Appendable writer) throws TemplateException, IOException {
Environment environment = environments.get(writer);
if (environment == null) {