Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java?rev=662123&r1=662122&r2=662123&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Sat May 31 18:50:41 2008 @@ -18,6 +18,8 @@ *******************************************************************************/ package org.ofbiz.widget.html; +import java.io.IOException; +import java.io.Writer; import java.sql.Timestamp; import java.util.Calendar; import java.util.HashSet; @@ -97,61 +99,63 @@ this.renderPagination = renderPagination; } - public void appendOfbizUrl(StringBuffer buffer, String location) { - buffer.append(this.rh.makeLink(this.request, this.response, location)); + public void appendOfbizUrl(Writer writer, String location) throws IOException { + writer.write(this.rh.makeLink(this.request, this.response, location)); } - public void appendContentUrl(StringBuffer buffer, String location) { + public void appendContentUrl(Writer writer, String location) throws IOException { + StringBuffer buffer = new StringBuffer(); ContentUrlTag.appendContentPrefix(this.request, buffer); - buffer.append(location); + writer.write(buffer.toString()); + writer.write(location); } - public void appendTooltip(StringBuffer buffer, Map context, ModelFormField modelFormField) { + public void appendTooltip(Writer writer, Map<String, Object> context, ModelFormField modelFormField) throws IOException { // render the tooltip, in other methods too String tooltip = modelFormField.getTooltip(context); if (UtilValidate.isNotEmpty(tooltip)) { - buffer.append("<span class=\""); + writer.write("<span class=\""); String tooltipStyle = modelFormField.getTooltipStyle(); if (UtilValidate.isNotEmpty(tooltipStyle)) { - buffer.append(tooltipStyle); + writer.write(tooltipStyle); } else { - buffer.append("tooltip"); + writer.write("tooltip"); } - buffer.append("\">"); - buffer.append(tooltip); - buffer.append("</span>"); + writer.write("\">"); + writer.write(tooltip); + writer.write("</span>"); } } - public void addAstericks(StringBuffer buffer, Map context, ModelFormField modelFormField) { + public void addAsterisks(Writer writer, Map<String, Object> context, ModelFormField modelFormField) throws IOException { boolean requiredField = modelFormField.getRequiredField(); if (requiredField) { String requiredStyle = modelFormField.getRequiredFieldStyle(); if (UtilValidate.isEmpty(requiredStyle)) { - buffer.append("*"); + writer.write("*"); } } } - public void appendClassNames(StringBuffer buffer, Map context, ModelFormField modelFormField) { + public void appendClassNames(Writer writer, Map<String, Object> context, ModelFormField modelFormField) throws IOException { String className = modelFormField.getWidgetStyle(); if (UtilValidate.isNotEmpty(className) || modelFormField.shouldBeRed(context)) { - buffer.append(" class=\""); - buffer.append(className); + writer.write(" class=\""); + writer.write(className); // add a style of red if redWhen is true if (modelFormField.shouldBeRed(context)) { - buffer.append(" alert"); + writer.write(" alert"); } - buffer.append('"'); + writer.write('"'); } } /* (non-Javadoc) - * @see org.ofbiz.widget.form.FormStringRenderer#renderDisplayField(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelFormField.DisplayField) + * @see org.ofbiz.widget.form.FormStringRenderer#renderDisplayField(java.io.Writer, java.util.Map, org.ofbiz.widget.form.ModelFormField.DisplayField) */ - public void renderDisplayField(StringBuffer buffer, Map context, DisplayField displayField) { + public void renderDisplayField(Writer writer, Map<String, Object> context, DisplayField displayField) throws IOException { ModelFormField modelFormField = displayField.getModelFormField(); StringBuffer str = new StringBuffer(); @@ -167,38 +171,38 @@ } if (str.length() > 0) { - buffer.append(str); + writer.write(str.toString()); } String description = displayField.getDescription(context); //Replace new lines with <br/> description = description.replaceAll("\n", "<br/>"); if (UtilValidate.isEmpty(description)) { - this.renderFormatEmptySpace(buffer, context, modelFormField.getModelForm()); + this.renderFormatEmptySpace(writer, context, modelFormField.getModelForm()); } else { - buffer.append(description); + writer.write(description); } if (str.length() > 0) { - buffer.append("</span>"); + writer.write("</span>"); } if (displayField instanceof DisplayEntityField) { - this.makeHyperlinkString(buffer, ((DisplayEntityField) displayField).getSubHyperlink(), context); + this.makeHyperlinkString(writer, ((DisplayEntityField) displayField).getSubHyperlink(), context); } - this.appendTooltip(buffer, context, modelFormField); + this.appendTooltip(writer, context, modelFormField); - //appendWhitespace(buffer); + //appendWhitespace(writer); } /* (non-Javadoc) - * @see org.ofbiz.widget.form.FormStringRenderer#renderHyperlinkField(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelFormField.HyperlinkField) + * @see org.ofbiz.widget.form.FormStringRenderer#renderHyperlinkField(java.io.Writer, java.util.Map, org.ofbiz.widget.form.ModelFormField.HyperlinkField) */ - public void renderHyperlinkField(StringBuffer buffer, Map context, HyperlinkField hyperlinkField) { + public void renderHyperlinkField(Writer writer, Map<String, Object> context, HyperlinkField hyperlinkField) throws IOException { ModelFormField modelFormField = hyperlinkField.getModelFormField(); this.makeHyperlinkString( - buffer, + writer, modelFormField.getWidgetStyle(), hyperlinkField.getTargetType(), hyperlinkField.getTarget(context), @@ -206,18 +210,18 @@ hyperlinkField.getTargetWindow(context), modelFormField.getEvent(), modelFormField.getAction(context)); - this.appendTooltip(buffer, context, modelFormField); - //appendWhitespace(buffer); + this.appendTooltip(writer, context, modelFormField); + //appendWhitespace(writer); } - public void makeHyperlinkString(StringBuffer buffer, ModelFormField.SubHyperlink subHyperlink, Map context) { + public void makeHyperlinkString(Writer writer, ModelFormField.SubHyperlink subHyperlink, Map<String, Object> context) throws IOException { if (subHyperlink == null) { return; } if (subHyperlink.shouldUse(context)) { - buffer.append(' '); + writer.write(' '); this.makeHyperlinkString( - buffer, + writer, subHyperlink.getLinkStyle(), subHyperlink.getTargetType(), subHyperlink.getTarget(context), @@ -227,160 +231,159 @@ } } - public void makeHyperlinkString(StringBuffer buffer, String linkStyle, String targetType, String target, String description, String targetWindow, String event, String action) { - Map context = null; - WidgetWorker.makeHyperlinkString(buffer, linkStyle, targetType, target, description, this.request, this.response, context, targetWindow, event, action); + public void makeHyperlinkString(Writer writer, String linkStyle, String targetType, String target, String description, String targetWindow, String event, String action) throws IOException { + WidgetWorker.makeHyperlinkString(writer, linkStyle, targetType, target, description, this.request, this.response, null, targetWindow, event, action); } /* (non-Javadoc) - * @see org.ofbiz.widget.form.FormStringRenderer#renderTextField(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelFormField.TextField) + * @see org.ofbiz.widget.form.FormStringRenderer#renderTextField(java.io.Writer, java.util.Map, org.ofbiz.widget.form.ModelFormField.TextField) */ - public void renderTextField(StringBuffer buffer, Map context, TextField textField) { + public void renderTextField(Writer writer, Map<String, Object> context, TextField textField) throws IOException { ModelFormField modelFormField = textField.getModelFormField(); - buffer.append("<input type=\"text\""); + writer.write("<input type=\"text\""); - appendClassNames(buffer, context, modelFormField); + appendClassNames(writer, context, modelFormField); - buffer.append(" name=\""); - buffer.append(modelFormField.getParameterName(context)); - buffer.append('"'); + writer.write(" name=\""); + writer.write(modelFormField.getParameterName(context)); + writer.write('"'); String value = modelFormField.getEntry(context, textField.getDefaultValue(context)); if (UtilValidate.isNotEmpty(value)) { - buffer.append(" value=\""); - buffer.append(StringEscapeUtils.escapeHtml(value)); - buffer.append('"'); + writer.write(" value=\""); + writer.write(StringEscapeUtils.escapeHtml(value)); + writer.write('"'); } - buffer.append(" size=\""); - buffer.append(textField.getSize()); - buffer.append('"'); + writer.write(" size=\""); + writer.write(Integer.toString(textField.getSize())); + writer.write('"'); Integer maxlength = textField.getMaxlength(); if (maxlength != null) { - buffer.append(" maxlength=\""); - buffer.append(maxlength.intValue()); - buffer.append('"'); + writer.write(" maxlength=\""); + writer.write(maxlength.toString()); + writer.write('"'); } String idName = modelFormField.getIdName(); if (UtilValidate.isNotEmpty(idName)) { - buffer.append(" id=\""); - buffer.append(idName); - buffer.append('"'); + writer.write(" id=\""); + writer.write(idName); + writer.write('"'); } String event = modelFormField.getEvent(); String action = modelFormField.getAction(context); if (UtilValidate.isNotEmpty(event) && UtilValidate.isNotEmpty(action)) { - buffer.append(" "); - buffer.append(event); - buffer.append("=\""); - buffer.append(action); - buffer.append('"'); + writer.write(" "); + writer.write(event); + writer.write("=\""); + writer.write(action); + writer.write('"'); } List<ModelForm.UpdateArea> updateAreas = modelFormField.getOnChangeUpdateAreas(); boolean ajaxEnabled = updateAreas != null && this.javaScriptEnabled; if (!textField.getClientAutocompleteField() || ajaxEnabled) { - buffer.append(" autocomplete=\"off\""); + writer.write(" autocomplete=\"off\""); } - buffer.append("/>"); + writer.write("/>"); - this.addAstericks(buffer, context, modelFormField); + this.addAsterisks(writer, context, modelFormField); - this.makeHyperlinkString(buffer, textField.getSubHyperlink(), context); + this.makeHyperlinkString(writer, textField.getSubHyperlink(), context); - this.appendTooltip(buffer, context, modelFormField); + this.appendTooltip(writer, context, modelFormField); if (ajaxEnabled) { - appendWhitespace(buffer); - buffer.append("<script language=\"JavaScript\" type=\"text/javascript\">"); - appendWhitespace(buffer); - buffer.append("ajaxAutoCompleter('" + createAjaxParamsFromUpdateAreas(updateAreas, null, context) + "');"); - appendWhitespace(buffer); - buffer.append("</script>"); + appendWhitespace(writer); + writer.write("<script language=\"JavaScript\" type=\"text/javascript\">"); + appendWhitespace(writer); + writer.write("ajaxAutoCompleter('" + createAjaxParamsFromUpdateAreas(updateAreas, null, context) + "');"); + appendWhitespace(writer); + writer.write("</script>"); } - appendWhitespace(buffer); + appendWhitespace(writer); } /* (non-Javadoc) - * @see org.ofbiz.widget.form.FormStringRenderer#renderTextareaField(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelFormField.TextareaField) + * @see org.ofbiz.widget.form.FormStringRenderer#renderTextareaField(java.io.Writer, java.util.Map, org.ofbiz.widget.form.ModelFormField.TextareaField) */ - public void renderTextareaField(StringBuffer buffer, Map context, TextareaField textareaField) { + public void renderTextareaField(Writer writer, Map<String, Object> context, TextareaField textareaField) throws IOException { ModelFormField modelFormField = textareaField.getModelFormField(); - buffer.append("<textarea"); + writer.write("<textarea"); - appendClassNames(buffer, context, modelFormField); + appendClassNames(writer, context, modelFormField); - buffer.append(" name=\""); - buffer.append(modelFormField.getParameterName(context)); - buffer.append('"'); + writer.write(" name=\""); + writer.write(modelFormField.getParameterName(context)); + writer.write('"'); - buffer.append(" cols=\""); - buffer.append(textareaField.getCols()); - buffer.append('"'); + writer.write(" cols=\""); + writer.write(Integer.toString(textareaField.getCols())); + writer.write('"'); - buffer.append(" rows=\""); - buffer.append(textareaField.getRows()); - buffer.append('"'); + writer.write(" rows=\""); + writer.write(Integer.toString(textareaField.getRows())); + writer.write('"'); String idName = modelFormField.getIdName(); if (UtilValidate.isNotEmpty(idName)) { - buffer.append(" id=\""); - buffer.append(idName); - buffer.append('"'); + writer.write(" id=\""); + writer.write(idName); + writer.write('"'); } else if (textareaField.getVisualEditorEnable()) { - buffer.append(" id=\""); - buffer.append("htmlEditArea"); - buffer.append('"'); + writer.write(" id=\""); + writer.write("htmlEditArea"); + writer.write('"'); } if (textareaField.isReadOnly()) { - buffer.append(" readonly"); + writer.write(" readonly"); } - buffer.append('>'); + writer.write('>'); String value = modelFormField.getEntry(context, textareaField.getDefaultValue(context)); if (UtilValidate.isNotEmpty(value)) { - buffer.append(StringEscapeUtils.escapeHtml(value)); + writer.write(StringEscapeUtils.escapeHtml(value)); } - buffer.append("</textarea>"); + writer.write("</textarea>"); if (textareaField.getVisualEditorEnable()) { - buffer.append("<script language=\"javascript\" src=\"/images/htmledit/whizzywig.js\" type=\"text/javascript\"></script>"); - buffer.append("<script language=\"javascript\" type=\"text/javascript\"> buttonPath = \"/images/htmledit/\"; cssFile=\"/images/htmledit/simple.css\";makeWhizzyWig(\""); + writer.write("<script language=\"javascript\" src=\"/images/htmledit/whizzywig.js\" type=\"text/javascript\"></script>"); + writer.write("<script language=\"javascript\" type=\"text/javascript\"> buttonPath = \"/images/htmledit/\"; cssFile=\"/images/htmledit/simple.css\";makeWhizzyWig(\""); if (UtilValidate.isNotEmpty(idName)) { - buffer.append(idName); + writer.write(idName); } else { - buffer.append("htmlEditArea"); + writer.write("htmlEditArea"); } - buffer.append("\",\""); + writer.write("\",\""); String buttons = textareaField.getVisualEditorButtons(context); if (UtilValidate.isNotEmpty(buttons)) { - buffer.append(buttons); + writer.write(buttons); } else { - buffer.append("all"); + writer.write("all"); } - buffer.append("\") </script>"); + writer.write("\") </script>"); } - this.addAstericks(buffer, context, modelFormField); + this.addAsterisks(writer, context, modelFormField); - this.appendTooltip(buffer, context, modelFormField); + this.appendTooltip(writer, context, modelFormField); - //appendWhitespace(buffer); + //appendWhitespace(writer); } /* (non-Javadoc) - * @see org.ofbiz.widget.form.FormStringRenderer#renderDateTimeField(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelFormField.DateTimeField) + * @see org.ofbiz.widget.form.FormStringRenderer#renderDateTimeField(java.io.Writer, java.util.Map, org.ofbiz.widget.form.ModelFormField.DateTimeField) */ - public void renderDateTimeField(StringBuffer buffer, Map context, DateTimeField dateTimeField) { + public void renderDateTimeField(Writer writer, Map<String, Object> context, DateTimeField dateTimeField) throws IOException { ModelFormField modelFormField = dateTimeField.getModelFormField(); String paramName = modelFormField.getParameterName(context); String defaultDateTimeString = dateTimeField.getDefaultDateTimeString(context); @@ -394,17 +397,17 @@ // whether the date field is short form, yyyy-mm-dd boolean shortDateInput = ("date".equals(dateTimeField.getType()) || "time-dropdown".equals(dateTimeField.getInputMethod()) ? true : false); - buffer.append("<input type=\"text\""); + writer.write("<input type=\"text\""); - appendClassNames(buffer, context, modelFormField); + appendClassNames(writer, context, modelFormField); - buffer.append(" name=\""); + writer.write(" name=\""); if ("time-dropdown".equals(dateTimeField.getInputMethod())) { - buffer.append(UtilHttp.makeCompositeParam(paramName, "date")); + writer.write(UtilHttp.makeCompositeParam(paramName, "date")); } else { - buffer.append(paramName); + writer.write(paramName); } - buffer.append('"'); + writer.write('"'); // the default values for a timestamp int size = 25; @@ -425,36 +428,36 @@ localizedInputTitle = (String) uiLabelMap.get("CommonFormatDateTime"); } } - buffer.append(" title=\""); - buffer.append(localizedInputTitle); - buffer.append('"'); + writer.write(" title=\""); + writer.write(localizedInputTitle); + writer.write('"'); String value = modelFormField.getEntry(context, dateTimeField.getDefaultValue(context)); if (UtilValidate.isNotEmpty(value)) { if(value.length() > maxlength) { value = value.substring(0, maxlength); } - buffer.append(" value=\""); - buffer.append(value); - buffer.append('"'); + writer.write(" value=\""); + writer.write(value); + writer.write('"'); } - buffer.append(" size=\""); - buffer.append(size); - buffer.append('"'); - - buffer.append(" maxlength=\""); - buffer.append(maxlength); - buffer.append('"'); + writer.write(" size=\""); + writer.write(Integer.toString(size)); + writer.write('"'); + + writer.write(" maxlength=\""); + writer.write(Integer.toString(maxlength)); + writer.write('"'); String idName = modelFormField.getIdName(); if (UtilValidate.isNotEmpty(idName)) { - buffer.append(" id=\""); - buffer.append(idName); - buffer.append('"'); + writer.write(" id=\""); + writer.write(idName); + writer.write('"'); } - buffer.append("/>"); + writer.write("/>"); // search for a localized label for the icon if (uiLabelMap != null) { @@ -464,28 +467,28 @@ // add calendar pop-up button and seed data IF this is not a "time" type date-time if (!"time".equals(dateTimeField.getType())) { if (shortDateInput) { - buffer.append("<a href=\"javascript:call_cal_notime(document."); + writer.write("<a href=\"javascript:call_cal_notime(document."); } else { - buffer.append("<a href=\"javascript:call_cal(document."); + writer.write("<a href=\"javascript:call_cal(document."); } - buffer.append(modelFormField.getModelForm().getCurrentFormName(context)); - buffer.append('.'); + writer.write(modelFormField.getModelForm().getCurrentFormName(context)); + writer.write('.'); if ("time-dropdown".equals(dateTimeField.getInputMethod())) { - buffer.append(UtilHttp.makeCompositeParam(paramName, "date")); + writer.write(UtilHttp.makeCompositeParam(paramName, "date")); } else { - buffer.append(paramName); + writer.write(paramName); } - buffer.append(",'"); - buffer.append(UtilHttp.encodeBlanks(modelFormField.getEntry(context, defaultDateTimeString))); - buffer.append("');\">"); + writer.write(",'"); + writer.write(UtilHttp.encodeBlanks(modelFormField.getEntry(context, defaultDateTimeString))); + writer.write("');\">"); - buffer.append("<img src=\""); - this.appendContentUrl(buffer, "/images/cal.gif"); - buffer.append("\" width=\"16\" height=\"16\" border=\"0\" alt=\""); - buffer.append(localizedIconTitle); - buffer.append("\" title=\""); - buffer.append(localizedIconTitle); - buffer.append("\"/></a>"); + writer.write("<img src=\""); + this.appendContentUrl(writer, "/images/cal.gif"); + writer.write("\" width=\"16\" height=\"16\" border=\"0\" alt=\""); + writer.write(localizedIconTitle); + writer.write("\" title=\""); + writer.write(localizedIconTitle); + writer.write("\"/></a>"); } // if we have an input method of time-dropdown, then render two dropdowns @@ -506,145 +509,145 @@ } // write the select for hours - buffer.append(" <select name=\"").append(UtilHttp.makeCompositeParam(paramName, "hour")).append("\""); - buffer.append(classString).append(">"); + writer.write(" <select name=\"" + UtilHttp.makeCompositeParam(paramName, "hour") + "\""); + writer.write(classString + ">"); // keep the two cases separate because it's hard to understand a combined loop if (isTwelveHour) { for (int i = 1; i <= 12; i++) { - buffer.append("<option value=\"").append(i).append("\""); + writer.write("<option value=\"" + Integer.toString(i) + "\""); if (cal != null) { int hour = cal.get(Calendar.HOUR_OF_DAY); if (hour == 0) hour = 12; if (hour > 12) hour -= 12; - if (i == hour) buffer.append(" selected"); + if (i == hour) writer.write(" selected"); } - buffer.append(">").append(i).append("</option>"); + writer.write(">" + Integer.toString(i) + "</option>"); } } else { for (int i = 0; i < 24; i++) { - buffer.append("<option value=\"").append(i).append("\""); + writer.write("<option value=\"" + Integer.toString(i) + "\""); if (cal != null && i == cal.get(Calendar.HOUR_OF_DAY)) { - buffer.append(" selected"); + writer.write(" selected"); } - buffer.append(">").append(i).append("</option>"); + writer.write(">" + Integer.toString(i) + "</option>"); } } // write the select for minutes - buffer.append("</select>:<select name=\""); - buffer.append(UtilHttp.makeCompositeParam(paramName, "minutes")).append("\""); - buffer.append(classString).append(">"); + writer.write("</select>:<select name=\""); + writer.write(UtilHttp.makeCompositeParam(paramName, "minutes") + "\""); + writer.write(classString + ">"); for (int i = 0; i < 60; i++) { - buffer.append("<option value=\"").append(i).append("\""); + writer.write("<option value=\"" + Integer.toString(i) + "\""); if (cal != null && i == cal.get(Calendar.MINUTE)) { - buffer.append(" selected"); + writer.write(" selected"); } - buffer.append(">").append(i).append("</option>"); + writer.write(">" + Integer.toString(i) + "</option>"); } - buffer.append("</select>"); + writer.write("</select>"); // if 12 hour clock, write the AM/PM selector if (isTwelveHour) { String amSelected = ((cal != null && cal.get(Calendar.AM_PM) == Calendar.AM) ? "selected" : ""); String pmSelected = ((cal != null && cal.get(Calendar.AM_PM) == Calendar.PM) ? "selected" : ""); - buffer.append("<select name=\"").append(UtilHttp.makeCompositeParam(paramName, "ampm")).append("\""); - buffer.append(classString).append(">"); - buffer.append("<option value=\"").append("AM").append("\" ").append(amSelected).append(">AM</option>"); - buffer.append("<option value=\"").append("PM").append("\" ").append(pmSelected).append(">PM</option>"); - buffer.append("</select>"); + writer.write("<select name=\"" + UtilHttp.makeCompositeParam(paramName, "ampm") + "\""); + writer.write(classString + ">"); + writer.write("<option value=\"" + "AM" + "\" " + amSelected + ">AM</option>"); + writer.write("<option value=\"" + "PM" + "\" " + pmSelected + ">PM</option>"); + writer.write("</select>"); } // create a hidden field for the composite type, which is a Timestamp - buffer.append("<input type=\"hidden\" name=\""); - buffer.append(UtilHttp.makeCompositeParam(paramName, "compositeType")); - buffer.append("\" value=\"Timestamp\"/>"); + writer.write("<input type=\"hidden\" name=\""); + writer.write(UtilHttp.makeCompositeParam(paramName, "compositeType")); + writer.write("\" value=\"Timestamp\"/>"); } - this.appendTooltip(buffer, context, modelFormField); + this.appendTooltip(writer, context, modelFormField); - //appendWhitespace(buffer); + //appendWhitespace(writer); } /* (non-Javadoc) - * @see org.ofbiz.widget.form.FormStringRenderer#renderDropDownField(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelFormField.DropDownField) + * @see org.ofbiz.widget.form.FormStringRenderer#renderDropDownField(java.io.Writer, java.util.Map, org.ofbiz.widget.form.ModelFormField.DropDownField) */ - public void renderDropDownField(StringBuffer buffer, Map context, DropDownField dropDownField) { + public void renderDropDownField(Writer writer, Map<String, Object> context, DropDownField dropDownField) throws IOException { ModelFormField modelFormField = dropDownField.getModelFormField(); ModelForm modelForm = modelFormField.getModelForm(); String event = modelFormField.getEvent(); String action = modelFormField.getAction(context); - buffer.append("<select"); + writer.write("<select"); - appendClassNames(buffer, context, modelFormField); + appendClassNames(writer, context, modelFormField); - buffer.append(" name=\""); - buffer.append(modelFormField.getParameterName(context)); - buffer.append('"'); + writer.write(" name=\""); + writer.write(modelFormField.getParameterName(context)); + writer.write('"'); String idName = modelFormField.getIdName(); if (UtilValidate.isNotEmpty(idName)) { - buffer.append(" id=\""); - buffer.append(idName); - buffer.append('"'); + writer.write(" id=\""); + writer.write(idName); + writer.write('"'); } if (dropDownField.isAllowMultiple()) { - buffer.append(" multiple=\"multiple\""); + writer.write(" multiple=\"multiple\""); } int otherFieldSize = dropDownField.getOtherFieldSize(); String otherFieldName = dropDownField.getParameterNameOther(context); if (otherFieldSize > 0) { - //buffer.append(" onchange=\"alert('ONCHANGE, process_choice:' + process_choice)\""); - //buffer.append(" onchange='test_js()' "); - buffer.append(" onchange=\"process_choice(this,document."); - buffer.append(modelForm.getName()); - buffer.append("."); - buffer.append(otherFieldName); - buffer.append(")\" "); + //writer.write(" onchange=\"alert('ONCHANGE, process_choice:' + process_choice)\""); + //writer.write(" onchange='test_js()' "); + writer.write(" onchange=\"process_choice(this,document."); + writer.write(modelForm.getName()); + writer.write("."); + writer.write(otherFieldName); + writer.write(")\" "); } if (UtilValidate.isNotEmpty(event) && UtilValidate.isNotEmpty(action)) { - buffer.append(" "); - buffer.append(event); - buffer.append("=\""); - buffer.append(action); - buffer.append('"'); + writer.write(" "); + writer.write(event); + writer.write("=\""); + writer.write(action); + writer.write('"'); } - buffer.append(" size=\"").append(dropDownField.getSize()).append("\">"); + writer.write(" size=\"" + dropDownField.getSize() + "\">"); String currentValue = modelFormField.getEntry(context); List allOptionValues = dropDownField.getAllOptionValues(context, modelForm.getDelegator(context)); // if the current value should go first, stick it in if (UtilValidate.isNotEmpty(currentValue) && "first-in-list".equals(dropDownField.getCurrent())) { - buffer.append("<option"); - buffer.append(" selected=\"selected\""); - buffer.append(" value=\""); - buffer.append(currentValue); - buffer.append("\">"); + writer.write("<option"); + writer.write(" selected=\"selected\""); + writer.write(" value=\""); + writer.write(currentValue); + writer.write("\">"); String explicitDescription = dropDownField.getCurrentDescription(context); if (UtilValidate.isNotEmpty(explicitDescription)) { - buffer.append(explicitDescription); + writer.write(explicitDescription); } else { - buffer.append(ModelFormField.FieldInfoWithOptions.getDescriptionForOptionKey(currentValue, allOptionValues)); + writer.write(ModelFormField.FieldInfoWithOptions.getDescriptionForOptionKey(currentValue, allOptionValues)); } - buffer.append("</option>"); + writer.write("</option>"); // add a "separator" option - buffer.append("<option value=\""); - buffer.append(currentValue); - buffer.append("\">---</option>"); + writer.write("<option value=\""); + writer.write(currentValue); + writer.write("\">---</option>"); } // if allow empty is true, add an empty option if (dropDownField.isAllowEmpty()) { - buffer.append("<option value=\"\"> </option>"); + writer.write("<option value=\"\"> </option>"); } // list out all options according to the option list @@ -652,21 +655,21 @@ while (optionValueIter.hasNext()) { ModelFormField.OptionValue optionValue = (ModelFormField.OptionValue) optionValueIter.next(); String noCurrentSelectedKey = dropDownField.getNoCurrentSelectedKey(context); - buffer.append("<option"); + writer.write("<option"); // if current value should be selected in the list, select it if (UtilValidate.isNotEmpty(currentValue) && currentValue.equals(optionValue.getKey()) && "selected".equals(dropDownField.getCurrent())) { - buffer.append(" selected=\"selected\""); + writer.write(" selected=\"selected\""); } else if (UtilValidate.isEmpty(currentValue) && noCurrentSelectedKey != null && noCurrentSelectedKey.equals(optionValue.getKey())) { - buffer.append(" selected=\"selected\""); + writer.write(" selected=\"selected\""); } - buffer.append(" value=\""); - buffer.append(optionValue.getKey()); - buffer.append("\">"); - buffer.append(optionValue.getDescription()); - buffer.append("</option>"); + writer.write(" value=\""); + writer.write(optionValue.getKey()); + writer.write("\">"); + writer.write(optionValue.getDescription()); + writer.write("</option>"); } - buffer.append("</select>"); + writer.write("</select>"); // Adapted from work by Yucca Korpela // http://www.cs.tut.fi/~jkorpela/forms/combo.html @@ -680,50 +683,50 @@ Object otherValueObj = dataMap.get(otherFieldName); String otherValue = (otherValueObj == null) ? "" : otherValueObj.toString(); - buffer.append("<noscript>"); - buffer.append("<input type='text' name='"); - buffer.append(otherFieldName); - buffer.append("'/> "); - buffer.append("</noscript>"); - buffer.append("\n<script type='text/javascript' language='JavaScript'><!--"); - buffer.append("\ndisa = ' disabled';"); - buffer.append("\nif(other_choice(document."); - buffer.append(modelForm.getName()); - buffer.append("."); - buffer.append(fieldName); - buffer.append(")) disa = '';"); - buffer.append("\ndocument.write(\"<input type="); - buffer.append("'text' name='"); - buffer.append(otherFieldName); - buffer.append("' value='"); - buffer.append(otherValue); - buffer.append("' size='"); - buffer.append(otherFieldSize); - buffer.append("' "); - buffer.append("\" +disa+ \" onfocus='check_choice(document."); - buffer.append(modelForm.getName()); - buffer.append("."); - buffer.append(fieldName); - buffer.append(")'/>\");"); - buffer.append("\nif(disa && document.styleSheets)"); - buffer.append(" document."); - buffer.append(modelForm.getName()); - buffer.append("."); - buffer.append(otherFieldName); - buffer.append(".style.visibility = 'hidden';"); - buffer.append("\n//--></script>"); - } - this.makeHyperlinkString(buffer, dropDownField.getSubHyperlink(), context); - - this.appendTooltip(buffer, context, modelFormField); + writer.write("<noscript>"); + writer.write("<input type='text' name='"); + writer.write(otherFieldName); + writer.write("'/> "); + writer.write("</noscript>"); + writer.write("\n<script type='text/javascript' language='JavaScript'><!--"); + writer.write("\ndisa = ' disabled';"); + writer.write("\nif(other_choice(document."); + writer.write(modelForm.getName()); + writer.write("."); + writer.write(fieldName); + writer.write(")) disa = '';"); + writer.write("\ndocument.write(\"<input type="); + writer.write("'text' name='"); + writer.write(otherFieldName); + writer.write("' value='"); + writer.write(otherValue); + writer.write("' size='"); + writer.write(Integer.toString(otherFieldSize)); + writer.write("' "); + writer.write("\" +disa+ \" onfocus='check_choice(document."); + writer.write(modelForm.getName()); + writer.write("."); + writer.write(fieldName); + writer.write(")'/>\");"); + writer.write("\nif(disa && document.styleSheets)"); + writer.write(" document."); + writer.write(modelForm.getName()); + writer.write("."); + writer.write(otherFieldName); + writer.write(".style.visibility = 'hidden';"); + writer.write("\n//--></script>"); + } + this.makeHyperlinkString(writer, dropDownField.getSubHyperlink(), context); + + this.appendTooltip(writer, context, modelFormField); - //appendWhitespace(buffer); + //appendWhitespace(writer); } /* (non-Javadoc) - * @see org.ofbiz.widget.form.FormStringRenderer#renderCheckField(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelFormField.CheckField) + * @see org.ofbiz.widget.form.FormStringRenderer#renderCheckField(java.io.Writer, java.util.Map, org.ofbiz.widget.form.ModelFormField.CheckField) */ - public void renderCheckField(StringBuffer buffer, Map context, CheckField checkField) { + public void renderCheckField(Writer writer, Map<String, Object> context, CheckField checkField) throws IOException { ModelFormField modelFormField = checkField.getModelFormField(); ModelForm modelForm = modelFormField.getModelForm(); String currentValue = modelFormField.getEntry(context); @@ -738,47 +741,47 @@ while (optionValueIter.hasNext()) { ModelFormField.OptionValue optionValue = (ModelFormField.OptionValue) optionValueIter.next(); - buffer.append("<input type=\"checkbox\""); + writer.write("<input type=\"checkbox\""); - appendClassNames(buffer, context, modelFormField); + appendClassNames(writer, context, modelFormField); // if current value should be selected in the list, select it if (Boolean.TRUE.equals(allChecked)) { - buffer.append(" checked=\"checked\""); + writer.write(" checked=\"checked\""); } else if (Boolean.FALSE.equals(allChecked)) { // do nothing } else if (UtilValidate.isNotEmpty(currentValue) && currentValue.equals(optionValue.getKey())) { - buffer.append(" checked=\"checked\""); + writer.write(" checked=\"checked\""); } - buffer.append(" name=\""); - buffer.append(modelFormField.getParameterName(context)); - buffer.append('"'); - buffer.append(" value=\""); - buffer.append(optionValue.getKey()); - buffer.append("\""); + writer.write(" name=\""); + writer.write(modelFormField.getParameterName(context)); + writer.write('"'); + writer.write(" value=\""); + writer.write(optionValue.getKey()); + writer.write("\""); if (UtilValidate.isNotEmpty(event) && UtilValidate.isNotEmpty(action)) { - buffer.append(" "); - buffer.append(event); - buffer.append("=\""); - buffer.append(action); - buffer.append('"'); + writer.write(" "); + writer.write(event); + writer.write("=\""); + writer.write(action); + writer.write('"'); } - buffer.append("/>"); + writer.write("/>"); - buffer.append(optionValue.getDescription()); + writer.write(optionValue.getDescription()); } - this.appendTooltip(buffer, context, modelFormField); + this.appendTooltip(writer, context, modelFormField); - //appendWhitespace(buffer); + //appendWhitespace(writer); } /* (non-Javadoc) - * @see org.ofbiz.widget.form.FormStringRenderer#renderRadioField(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelFormField.RadioField) + * @see org.ofbiz.widget.form.FormStringRenderer#renderRadioField(java.io.Writer, java.util.Map, org.ofbiz.widget.form.ModelFormField.RadioField) */ - public void renderRadioField(StringBuffer buffer, Map context, RadioField radioField) { + public void renderRadioField(Writer writer, Map<String, Object> context, RadioField radioField) throws IOException { ModelFormField modelFormField = radioField.getModelFormField(); ModelForm modelForm = modelFormField.getModelForm(); List allOptionValues = radioField.getAllOptionValues(context, modelForm.getDelegator(context)); @@ -791,97 +794,97 @@ while (optionValueIter.hasNext()) { ModelFormField.OptionValue optionValue = (ModelFormField.OptionValue) optionValueIter.next(); - buffer.append("<div"); + writer.write("<div"); - appendClassNames(buffer, context, modelFormField); + appendClassNames(writer, context, modelFormField); - buffer.append("><input type=\"radio\""); + writer.write("><input type=\"radio\""); // if current value should be selected in the list, select it String noCurrentSelectedKey = radioField.getNoCurrentSelectedKey(context); if (UtilValidate.isNotEmpty(currentValue) && currentValue.equals(optionValue.getKey())) { - buffer.append(" checked=\"checked\""); + writer.write(" checked=\"checked\""); } else if (UtilValidate.isEmpty(currentValue) && noCurrentSelectedKey != null && noCurrentSelectedKey.equals(optionValue.getKey())) { - buffer.append(" checked=\"checked\""); + writer.write(" checked=\"checked\""); } - buffer.append(" name=\""); - buffer.append(modelFormField.getParameterName(context)); - buffer.append('"'); - buffer.append(" value=\""); - buffer.append(optionValue.getKey()); - buffer.append("\""); + writer.write(" name=\""); + writer.write(modelFormField.getParameterName(context)); + writer.write('"'); + writer.write(" value=\""); + writer.write(optionValue.getKey()); + writer.write("\""); if (UtilValidate.isNotEmpty(event) && UtilValidate.isNotEmpty(action)) { - buffer.append(" "); - buffer.append(event); - buffer.append("=\""); - buffer.append(action); - buffer.append('"'); + writer.write(" "); + writer.write(event); + writer.write("=\""); + writer.write(action); + writer.write('"'); } - buffer.append("/>"); + writer.write("/>"); - buffer.append(optionValue.getDescription()); - buffer.append("</div>"); + writer.write(optionValue.getDescription()); + writer.write("</div>"); } - this.appendTooltip(buffer, context, modelFormField); + this.appendTooltip(writer, context, modelFormField); - //appendWhitespace(buffer); + //appendWhitespace(writer); } /* (non-Javadoc) - * @see org.ofbiz.widget.form.FormStringRenderer#renderSubmitField(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelFormField.SubmitField) + * @see org.ofbiz.widget.form.FormStringRenderer#renderSubmitField(java.io.Writer, java.util.Map, org.ofbiz.widget.form.ModelFormField.SubmitField) */ - public void renderSubmitField(StringBuffer buffer, Map context, SubmitField submitField) { + public void renderSubmitField(Writer writer, Map<String, Object> context, SubmitField submitField) throws IOException { ModelFormField modelFormField = submitField.getModelFormField(); ModelForm modelForm = modelFormField.getModelForm(); String event = null; String action = null; if ("text-link".equals(submitField.getButtonType())) { - buffer.append("<a"); + writer.write("<a"); - appendClassNames(buffer, context, modelFormField); + appendClassNames(writer, context, modelFormField); - buffer.append(" href=\"javascript:document."); - buffer.append(modelForm.getCurrentFormName(context)); - buffer.append(".submit()\">"); + writer.write(" href=\"javascript:document."); + writer.write(modelForm.getCurrentFormName(context)); + writer.write(".submit()\">"); - buffer.append(modelFormField.getTitle(context)); + writer.write(modelFormField.getTitle(context)); - buffer.append("</a>"); + writer.write("</a>"); } else if ("image".equals(submitField.getButtonType())) { - buffer.append("<input type=\"image\""); + writer.write("<input type=\"image\""); - appendClassNames(buffer, context, modelFormField); + appendClassNames(writer, context, modelFormField); - buffer.append(" name=\""); - buffer.append(modelFormField.getParameterName(context)); - buffer.append('"'); + writer.write(" name=\""); + writer.write(modelFormField.getParameterName(context)); + writer.write('"'); String title = modelFormField.getTitle(context); if (UtilValidate.isNotEmpty(title)) { - buffer.append(" alt=\""); - buffer.append(title); - buffer.append('"'); + writer.write(" alt=\""); + writer.write(title); + writer.write('"'); } - buffer.append(" src=\""); - this.appendContentUrl(buffer, submitField.getImageLocation()); - buffer.append('"'); + writer.write(" src=\""); + this.appendContentUrl(writer, submitField.getImageLocation()); + writer.write('"'); event = modelFormField.getEvent(); action = modelFormField.getAction(context); if (UtilValidate.isNotEmpty(event) && UtilValidate.isNotEmpty(action)) { - buffer.append(" "); - buffer.append(event); - buffer.append("=\""); - buffer.append(action); - buffer.append('"'); + writer.write(" "); + writer.write(event); + writer.write("=\""); + writer.write(action); + writer.write('"'); } - buffer.append("/>"); + writer.write("/>"); } else { // default to "button" @@ -899,148 +902,148 @@ boolean ajaxEnabled = (updateAreas != null || UtilValidate.isNotEmpty(backgroundSubmitRefreshTarget)) && this.javaScriptEnabled; if (ajaxEnabled) { - buffer.append("<input type=\"button\""); + writer.write("<input type=\"button\""); } else { - buffer.append("<input type=\"submit\""); + writer.write("<input type=\"submit\""); } - appendClassNames(buffer, context, modelFormField); + appendClassNames(writer, context, modelFormField); - buffer.append(" name=\""); - buffer.append(modelFormField.getParameterName(context)); - buffer.append('"'); + writer.write(" name=\""); + writer.write(modelFormField.getParameterName(context)); + writer.write('"'); String title = modelFormField.getTitle(context); if (UtilValidate.isNotEmpty(title)) { - buffer.append(" value=\""); - buffer.append(title); - buffer.append('"'); + writer.write(" value=\""); + writer.write(title); + writer.write('"'); } event = modelFormField.getEvent(); action = modelFormField.getAction(context); if (UtilValidate.isNotEmpty(event) && UtilValidate.isNotEmpty(action)) { - buffer.append(" "); - buffer.append(event); - buffer.append("=\""); - buffer.append(action); - buffer.append('"'); + writer.write(" "); + writer.write(event); + writer.write("=\""); + writer.write(action); + writer.write('"'); } else { //add single click JS onclick - // disabling for now, using form onSubmit action instead: buffer.append(singleClickAction); + // disabling for now, using form onSubmit action instead: writer.write(singleClickAction); } if (ajaxEnabled) { - buffer.append(" onclick=\""); - buffer.append("ajaxSubmitFormUpdateAreas($('"); - buffer.append(formId); - buffer.append("'), '" + createAjaxParamsFromUpdateAreas(updateAreas, null, context)); - buffer.append("')\""); + writer.write(" onclick=\""); + writer.write("ajaxSubmitFormUpdateAreas($('"); + writer.write(formId); + writer.write("'), '" + createAjaxParamsFromUpdateAreas(updateAreas, null, context)); + writer.write("')\""); } - buffer.append("/>"); + writer.write("/>"); } - this.appendTooltip(buffer, context, modelFormField); + this.appendTooltip(writer, context, modelFormField); - //appendWhitespace(buffer); + //appendWhitespace(writer); } /* (non-Javadoc) - * @see org.ofbiz.widget.form.FormStringRenderer#renderResetField(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelFormField.ResetField) + * @see org.ofbiz.widget.form.FormStringRenderer#renderResetField(java.io.Writer, java.util.Map, org.ofbiz.widget.form.ModelFormField.ResetField) */ - public void renderResetField(StringBuffer buffer, Map context, ResetField resetField) { + public void renderResetField(Writer writer, Map<String, Object> context, ResetField resetField) throws IOException { ModelFormField modelFormField = resetField.getModelFormField(); - buffer.append("<input type=\"reset\""); + writer.write("<input type=\"reset\""); - appendClassNames(buffer, context, modelFormField); + appendClassNames(writer, context, modelFormField); - buffer.append(" name=\""); - buffer.append(modelFormField.getParameterName(context)); - buffer.append('"'); + writer.write(" name=\""); + writer.write(modelFormField.getParameterName(context)); + writer.write('"'); String title = modelFormField.getTitle(context); if (UtilValidate.isNotEmpty(title)) { - buffer.append(" value=\""); - buffer.append(title); - buffer.append('"'); + writer.write(" value=\""); + writer.write(title); + writer.write('"'); } - buffer.append("/>"); + writer.write("/>"); - this.appendTooltip(buffer, context, modelFormField); + this.appendTooltip(writer, context, modelFormField); - //appendWhitespace(buffer); + //appendWhitespace(writer); } /* (non-Javadoc) - * @see org.ofbiz.widget.form.FormStringRenderer#renderHiddenField(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelFormField.HiddenField) + * @see org.ofbiz.widget.form.FormStringRenderer#renderHiddenField(java.io.Writer, java.util.Map, org.ofbiz.widget.form.ModelFormField.HiddenField) */ - public void renderHiddenField(StringBuffer buffer, Map context, HiddenField hiddenField) { + public void renderHiddenField(Writer writer, Map<String, Object> context, HiddenField hiddenField) throws IOException { ModelFormField modelFormField = hiddenField.getModelFormField(); String value = hiddenField.getValue(context); - this.renderHiddenField(buffer, context, modelFormField, value); + this.renderHiddenField(writer, context, modelFormField, value); } - public void renderHiddenField(StringBuffer buffer, Map context, ModelFormField modelFormField, String value) { - buffer.append("<input type=\"hidden\""); + public void renderHiddenField(Writer writer, Map<String, Object> context, ModelFormField modelFormField, String value) throws IOException { + writer.write("<input type=\"hidden\""); - buffer.append(" name=\""); - buffer.append(modelFormField.getParameterName(context)); - buffer.append('"'); + writer.write(" name=\""); + writer.write(modelFormField.getParameterName(context)); + writer.write('"'); if (UtilValidate.isNotEmpty(value)) { - buffer.append(" value=\""); - buffer.append(StringEscapeUtils.escapeHtml(value)); - buffer.append('"'); + writer.write(" value=\""); + writer.write(StringEscapeUtils.escapeHtml(value)); + writer.write('"'); } - buffer.append("/>"); - appendWhitespace(buffer); + writer.write("/>"); + appendWhitespace(writer); } /* (non-Javadoc) - * @see org.ofbiz.widget.form.FormStringRenderer#renderIgnoredField(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelFormField.IgnoredField) + * @see org.ofbiz.widget.form.FormStringRenderer#renderIgnoredField(java.io.Writer, java.util.Map, org.ofbiz.widget.form.ModelFormField.IgnoredField) */ - public void renderIgnoredField(StringBuffer buffer, Map context, IgnoredField ignoredField) { + public void renderIgnoredField(Writer writer, Map<String, Object> context, IgnoredField ignoredField) throws IOException { // do nothing, it's an ignored field; could add a comment or something if we wanted to } /* (non-Javadoc) - * @see org.ofbiz.widget.form.FormStringRenderer#renderFieldTitle(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelFormField) + * @see org.ofbiz.widget.form.FormStringRenderer#renderFieldTitle(java.io.Writer, java.util.Map, org.ofbiz.widget.form.ModelFormField) */ - public void renderFieldTitle(StringBuffer buffer, Map context, ModelFormField modelFormField) { + public void renderFieldTitle(Writer writer, Map<String, Object> context, ModelFormField modelFormField) throws IOException { String tempTitleText = modelFormField.getTitle(context); String titleText = UtilHttp.encodeAmpersands(tempTitleText); if (UtilValidate.isNotEmpty(titleText)) { if (UtilValidate.isNotEmpty(modelFormField.getTitleStyle())) { - buffer.append("<span class=\""); - buffer.append(modelFormField.getTitleStyle()); - buffer.append("\">"); + writer.write("<span class=\""); + writer.write(modelFormField.getTitleStyle()); + writer.write("\">"); } if (" ".equals(titleText)) { // If the title content is just a blank then render it colling renderFormatEmptySpace: // the method will set its content to work fine in most browser - this.renderFormatEmptySpace(buffer, context, modelFormField.getModelForm()); + this.renderFormatEmptySpace(writer, context, modelFormField.getModelForm()); } else { - renderHyperlinkTitle(buffer, context, modelFormField, titleText); + renderHyperlinkTitle(writer, context, modelFormField, titleText); } if (UtilValidate.isNotEmpty(modelFormField.getTitleStyle())) { - buffer.append("</span>"); + writer.write("</span>"); } - //appendWhitespace(buffer); + //appendWhitespace(writer); } } /* (non-Javadoc) - * @see org.ofbiz.widget.form.FormStringRenderer#renderFieldTitle(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelFormField) + * @see org.ofbiz.widget.form.FormStringRenderer#renderFieldTitle(java.io.Writer, java.util.Map, org.ofbiz.widget.form.ModelFormField) */ - public void renderSingleFormFieldTitle(StringBuffer buffer, Map context, ModelFormField modelFormField) { + public void renderSingleFormFieldTitle(Writer writer, Map<String, Object> context, ModelFormField modelFormField) throws IOException { boolean requiredField = modelFormField.getRequiredField(); if (requiredField) { @@ -1050,113 +1053,113 @@ } if (UtilValidate.isNotEmpty(requiredStyle)) { - buffer.append("<span class=\""); - buffer.append(requiredStyle); - buffer.append("\">"); + writer.write("<span class=\""); + writer.write(requiredStyle); + writer.write("\">"); } - renderHyperlinkTitle(buffer, context, modelFormField, modelFormField.getTitle(context)); + renderHyperlinkTitle(writer, context, modelFormField, modelFormField.getTitle(context)); if (UtilValidate.isNotEmpty(requiredStyle)) { - buffer.append("</span>"); + writer.write("</span>"); } - //appendWhitespace(buffer); + //appendWhitespace(writer); } else { - renderFieldTitle(buffer, context, modelFormField); + renderFieldTitle(writer, context, modelFormField); } } /* (non-Javadoc) - * @see org.ofbiz.widget.form.FormStringRenderer#renderFormOpen(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelForm) + * @see org.ofbiz.widget.form.FormStringRenderer#renderFormOpen(java.io.Writer, java.util.Map, org.ofbiz.widget.form.ModelForm) */ - public void renderFormOpen(StringBuffer buffer, Map context, ModelForm modelForm) { - renderBeginningBoundaryComment(buffer, "Form Widget", modelForm); - buffer.append("<form method=\"post\" "); + public void renderFormOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException { + renderBeginningBoundaryComment(writer, "Form Widget", modelForm); + writer.write("<form method=\"post\" "); String targetType = modelForm.getTargetType(); String targ = modelForm.getTarget(context, targetType); // The 'action' attribute is mandatory in a form definition, // even if it is empty. - buffer.append(" action=\""); + writer.write(" action=\""); if (targ != null && targ.length() > 0) { - //this.appendOfbizUrl(buffer, "/" + targ); - WidgetWorker.buildHyperlinkUrl(buffer, targ, targetType, request, response, context); + //this.appendOfbizUrl(writer, "/" + targ); + WidgetWorker.buildHyperlinkUrl(writer, targ, targetType, request, response, context); } - buffer.append("\" "); + writer.write("\" "); String formType = modelForm.getType(); if (formType.equals("upload") ) { - buffer.append(" enctype=\"multipart/form-data\""); + writer.write(" enctype=\"multipart/form-data\""); } String targetWindow = modelForm.getTargetWindow(context); if (UtilValidate.isNotEmpty(targetWindow)) { - buffer.append(" target=\""); - buffer.append(targetWindow); - buffer.append("\""); + writer.write(" target=\""); + writer.write(targetWindow); + writer.write("\""); } String containerId = modelForm.getContainerId(); if (UtilValidate.isNotEmpty(containerId)) { - buffer.append(" id=\""); - buffer.append(containerId); - buffer.append("\""); + writer.write(" id=\""); + writer.write(containerId); + writer.write("\""); } - buffer.append(" class=\""); + writer.write(" class=\""); String containerStyle = modelForm.getContainerStyle(); if (UtilValidate.isNotEmpty(containerStyle)) { - buffer.append(containerStyle); + writer.write(containerStyle); } else { - buffer.append("basic-form"); + writer.write("basic-form"); } - buffer.append("\""); + writer.write("\""); - buffer.append(" onSubmit=\"javascript:submitFormDisableSubmits(this)\""); + writer.write(" onSubmit=\"javascript:submitFormDisableSubmits(this)\""); if (!modelForm.getClientAutocompleteFields()) { - buffer.append(" autocomplete=\"off\""); + writer.write(" autocomplete=\"off\""); } - buffer.append(" name=\""); - buffer.append(modelForm.getCurrentFormName(context)); - buffer.append("\">"); + writer.write(" name=\""); + writer.write(modelForm.getCurrentFormName(context)); + writer.write("\">"); - appendWhitespace(buffer); + appendWhitespace(writer); } /* (non-Javadoc) - * @see org.ofbiz.widget.form.FormStringRenderer#renderFormClose(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelForm) + * @see org.ofbiz.widget.form.FormStringRenderer#renderFormClose(java.io.Writer, java.util.Map, org.ofbiz.widget.form.ModelForm) */ - public void renderFormClose(StringBuffer buffer, Map context, ModelForm modelForm) { - buffer.append("</form>"); + public void renderFormClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException { + writer.write("</form>"); String focusFieldName = modelForm.getfocusFieldName(); if (UtilValidate.isNotEmpty(focusFieldName)) { - appendWhitespace(buffer); - buffer.append("<script language=\"JavaScript\" type=\"text/javascript\">"); - appendWhitespace(buffer); - buffer.append("document." + modelForm.getCurrentFormName(context) + "."); - buffer.append(focusFieldName + ".focus();"); - appendWhitespace(buffer); - buffer.append("</script>"); + appendWhitespace(writer); + writer.write("<script language=\"JavaScript\" type=\"text/javascript\">"); + appendWhitespace(writer); + writer.write("document." + modelForm.getCurrentFormName(context) + "."); + writer.write(focusFieldName + ".focus();"); + appendWhitespace(writer); + writer.write("</script>"); } - appendWhitespace(buffer); - renderEndingBoundaryComment(buffer, "Form Widget", modelForm); + appendWhitespace(writer); + renderEndingBoundaryComment(writer, "Form Widget", modelForm); } /* (non-Javadoc) - * @see org.ofbiz.widget.form.FormStringRenderer#renderFormClose(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelForm) + * @see org.ofbiz.widget.form.FormStringRenderer#renderFormClose(java.io.Writer, java.util.Map, org.ofbiz.widget.form.ModelForm) */ - public void renderMultiFormClose(StringBuffer buffer, Map context, ModelForm modelForm) { + public void renderMultiFormClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException { String rowCount = modelForm.getPassedRowCount(context); if (UtilValidate.isEmpty(rowCount)) { int rCount = modelForm.getRowCount(); rowCount = Integer.toString(rCount); } if (UtilValidate.isNotEmpty(rowCount)) { - buffer.append("<input type=\"hidden\" name=\"_rowCount\" value=\"" + rowCount + "\"/>"); + writer.write("<input type=\"hidden\" name=\"_rowCount\" value=\"" + rowCount + "\"/>"); } boolean useRowSubmit = modelForm.getUseRowSubmit(); if (useRowSubmit) { - buffer.append("<input type=\"hidden\" name=\"_useRowSubmit\" value=\"Y\"/>"); + writer.write("<input type=\"hidden\" name=\"_useRowSubmit\" value=\"Y\"/>"); } Iterator submitFields = modelForm.getMultiSubmitFields().iterator(); @@ -1171,23 +1174,23 @@ // we cannot call here the methods renderFormatItemRowCell*: for this reason // they are now commented. - // this.renderFormatItemRowCellOpen(buffer, context, modelForm, submitField); - // this.renderFormatItemRowCellClose(buffer, context, modelForm, submitField); + // this.renderFormatItemRowCellOpen(writer, context, modelForm, submitField); + // this.renderFormatItemRowCellClose(writer, context, modelForm, submitField); - // this.renderFormatItemRowCellOpen(buffer, context, modelForm, submitField); + // this.renderFormatItemRowCellOpen(writer, context, modelForm, submitField); - submitField.renderFieldString(buffer, context, this); + submitField.renderFieldString(writer, context, this); - // this.renderFormatItemRowCellClose(buffer, context, modelForm, submitField); + // this.renderFormatItemRowCellClose(writer, context, modelForm, submitField); } } - buffer.append("</form>"); - appendWhitespace(buffer); - renderEndingBoundaryComment(buffer, "Form Widget", modelForm); + writer.write("</form>"); + appendWhitespace(writer); + renderEndingBoundaryComment(writer, "Form Widget", modelForm); } - public void renderFormatListWrapperOpen(StringBuffer buffer, Map context, ModelForm modelForm) { + public void renderFormatListWrapperOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException { String queryString = null; if (UtilValidate.isNotEmpty((String)context.get("queryString"))) { @@ -1202,325 +1205,325 @@ } context.put("_QBESTRING_", queryString); - renderBeginningBoundaryComment(buffer, "Form Widget", modelForm); + renderBeginningBoundaryComment(writer, "Form Widget", modelForm); if (this.renderPagination) { - this.renderNextPrev(buffer, context, modelForm); + this.renderNextPrev(writer, context, modelForm); } - buffer.append(" <table cellspacing=\"0\" class=\""); + writer.write(" <table cellspacing=\"0\" class=\""); if(UtilValidate.isNotEmpty(modelForm.getDefaultTableStyle())) { - buffer.append(modelForm.getDefaultTableStyle()); + writer.write(modelForm.getDefaultTableStyle()); } else { - buffer.append("basic-table form-widget-table dark-grid"); + writer.write("basic-table form-widget-table dark-grid"); } - buffer.append("\">"); - appendWhitespace(buffer); + writer.write("\">"); + appendWhitespace(writer); } - public void renderFormatListWrapperClose(StringBuffer buffer, Map context, ModelForm modelForm) { - buffer.append(" </table>"); + public void renderFormatListWrapperClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException { + writer.write(" </table>"); - appendWhitespace(buffer); + appendWhitespace(writer); if (this.renderPagination) { - this.renderNextPrev(buffer, context, modelForm); + this.renderNextPrev(writer, context, modelForm); } - renderEndingBoundaryComment(buffer, "Form Widget", modelForm); + renderEndingBoundaryComment(writer, "Form Widget", modelForm); } /* (non-Javadoc) - * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatHeaderRowOpen(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelForm) + * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatHeaderRowOpen(java.io.Writer, java.util.Map, org.ofbiz.widget.form.ModelForm) */ - public void renderFormatHeaderRowOpen(StringBuffer buffer, Map context, ModelForm modelForm) { - buffer.append(" <tr"); + public void renderFormatHeaderRowOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException { + writer.write(" <tr"); String headerStyle = modelForm.getHeaderRowStyle(); - buffer.append(" class=\""); + writer.write(" class=\""); if (UtilValidate.isNotEmpty(headerStyle)) { - buffer.append(headerStyle); + writer.write(headerStyle); } else { - buffer.append("header-row"); + writer.write("header-row"); } - buffer.append("\">"); - appendWhitespace(buffer); + writer.write("\">"); + appendWhitespace(writer); } /* (non-Javadoc) - * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatHeaderRowClose(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelForm) + * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatHeaderRowClose(java.io.Writer, java.util.Map, org.ofbiz.widget.form.ModelForm) */ - public void renderFormatHeaderRowClose(StringBuffer buffer, Map context, ModelForm modelForm) { - buffer.append(" </tr>"); + public void renderFormatHeaderRowClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException { + writer.write(" </tr>"); - appendWhitespace(buffer); + appendWhitespace(writer); } /* (non-Javadoc) - * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatHeaderRowCellOpen(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelForm, org.ofbiz.widget.form.ModelFormField, int positionSpan) + * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatHeaderRowCellOpen(java.io.Writer, java.util.Map, org.ofbiz.widget.form.ModelForm, org.ofbiz.widget.form.ModelFormField, int positionSpan) */ - public void renderFormatHeaderRowCellOpen(StringBuffer buffer, Map context, ModelForm modelForm, ModelFormField modelFormField, int positionSpan) { - buffer.append(" <td"); + public void renderFormatHeaderRowCellOpen(Writer writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField, int positionSpan) throws IOException { + writer.write(" <td"); String areaStyle = modelFormField.getTitleAreaStyle(); if (positionSpan > 1) { - buffer.append(" colspan=\""); - buffer.append(positionSpan); - buffer.append("\""); + writer.write(" colspan=\""); + writer.write(Integer.toString(positionSpan)); + writer.write("\""); } if (UtilValidate.isNotEmpty(areaStyle)) { - buffer.append(" class=\""); - buffer.append(areaStyle); - buffer.append("\""); + writer.write(" class=\""); + writer.write(areaStyle); + writer.write("\""); } - buffer.append(">"); - //appendWhitespace(buffer); + writer.write(">"); + //appendWhitespace(writer); } /* (non-Javadoc) - * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatHeaderRowCellClose(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelForm, org.ofbiz.widget.form.ModelFormField) + * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatHeaderRowCellClose(java.io.Writer, java.util.Map, org.ofbiz.widget.form.ModelForm, org.ofbiz.widget.form.ModelFormField) */ - public void renderFormatHeaderRowCellClose(StringBuffer buffer, Map context, ModelForm modelForm, ModelFormField modelFormField) { - buffer.append("</td>"); - appendWhitespace(buffer); + public void renderFormatHeaderRowCellClose(Writer writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField) throws IOException { + writer.write("</td>"); + appendWhitespace(writer); } - public void renderFormatHeaderRowFormCellOpen(StringBuffer buffer, Map context, ModelForm modelForm) { - buffer.append(" <td"); + public void renderFormatHeaderRowFormCellOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException { + writer.write(" <td"); String areaStyle = modelForm.getFormTitleAreaStyle(); if (UtilValidate.isNotEmpty(areaStyle)) { - buffer.append(" class=\""); - buffer.append(areaStyle); - buffer.append("\""); + writer.write(" class=\""); + writer.write(areaStyle); + writer.write("\""); } - buffer.append(">"); - //appendWhitespace(buffer); + writer.write(">"); + //appendWhitespace(writer); } /* (non-Javadoc) - * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatHeaderRowFormCellClose(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelForm) + * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatHeaderRowFormCellClose(java.io.Writer, java.util.Map, org.ofbiz.widget.form.ModelForm) */ - public void renderFormatHeaderRowFormCellClose(StringBuffer buffer, Map context, ModelForm modelForm) { - buffer.append("</td>"); - appendWhitespace(buffer); + public void renderFormatHeaderRowFormCellClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException { + writer.write("</td>"); + appendWhitespace(writer); } /* (non-Javadoc) - * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatHeaderRowFormCellTitleSeparator(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelForm, boolean) + * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatHeaderRowFormCellTitleSeparator(java.io.Writer, java.util.Map, org.ofbiz.widget.form.ModelForm, boolean) */ - public void renderFormatHeaderRowFormCellTitleSeparator(StringBuffer buffer, Map context, ModelForm modelForm, ModelFormField modelFormField, boolean isLast) { + public void renderFormatHeaderRowFormCellTitleSeparator(Writer writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField, boolean isLast) throws IOException { String titleStyle = modelFormField.getTitleStyle(); if (UtilValidate.isNotEmpty(titleStyle)) { - buffer.append("<span class=\""); - buffer.append(titleStyle); - buffer.append("\">"); + writer.write("<span class=\""); + writer.write(titleStyle); + writer.write("\">"); } if (isLast) { - buffer.append(" - "); + writer.write(" - "); } else { - buffer.append(" - "); + writer.write(" - "); } if (UtilValidate.isNotEmpty(titleStyle)) { - buffer.append("</span>"); + writer.write("</span>"); } } /* (non-Javadoc) - * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatItemRowOpen(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelForm) + * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatItemRowOpen(java.io.Writer, java.util.Map, org.ofbiz.widget.form.ModelForm) */ - public void renderFormatItemRowOpen(StringBuffer buffer, Map context, ModelForm modelForm) { + public void renderFormatItemRowOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException { Integer itemIndex = (Integer)context.get("itemIndex"); - buffer.append(" <tr"); + writer.write(" <tr"); if (itemIndex!=null) { if (itemIndex.intValue()%2==0) { String evenRowStyle = modelForm.getEvenRowStyle(); if (UtilValidate.isNotEmpty(evenRowStyle)) { - buffer.append(" class=\""); - buffer.append(evenRowStyle); - buffer.append("\""); + writer.write(" class=\""); + writer.write(evenRowStyle); + writer.write("\""); } } else { String oddRowStyle = modelForm.getOddRowStyle(); if (UtilValidate.isNotEmpty(oddRowStyle)) { - buffer.append(" class=\""); - buffer.append(oddRowStyle); - buffer.append("\""); + writer.write(" class=\""); + writer.write(oddRowStyle); + writer.write("\""); } } } - buffer.append(">"); - appendWhitespace(buffer); + writer.write(">"); + appendWhitespace(writer); } /* (non-Javadoc) - * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatItemRowClose(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelForm) + * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatItemRowClose(java.io.Writer, java.util.Map, org.ofbiz.widget.form.ModelForm) */ - public void renderFormatItemRowClose(StringBuffer buffer, Map context, ModelForm modelForm) { - buffer.append(" </tr>"); + public void renderFormatItemRowClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException { + writer.write(" </tr>"); - appendWhitespace(buffer); + appendWhitespace(writer); } /* (non-Javadoc) - * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatItemRowCellOpen(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelForm, org.ofbiz.widget.form.ModelFormField) + * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatItemRowCellOpen(java.io.Writer, java.util.Map, org.ofbiz.widget.form.ModelForm, org.ofbiz.widget.form.ModelFormField) */ - public void renderFormatItemRowCellOpen(StringBuffer buffer, Map context, ModelForm modelForm, ModelFormField modelFormField, int positionSpan) { - buffer.append(" <td"); + public void renderFormatItemRowCellOpen(Writer writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField, int positionSpan) throws IOException { + writer.write(" <td"); String areaStyle = modelFormField.getWidgetAreaStyle(); if (positionSpan > 1) { - buffer.append(" colspan=\""); - buffer.append(positionSpan); - buffer.append("\""); + writer.write(" colspan=\""); + writer.write(Integer.toString(positionSpan)); + writer.write("\""); } if (UtilValidate.isNotEmpty(areaStyle)) { - buffer.append(" class=\""); - buffer.append(areaStyle); - buffer.append("\""); + writer.write(" class=\""); + writer.write(areaStyle); + writer.write("\""); } - buffer.append(">"); - //appendWhitespace(buffer); + writer.write(">"); + //appendWhitespace(writer); } /* (non-Javadoc) - * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatItemRowCellClose(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelForm, org.ofbiz.widget.form.ModelFormField) + * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatItemRowCellClose(java.io.Writer, java.util.Map, org.ofbiz.widget.form.ModelForm, org.ofbiz.widget.form.ModelFormField) */ - public void renderFormatItemRowCellClose(StringBuffer buffer, Map context, ModelForm modelForm, ModelFormField modelFormField) { - buffer.append("</td>"); - appendWhitespace(buffer); + public void renderFormatItemRowCellClose(Writer writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField) throws IOException { + writer.write("</td>"); + appendWhitespace(writer); } /* (non-Javadoc) - * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatItemRowFormCellOpen(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelForm) + * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatItemRowFormCellOpen(java.io.Writer, java.util.Map, org.ofbiz.widget.form.ModelForm) */ - public void renderFormatItemRowFormCellOpen(StringBuffer buffer, Map context, ModelForm modelForm) { - buffer.append(" <td"); + public void renderFormatItemRowFormCellOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException { + writer.write(" <td"); String areaStyle = modelForm.getFormWidgetAreaStyle(); if (UtilValidate.isNotEmpty(areaStyle)) { - buffer.append(" class=\""); - buffer.append(areaStyle); - buffer.append("\""); + writer.write(" class=\""); + writer.write(areaStyle); + writer.write("\""); } - buffer.append(">"); - //appendWhitespace(buffer); + writer.write(">"); + //appendWhitespace(writer); } /* (non-Javadoc) - * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatItemRowFormCellClose(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelForm) + * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatItemRowFormCellClose(java.io.Writer, java.util.Map, org.ofbiz.widget.form.ModelForm) */ - public void renderFormatItemRowFormCellClose(StringBuffer buffer, Map context, ModelForm modelForm) { - buffer.append("</td>"); - appendWhitespace(buffer); + public void renderFormatItemRowFormCellClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException { + writer.write("</td>"); + appendWhitespace(writer); } - public void renderFormatSingleWrapperOpen(StringBuffer buffer, Map context, ModelForm modelForm) { - buffer.append(" <table cellspacing=\"0\""); + public void renderFormatSingleWrapperOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException { + writer.write(" <table cellspacing=\"0\""); if(UtilValidate.isNotEmpty(modelForm.getDefaultTableStyle())) { - buffer.append(" class=\"" + modelForm.getDefaultTableStyle() + "\""); + writer.write(" class=\"" + modelForm.getDefaultTableStyle() + "\""); } - buffer.append(">"); - appendWhitespace(buffer); + writer.write(">"); + appendWhitespace(writer); } - public void renderFormatSingleWrapperClose(StringBuffer buffer, Map context, ModelForm modelForm) { - buffer.append(" </table>"); - appendWhitespace(buffer); + public void renderFormatSingleWrapperClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException { + writer.write(" </table>"); + appendWhitespace(writer); } /* (non-Javadoc) - * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatFieldRowOpen(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelForm) + * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatFieldRowOpen(java.io.Writer, java.util.Map, org.ofbiz.widget.form.ModelForm) */ - public void renderFormatFieldRowOpen(StringBuffer buffer, Map context, ModelForm modelForm) { - buffer.append(" <tr>"); - appendWhitespace(buffer); + public void renderFormatFieldRowOpen(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException { + writer.write(" <tr>"); + appendWhitespace(writer); } /* (non-Javadoc) - * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatFieldRowClose(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelForm) + * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatFieldRowClose(java.io.Writer, java.util.Map, org.ofbiz.widget.form.ModelForm) */ - public void renderFormatFieldRowClose(StringBuffer buffer, Map context, ModelForm modelForm) { - buffer.append(" </tr>"); - appendWhitespace(buffer); + public void renderFormatFieldRowClose(Writer writer, Map<String, Object> context, ModelForm modelForm) throws IOException { + writer.write(" </tr>"); + appendWhitespace(writer); } /* (non-Javadoc) - * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatFieldRowTitleCellOpen(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelFormField) + * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatFieldRowTitleCellOpen(java.io.Writer, java.util.Map, org.ofbiz.widget.form.ModelFormField) */ - public void renderFormatFieldRowTitleCellOpen(StringBuffer buffer, Map context, ModelFormField modelFormField) { - buffer.append(" <td"); + public void renderFormatFieldRowTitleCellOpen(Writer writer, Map<String, Object> context, ModelFormField modelFormField) throws IOException { + writer.write(" <td"); String areaStyle = modelFormField.getTitleAreaStyle(); if (UtilValidate.isNotEmpty(areaStyle)) { - buffer.append(" class=\""); - buffer.append(areaStyle); - buffer.append("\""); + writer.write(" class=\""); + writer.write(areaStyle); + writer.write("\""); } else { - buffer.append(" class=\"label\""); + writer.write(" class=\"label\""); } - buffer.append(">"); - //appendWhitespace(buffer); + writer.write(">"); + //appendWhitespace(writer); } /* (non-Javadoc) - * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatFieldRowTitleCellClose(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelFormField) + * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatFieldRowTitleCellClose(java.io.Writer, java.util.Map, org.ofbiz.widget.form.ModelFormField) */ - public void renderFormatFieldRowTitleCellClose(StringBuffer buffer, Map context, ModelFormField modelFormField) { - buffer.append("</td>"); - appendWhitespace(buffer); + public void renderFormatFieldRowTitleCellClose(Writer writer, Map<String, Object> context, ModelFormField modelFormField) throws IOException { + writer.write("</td>"); + appendWhitespace(writer); } /* (non-Javadoc) - * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatFieldRowSpacerCell(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelFormField) [... 1344 lines stripped ...] |
Free forum by Nabble | Edit this page |