You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2009/04/22 15:01:36 UTC

svn commit: r767503 - in /ofbiz/branches/release09.04/framework/widget: src/org/ofbiz/widget/form/ src/org/ofbiz/widget/screen/ templates/

Author: jacopoc
Date: Wed Apr 22 13:01:36 2009
New Revision: 767503

URL: http://svn.apache.org/viewvc?rev=767503&view=rev
Log:
Applied fix from trunk for revision: 767455

Modified:
    ofbiz/branches/release09.04/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java
    ofbiz/branches/release09.04/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java
    ofbiz/branches/release09.04/framework/widget/templates/foScreenMacroLibrary.ftl
    ofbiz/branches/release09.04/framework/widget/templates/htmlScreenMacroLibrary.ftl
    ofbiz/branches/release09.04/framework/widget/templates/textScreenMacroLibrary.ftl
    ofbiz/branches/release09.04/framework/widget/templates/xmlScreenMacroLibrary.ftl

Modified: ofbiz/branches/release09.04/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release09.04/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java?rev=767503&r1=767502&r2=767503&view=diff
==============================================================================
--- ofbiz/branches/release09.04/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java (original)
+++ ofbiz/branches/release09.04/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java Wed Apr 22 13:01:36 2009
@@ -125,13 +125,22 @@
             // FIXME: I am using a Date as an hack to provide a unique name for the template...
             Template template = new Template((new java.util.Date()).toString(), templateReader, FreeMarkerWorker.getDefaultOfbizConfig());
             templateReader.close();
-            environment.include(template);
+            if (writer != null) {
+                Map<String, Object> input = UtilMisc.toMap("key", null);
+                Environment tmpEnvironment = FreeMarkerWorker.renderTemplate(macroLibrary, input, writer);
+                tmpEnvironment.include(template);
+            } else {
+                environment.include(template);
+            }
         } catch (TemplateException e) {
             Debug.logError(e, "Error rendering screen thru ftl", module);
         } catch (IOException e) {
             Debug.logError(e, "Error rendering screen thru ftl", module);
         }
     }
+    private void executeMacro(String macro) throws IOException {
+        executeMacro(null, macro);
+    }
 
     private void appendWhitespace(Appendable writer) throws IOException {
         // appending line ends for now, but this could be replaced with a simple space or something
@@ -151,7 +160,7 @@
         sr.append(labelText);
         sr.append("\"");
         sr.append(" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     public void renderDisplayField(Appendable writer, Map<String, Object> context, DisplayField displayField) throws IOException {
@@ -176,7 +185,7 @@
         sr.append("\" alert=\"");
         sr.append(modelFormField.shouldBeRed(context)? "true": "false");
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
         if (displayField instanceof DisplayEntityField) {
             makeHyperlinkString(writer,((DisplayEntityField) displayField).getSubHyperlink(),context);
         }
@@ -256,7 +265,7 @@
         sr.append("\" ajaxEnabled=");
         sr.append(Boolean.toString(ajaxEnabled));
         sr.append(" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
 
         ModelFormField.SubHyperlink subHyperlink = textField.getSubHyperlink();
         if (subHyperlink != null && subHyperlink.shouldUse(context)) {
@@ -325,7 +334,7 @@
         sr.append("\" buttons=\"");
         sr.append(buttons);
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
         this.addAsterisks(writer, context, modelFormField);
         this.appendTooltip(writer, context, modelFormField);
     }
@@ -514,7 +523,7 @@
         sr.append("\" formName=\"");
         sr.append(formName);
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
         this.addAsterisks(writer, context, modelFormField);
         this.appendTooltip(writer, context, modelFormField);
     }
@@ -704,7 +713,7 @@
         sr.append("\" fullSearch=\"");
         sr.append(fullSearch);
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
         ModelFormField.SubHyperlink subHyperlink = dropDownField
                 .getSubHyperlink();
         if (subHyperlink != null && subHyperlink.shouldUse(context)) {
@@ -768,7 +777,7 @@
             sr.append(action);
         }
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
 
         this.appendTooltip(writer, context, modelFormField);
     }
@@ -828,7 +837,7 @@
             sr.append(action);
         }
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
 
         this.appendTooltip(writer, context, modelFormField);
     }
@@ -902,7 +911,7 @@
             sr.append(ajaxUrl);
         }
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
         this.appendTooltip(writer, context, modelFormField);
     }
 
@@ -930,7 +939,7 @@
         sr.append(" title=\"");
         sr.append(title);
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
 
         this.appendTooltip(writer, context, modelFormField);
     }
@@ -950,7 +959,7 @@
         sr.append("\" value=\"");
         sr.append(value);
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     public void renderIgnoredField(Appendable writer, Map<String, Object> context, IgnoredField ignoredField) {
@@ -983,7 +992,7 @@
         sr.append("\" title=\"");
         sr.append(sb.toString());
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     public void renderSingleFormFieldTitle(Appendable writer, Map<String, Object> context, ModelFormField modelFormField) throws IOException {
@@ -1028,7 +1037,7 @@
         sr.append("\" useRowSubmit=");
         sr.append(Boolean.toString(useRowSubmit));
         sr.append(" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     public void renderFormClose(Appendable writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
@@ -1041,7 +1050,7 @@
         sr.append("\" formName=\"");
         sr.append(formName);
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
         renderEndingBoundaryComment(writer, "Form Widget - Form Element", modelForm);
     }
 
@@ -1126,7 +1135,7 @@
         sr.append("\" columnStyles=[");
         sr.append(columnStyleListString);
         sr.append("] />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
 
     }
 
@@ -1136,7 +1145,7 @@
         sr.append(" formName=\"");
         sr.append(modelForm.getName());
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
         if (this.renderPagination) {
             this.renderNextPrev(writer, context, modelForm);
         }
@@ -1150,13 +1159,13 @@
         sr.append(" style=\"");
         sr.append(headerStyle);
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     public void renderFormatHeaderRowClose(Appendable writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
         StringWriter sr = new StringWriter();
         sr.append("<@renderFormatHeaderRowClose />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     public void renderFormatHeaderRowCellOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField, int positionSpan) throws IOException {
@@ -1168,13 +1177,13 @@
         sr.append("\" positionSpan=");
         sr.append(Integer.toString(positionSpan));
         sr.append(" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     public void renderFormatHeaderRowCellClose(Appendable writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField) throws IOException {
         StringWriter sr = new StringWriter();
         sr.append("<@renderFormatHeaderRowCellClose />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     public void renderFormatHeaderRowFormCellOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
@@ -1184,13 +1193,13 @@
         sr.append(" style=\"");
         sr.append(areaStyle);
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     public void renderFormatHeaderRowFormCellClose(Appendable writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
         StringWriter sr = new StringWriter();
         sr.append("<@renderFormatHeaderRowFormCellClose />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     public void renderFormatHeaderRowFormCellTitleSeparator(Appendable writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField, boolean isLast) throws IOException {
@@ -1202,7 +1211,7 @@
         sr.append("\" isLast=");
         sr.append(Boolean.toString(isLast));
         sr.append(" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     public void renderFormatItemRowOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
@@ -1231,7 +1240,7 @@
         sr.append("\" oddRowStyle=\"");
         sr.append(oddRowStyle);
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     public void renderFormatItemRowClose(Appendable writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
@@ -1240,7 +1249,7 @@
         sr.append(" formName=\"");
         sr.append(modelForm.getName());
         sr.append("\"/>");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     public void renderFormatItemRowCellOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField, int positionSpan) throws IOException {
@@ -1254,7 +1263,7 @@
         sr.append("\" positionSpan=");
         sr.append(Integer.toString(positionSpan));
         sr.append(" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     public void renderFormatItemRowCellClose(Appendable writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField) throws IOException {
@@ -1263,7 +1272,7 @@
         sr.append(" fieldName=\"");
         sr.append(modelFormField.getName());
         sr.append("\"/>");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     public void renderFormatItemRowFormCellOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
@@ -1273,13 +1282,13 @@
         sr.append(" style=\"");
         sr.append(areaStyle);
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     public void renderFormatItemRowFormCellClose(Appendable writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
         StringWriter sr = new StringWriter();
         sr.append("<@renderFormatItemRowFormCellClose />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     public void renderFormatSingleWrapperOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
@@ -1291,7 +1300,7 @@
         sr.append("\" style=\"");
         sr.append(style);
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     public void renderFormatSingleWrapperClose(Appendable writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
@@ -1300,19 +1309,19 @@
         sr.append(" formName=\"");
         sr.append(modelForm.getName());
         sr.append("\"/>");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     public void renderFormatFieldRowOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
         StringWriter sr = new StringWriter();
         sr.append("<@renderFormatFieldRowOpen />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     public void renderFormatFieldRowClose(Appendable writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
         StringWriter sr = new StringWriter();
         sr.append("<@renderFormatFieldRowClose />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     public void renderFormatFieldRowTitleCellOpen(Appendable writer, Map<String, Object> context, ModelFormField modelFormField) throws IOException {
@@ -1322,13 +1331,13 @@
         sr.append(" style=\"");
         sr.append(style);
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     public void renderFormatFieldRowTitleCellClose(Appendable writer, Map<String, Object> context, ModelFormField modelFormField) throws IOException {
         StringWriter sr = new StringWriter();
         sr.append("<@renderFormatFieldRowTitleCellClose />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     public void renderFormatFieldRowSpacerCell(Appendable writer, Map<String, Object> context, ModelFormField modelFormField) throws IOException {
@@ -1343,20 +1352,20 @@
         sr.append(" style=\"");
         sr.append(areaStyle);
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
 
     }
 
     public void renderFormatFieldRowWidgetCellClose(Appendable writer, Map<String, Object> context, ModelFormField modelFormField, int positions, int positionSpan, Integer nextPositionInRow) throws IOException {
         StringWriter sr = new StringWriter();
         sr.append("<@renderFormatFieldRowWidgetCellClose />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     public void renderFormatEmptySpace(Appendable writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
         StringWriter sr = new StringWriter();
         sr.append("<@renderFormatEmptySpace />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     public void renderTextFindField(Appendable writer, Map<String, Object> context, TextFindField textFindField) throws IOException {
@@ -1447,7 +1456,7 @@
         sr.append(" ignoreCase=\"");
         sr.append(ignoreCase);
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
 
         this.appendTooltip(writer, context, modelFormField);
     }
@@ -1529,7 +1538,7 @@
         sr.append("\" defaultOptionThru=\"");
         sr.append(defaultOptionThru);
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
 
         this.appendTooltip(writer, context, modelFormField);
     }
@@ -1664,7 +1673,7 @@
         sr.append("\" opIsEmpty=\"");
         sr.append(opIsEmpty);
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
 
         this.appendTooltip(writer, context, modelFormField);
     }
@@ -1753,7 +1762,7 @@
         sr.append(" imgSrc=\"");
         sr.append(imgSrc.toString());
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
 
         this.addAsterisks(writer, context, modelFormField);
 
@@ -1989,7 +1998,7 @@
         sr.append("\" paginateLastLabel=\"");
         sr.append(paginateLastLabel);
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     public void renderFileField(Appendable writer, Map<String, Object> context, FileField textField) throws IOException {
@@ -2036,7 +2045,7 @@
         sr.append("\" autocomplete=\"");
         sr.append(autocomplete);
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
 
         this.makeHyperlinkString(writer, textField.getSubHyperlink(), context);
 
@@ -2095,7 +2104,7 @@
         sr.append("\" autocomplete=\"");
         sr.append(autocomplete);
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
 
         this.addAsterisks(writer, context, modelFormField);
 
@@ -2146,7 +2155,7 @@
         sr.append(" action=\"");
         sr.append(action==null?"":action);
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
         this.makeHyperlinkString(writer, imageField.getSubHyperlink(), context);
 
         this.appendTooltip(writer, context, modelFormField);
@@ -2194,7 +2203,7 @@
         sr.append("\" collapseToolTip=\"");
         sr.append(collapseToolTip);
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     public void renderFieldGroupClose(Appendable writer, Map<String, Object> context, ModelForm.FieldGroup fieldGroup) throws IOException {
@@ -2217,7 +2226,7 @@
             sr.append(title);
         }
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     public void renderBanner(Appendable writer, Map<String, Object> context, ModelForm.Banner banner) throws IOException {
@@ -2257,7 +2266,7 @@
         sr.append("\" rightText=\"");
         sr.append(rightText);
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
 
@@ -2278,7 +2287,7 @@
             sr.append("\" widgetName=\"");
             sr.append(modelWidget.getBoundaryCommentName());
             sr.append("\" />");
-            executeMacro(writer, sr.toString());
+            executeMacro(sr.toString());
         }
     }
 
@@ -2299,7 +2308,7 @@
             sr.append("\" widgetName=\"");
             sr.append(modelWidget.getBoundaryCommentName());
             sr.append("\" />");
-            executeMacro(writer, sr.toString());
+            executeMacro(sr.toString());
         }
     }
     public void renderHyperlinkTitle(Appendable writer, Map<String, Object> context, ModelFormField modelFormField, String titleText) throws IOException {
@@ -2324,7 +2333,7 @@
             sr.append("\" title=\"");
             sr.append(titleText);
             sr.append("\" />");
-            executeMacro(writer, sr.toString());
+            executeMacro(sr.toString());
         } else {
              writer.append(titleText);
         }
@@ -2410,7 +2419,7 @@
         sr.append("\" ajaxEnabled=");
         sr.append(Boolean.toString(ajaxEnabled));
         sr.append(" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
 
     }
     /** Create an ajaxXxxx JavaScript CSV string from a list of UpdateArea objects. See
@@ -2469,7 +2478,7 @@
         sr.append("\" tooltipStyle=\"");
         sr.append(modelFormField.getTooltipStyle());
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
     public void makeHyperlinkString(Appendable writer, ModelFormField.SubHyperlink subHyperlink, Map<String, Object> context) throws IOException {
         if (subHyperlink == null) {
@@ -2496,7 +2505,7 @@
         sr.append("\" requiredStyle=\"");
         sr.append(requiredStyle);
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
     public void appendContentUrl(Appendable writer, String location) throws IOException {
         StringBuffer buffer = new StringBuffer();
@@ -2572,7 +2581,7 @@
             sr.append("\" description=\"");
             sr.append(description);
             sr.append("\" />");
-            executeMacro(writer, sr.toString());
+            executeMacro(sr.toString());
         }
     }
 
@@ -2607,7 +2616,7 @@
             sr.append("\" description=\"");
             sr.append(description);
             sr.append("\" />");
-            executeMacro(writer, sr.toString());
+            executeMacro(sr.toString());
         }
     }
 
@@ -2641,6 +2650,6 @@
         sr.append(" targetWindow=\"");
         sr.append(targetWindow);
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 }

Modified: ofbiz/branches/release09.04/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release09.04/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java?rev=767503&r1=767502&r2=767503&view=diff
==============================================================================
--- ofbiz/branches/release09.04/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java (original)
+++ ofbiz/branches/release09.04/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java Wed Apr 22 13:01:36 2009
@@ -95,13 +95,22 @@
             // FIXME: I am using a Date as an hack to provide a unique name for the template...
             Template template = new Template((new java.util.Date()).toString(), templateReader, FreeMarkerWorker.getDefaultOfbizConfig());
             templateReader.close();
-            environment.include(template);
+            if (writer != null) {
+                Map<String, Object> input = UtilMisc.toMap("key", null);
+                Environment tmpEnvironment = FreeMarkerWorker.renderTemplate(macroLibrary, input, writer);
+                tmpEnvironment.include(template);
+            } else {
+                environment.include(template);
+            }
         } catch (TemplateException e) {
             Debug.logError(e, "Error rendering screen thru ftl", module);
         } catch (IOException e) {
             Debug.logError(e, "Error rendering screen thru ftl", module);
         }
     }
+    private void executeMacro(String macro) throws IOException {
+        executeMacro(null, macro);
+    }
 
     public String getRendererName() {
         return rendererName;
@@ -139,13 +148,13 @@
         sr.append("\" autoUpdateInterval=\"");
         sr.append(container.getAutoUpdateInterval());
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     public void renderContainerEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.Container container) throws IOException {
         StringWriter sr = new StringWriter();
         sr.append("<@renderContainerEnd/>");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     public void renderLabel(Appendable writer, Map<String, Object> context, ModelScreenWidget.Label label) throws IOException {
@@ -159,7 +168,7 @@
         sr.append("\" style=\"");
         sr.append(label.getStyle(context));
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     public void renderHorizontalSeparator(Appendable writer, Map<String, Object> context, ModelScreenWidget.HorizontalSeparator separator) throws IOException {
@@ -170,7 +179,7 @@
         sr.append("\" style=\"");
         sr.append(separator.getStyle(context));
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     public void renderLink(Appendable writer, Map<String, Object> context, ModelScreenWidget.Link link) throws IOException {
@@ -252,7 +261,7 @@
         sr.append("\" imgStr=\"");
         sr.append(imgStr);
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     public void renderImage(Appendable writer, Map<String, Object> context, ModelScreenWidget.Image image) throws IOException {
@@ -310,7 +319,7 @@
         sr.append("\" urlString=\"");
         sr.append(urlString);
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     public void renderContentBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException {
@@ -330,7 +339,7 @@
          sr.append("\" editContainerStyle=\"");
          sr.append(editContainerStyle);
          sr.append("\" />");
-         executeMacro(writer, sr.toString());
+         executeMacro(sr.toString());
     }
 
     public void renderContentBody(Appendable writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException {
@@ -435,7 +444,7 @@
             sr.append("\" enableEditValue=\"");
             sr.append(enableEditValue);
             sr.append("\" />");
-            executeMacro(writer, sr.toString());
+            executeMacro(sr.toString());
         }
     }
 
@@ -464,7 +473,7 @@
         sr.append("\" border=\"");
         sr.append(border);
         sr.append("\" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     public void renderSubContentBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.SubContent content) throws IOException {
@@ -482,7 +491,7 @@
          sr.append("\" enableEditValue=\"");
          sr.append(enableEditValue);
          sr.append("\" />");
-         executeMacro(writer, sr.toString());
+         executeMacro(sr.toString());
     }
 
     public void renderSubContentBody(Appendable writer, Map<String, Object> context, ModelScreenWidget.SubContent content) throws IOException {
@@ -575,7 +584,7 @@
          sr.append("\" enableEditValue=\"");
          sr.append(enableEditValue);
          sr.append("\" />");
-         executeMacro(writer, sr.toString());
+         executeMacro(sr.toString());
     }
 
 
@@ -617,7 +626,7 @@
                 }
             }
             if (!collapsed) {
-            	StringBuilder sb = new StringBuilder();
+            	StringWriter sb = new StringWriter();
                 if (navMenu != null) {
                     MenuStringRenderer savedRenderer = (MenuStringRenderer) context.get("menuStringRenderer");
                     MenuStringRenderer renderer = new ScreenletMenuRenderer(request, response);
@@ -658,7 +667,7 @@
         sr.append(" javaScriptEnabled=");
         sr.append(Boolean.toString(javaScriptEnabled));
         sr.append(" />");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     public void renderScreenletSubWidget(Appendable writer, Map<String, Object> context, ModelScreenWidget subWidget, ModelScreenWidget.Screenlet screenlet) throws GeneralException, IOException  {
@@ -682,7 +691,7 @@
     public void renderScreenletEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.Screenlet screenlet) throws IOException {
         StringWriter sr = new StringWriter();
         sr.append("<@renderScreenletEnd/>");
-        executeMacro(writer, sr.toString());
+        executeMacro(sr.toString());
     }
 
     protected void renderScreenletPaginateMenu(Appendable writer, Map<String, Object> context, ModelScreenWidget.Form form) throws IOException {
@@ -770,7 +779,7 @@
         String paginateLastLabel = modelForm.getPaginateLastLabel(context);
         String lastLinkUrl = "";
         if (highIndex < listSize) {
-            int page = (listSize / viewSize) - 1;
+            int page = (listSize / viewSize);
             linkText = prepLinkText + page + anchor;
             lastLinkUrl = rh.makeLink(request, response, linkText);
         }

Modified: ofbiz/branches/release09.04/framework/widget/templates/foScreenMacroLibrary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/branches/release09.04/framework/widget/templates/foScreenMacroLibrary.ftl?rev=767503&r1=767502&r2=767503&view=diff
==============================================================================
--- ofbiz/branches/release09.04/framework/widget/templates/foScreenMacroLibrary.ftl (original)
+++ ofbiz/branches/release09.04/framework/widget/templates/foScreenMacroLibrary.ftl Wed Apr 22 13:01:36 2009
@@ -54,3 +54,4 @@
 <#macro renderScreenletSubWidget></#macro>
 <#macro renderScreenletEnd></#macro>
 
+<#macro renderScreenletPaginateMenu lowIndex actualPageSize ofLabel listSize paginateLastStyle lastLinkUrl paginateLastLabel paginateNextStyle nextLinkUrl paginateNextLabel paginatePreviousStyle paginatePreviousLabel previousLinkUrl paginateFirstStyle paginateFirstLabel firstLinkUrl></#macro>
\ No newline at end of file

Modified: ofbiz/branches/release09.04/framework/widget/templates/htmlScreenMacroLibrary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/branches/release09.04/framework/widget/templates/htmlScreenMacroLibrary.ftl?rev=767503&r1=767502&r2=767503&view=diff
==============================================================================
--- ofbiz/branches/release09.04/framework/widget/templates/htmlScreenMacroLibrary.ftl (original)
+++ ofbiz/branches/release09.04/framework/widget/templates/htmlScreenMacroLibrary.ftl Wed Apr 22 13:01:36 2009
@@ -85,10 +85,10 @@
 </#macro>
 <#macro renderScreenletSubWidget></#macro>
 <#macro renderScreenletEnd></div></div></#macro>
-<#macro renderScreenletPaginateMenu>
-<li class="${paginateLastStyle}<#if lastLinkUrl?has_content>"><a href="${lastLinkUrl}">${paginateLastLabel}</a><#else> disabled">${paginateLastLabel}</#if></li><#rt/>
-<li class="${paginateNextStyle}<#if nextLinkUrl?has_content>"><a href="${nextLinkUrl}">${paginateNextLabel}</a><#else> disabled">${paginateNextLabel}</#if></li><#rt/>
-<#if listSize>0>${lowIndex + 1}" - "${lowIndex + actualPageSize}" "${ofLabel}" "${listSize}<#rt/></#if>
-<li class="${paginatePreviousStyle}<#if previousLinkUrl?has_content>"><a href="${previousLinkUrl}">${paginatePreviousLabel}</a><#else> disabled">${paginatePreviousLabel}</#if></li><#rt/>
-<li class="${paginateFirstStyle}<#if firstLinkUrl?has_content>"><a href="${firstLinkUrl}">${paginateFirstLabel}</a><#else> disabled">${paginateFirstLabel}</#if></li>
+<#macro renderScreenletPaginateMenu lowIndex actualPageSize ofLabel listSize paginateLastStyle lastLinkUrl paginateLastLabel paginateNextStyle nextLinkUrl paginateNextLabel paginatePreviousStyle paginatePreviousLabel previousLinkUrl paginateFirstStyle paginateFirstLabel firstLinkUrl>
+    <li class="${paginateLastStyle}<#if !lastLinkUrl?has_content> disabled</#if>"><#if lastLinkUrl?has_content><a href="${lastLinkUrl}">${paginateLastLabel}</a><#else>${paginateLastLabel}</#if></li>
+    <li class="${paginateNextStyle}<#if !nextLinkUrl?has_content> disabled</#if>"><#if nextLinkUrl?has_content><a href="${nextLinkUrl}">${paginateNextLabel}</a><#else>${paginateNextLabel}</#if></li>
+    <#if (listSize?number > 0) ><li>${lowIndex?number + 1} - ${lowIndex?number + actualPageSize?number} ${ofLabel} ${listSize}</li><#rt/></#if>
+    <li class="${paginatePreviousStyle?default("nav-previous")}<#if !previousLinkUrl?has_content> disabled</#if>"><#if previousLinkUrl?has_content><a href="${previousLinkUrl}">${paginatePreviousLabel}</a><#else>${paginatePreviousLabel}</#if></li>
+    <li class="${paginateFirstStyle?default("nav-first")}<#if !firstLinkUrl?has_content> disabled</#if>"><#if firstLinkUrl?has_content><a href="${firstLinkUrl}">${paginateFirstLabel}</a><#else>${paginateFirstLabel}</#if></li>
 </#macro>

Modified: ofbiz/branches/release09.04/framework/widget/templates/textScreenMacroLibrary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/branches/release09.04/framework/widget/templates/textScreenMacroLibrary.ftl?rev=767503&r1=767502&r2=767503&view=diff
==============================================================================
--- ofbiz/branches/release09.04/framework/widget/templates/textScreenMacroLibrary.ftl (original)
+++ ofbiz/branches/release09.04/framework/widget/templates/textScreenMacroLibrary.ftl Wed Apr 22 13:01:36 2009
@@ -39,3 +39,4 @@
 <#macro renderScreenletSubWidget></#macro>
 <#macro renderScreenletEnd></#macro>
 
+<#macro renderScreenletPaginateMenu lowIndex actualPageSize ofLabel listSize paginateLastStyle lastLinkUrl paginateLastLabel paginateNextStyle nextLinkUrl paginateNextLabel paginatePreviousStyle paginatePreviousLabel previousLinkUrl paginateFirstStyle paginateFirstLabel firstLinkUrl></#macro>

Modified: ofbiz/branches/release09.04/framework/widget/templates/xmlScreenMacroLibrary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/branches/release09.04/framework/widget/templates/xmlScreenMacroLibrary.ftl?rev=767503&r1=767502&r2=767503&view=diff
==============================================================================
--- ofbiz/branches/release09.04/framework/widget/templates/xmlScreenMacroLibrary.ftl (original)
+++ ofbiz/branches/release09.04/framework/widget/templates/xmlScreenMacroLibrary.ftl Wed Apr 22 13:01:36 2009
@@ -44,5 +44,5 @@
 </#macro>
 <#macro renderScreenletSubWidget></#macro>
 <#macro renderScreenletEnd></#macro>
-<#macro renderScreenletPaginateMenu>
+<#macro renderScreenletPaginateMenu lowIndex actualPageSize ofLabel listSize paginateLastStyle lastLinkUrl paginateLastLabel paginateNextStyle nextLinkUrl paginateNextLabel paginatePreviousStyle paginatePreviousLabel previousLinkUrl paginateFirstStyle paginateFirstLabel firstLinkUrl>
 </#macro>
\ No newline at end of file