Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java?rev=662328&r1=662327&r2=662328&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java Sun Jun 1 22:27:12 2008 @@ -61,7 +61,7 @@ this.response = response; } - public void appendOfbizUrl(Writer writer, String location) throws IOException { + public void appendOfbizUrl(Appendable writer, String location) throws IOException { ServletContext ctx = (ServletContext) request.getAttribute("servletContext"); if (ctx == null) { //if (Debug.infoOn()) Debug.logInfo("in appendOfbizUrl, ctx is null(0): buffer=" + buffer.toString() + " location:" + location, ""); @@ -86,10 +86,10 @@ if (s.indexOf("null") >= 0) { //if (Debug.infoOn()) Debug.logInfo("in appendOfbizUrl(3), url: " + s, ""); } - writer.write(s); + writer.append(s); } - public void appendContentUrl(Writer writer, String location) throws IOException { + public void appendContentUrl(Appendable writer, String location) throws IOException { ServletContext ctx = (ServletContext) this.request.getAttribute("servletContext"); if (ctx == null) { //if (Debug.infoOn()) Debug.logInfo("in appendContentUrl, ctx is null(0): buffer=" + buffer.toString() + " location:" + location, ""); @@ -111,28 +111,28 @@ } StringBuffer buffer = new StringBuffer(); ContentUrlTag.appendContentPrefix(this.request, buffer); - writer.write(buffer.toString()); - writer.write(location); + writer.append(buffer.toString()); + writer.append(location); } - public void appendTooltip(Writer writer, Map<String, Object> context, ModelMenuItem modelMenuItem) throws IOException { + public void appendTooltip(Appendable writer, Map<String, Object> context, ModelMenuItem modelMenuItem) throws IOException { // render the tooltip String tooltip = modelMenuItem.getTooltip(context); if (UtilValidate.isNotEmpty(tooltip)) { - writer.write("<span class=\""); + writer.append("<span class=\""); String tooltipStyle = modelMenuItem.getTooltipStyle(); if (UtilValidate.isNotEmpty(tooltipStyle)) { - writer.write(tooltipStyle); + writer.append(tooltipStyle); } else { - writer.write("tooltip"); + writer.append("tooltip"); } - writer.write("\""); - writer.write(tooltip); - writer.write("</span>"); + writer.append("\""); + writer.append(tooltip); + writer.append("</span>"); } } - public void renderFormatSimpleWrapperRows(Writer writer, Map<String, Object> context, Object menuObj) throws IOException { + public void renderFormatSimpleWrapperRows(Appendable writer, Map<String, Object> context, Object menuObj) throws IOException { List menuItemList = ((ModelMenu)menuObj).getMenuItemList(); Iterator menuItemIter = menuItemList.iterator(); @@ -144,7 +144,7 @@ } } - public void renderMenuItem(Writer writer, Map<String, Object> context, ModelMenuItem menuItem) throws IOException { + public void renderMenuItem(Appendable writer, Map<String, Object> context, ModelMenuItem menuItem) throws IOException { //Debug.logInfo("in renderMenuItem, menuItem:" + menuItem.getName() + " context:" + context ,""); boolean hideThisItem = isHideIfSelected(menuItem, context); @@ -165,19 +165,19 @@ style = menuItem.getDisabledTitleStyle(); } - writer.write(" <li"); + writer.append(" <li"); String alignStyle = menuItem.getAlignStyle(); if (UtilValidate.isNotEmpty(style) || UtilValidate.isNotEmpty(alignStyle)) { - writer.write(" class=\""); + writer.append(" class=\""); if (UtilValidate.isNotEmpty(style)) { - writer.write(style + " "); + writer.append(style + " "); } if (UtilValidate.isNotEmpty(alignStyle)) { - writer.write(alignStyle); + writer.append(alignStyle); } - writer.write("\""); + writer.append("\""); } - writer.write(">"); + writer.append(">"); Link link = menuItem.getLink(); //if (Debug.infoOn()) Debug.logInfo("in HtmlMenuRendererImage, link(0):" + link,""); @@ -185,7 +185,7 @@ renderLink(writer, context, link); } - writer.write("</li>"); + writer.append("</li>"); appendWhitespace(writer); } @@ -215,7 +215,7 @@ return divStr; } */ - public void renderMenuOpen(Writer writer, Map<String, Object> context, ModelMenu modelMenu) throws IOException { + public void renderMenuOpen(Appendable writer, Map<String, Object> context, ModelMenu modelMenu) throws IOException { if (!userLoginIdHasChanged) { userLoginIdHasChanged = userLoginIdHasChanged(); @@ -223,30 +223,30 @@ //Debug.logInfo("in HtmlMenuRenderer, userLoginIdHasChanged:" + userLoginIdHasChanged,""); renderBeginningBoundaryComment(writer, "Menu Widget", modelMenu); - writer.write("<div"); + writer.append("<div"); String menuId = modelMenu.getId(); if (UtilValidate.isNotEmpty(menuId)) { - writer.write(" id=\"" + menuId + "\""); + writer.append(" id=\"" + menuId + "\""); } else { // TODO: Remove else after UI refactor - allow both id and style String menuContainerStyle = modelMenu.getMenuContainerStyle(context); if (UtilValidate.isNotEmpty(menuContainerStyle)) { - writer.write(" class=\"" + menuContainerStyle + "\""); + writer.append(" class=\"" + menuContainerStyle + "\""); } } String menuWidth = modelMenu.getMenuWidth(); // TODO: Eliminate embedded styling after refactor if (UtilValidate.isNotEmpty(menuWidth)) { - writer.write(" style=\"width:" + menuWidth + ";\""); + writer.append(" style=\"width:" + menuWidth + ";\""); } - writer.write(">"); + writer.append(">"); String menuTitle = modelMenu.getTitle(context); if (UtilValidate.isNotEmpty(menuTitle)) { appendWhitespace(writer); - writer.write(" <h2>" + menuTitle + "</h2>"); + writer.append(" <h2>" + menuTitle + "</h2>"); } appendWhitespace(writer); - writer.write(" <ul>"); + writer.append(" <ul>"); appendWhitespace(writer); } @@ -254,17 +254,17 @@ /* (non-Javadoc) * @see org.ofbiz.widget.menu.MenuStringRenderer#renderMenuClose(java.io.Writer, java.util.Map, org.ofbiz.widget.menu.ModelMenu) */ - public void renderMenuClose(Writer writer, Map<String, Object> context, ModelMenu modelMenu) throws IOException { + public void renderMenuClose(Appendable writer, Map<String, Object> context, ModelMenu modelMenu) throws IOException { String fillStyle = modelMenu.getFillStyle(); if (UtilValidate.isNotEmpty(fillStyle)) { - writer.write("<div class=\"" + fillStyle + "\"> </div>"); + writer.append("<div class=\"" + fillStyle + "\"> </div>"); } //String menuContainerStyle = modelMenu.getMenuContainerStyle(context); - writer.write(" </ul>"); + writer.append(" </ul>"); appendWhitespace(writer); - writer.write(" <br class=\"clear\"/>"); + writer.append(" <br class=\"clear\"/>"); appendWhitespace(writer); - writer.write("</div>"); + writer.append("</div>"); appendWhitespace(writer); renderEndingBoundaryComment(writer, "Menu Widget", modelMenu); @@ -280,11 +280,11 @@ } } - public void renderFormatSimpleWrapperOpen(Writer writer, Map<String, Object> context, ModelMenu modelMenu) throws IOException { + public void renderFormatSimpleWrapperOpen(Appendable writer, Map<String, Object> context, ModelMenu modelMenu) throws IOException { //appendWhitespace(writer); } - public void renderFormatSimpleWrapperClose(Writer writer, Map<String, Object> context, ModelMenu modelMenu) throws IOException { + public void renderFormatSimpleWrapperClose(Appendable writer, Map<String, Object> context, ModelMenu modelMenu) throws IOException { //appendWhitespace(writer); } @@ -359,7 +359,7 @@ return title; } - public void renderLink(Writer writer, Map<String, Object> context, ModelMenuItem.Link link) throws IOException { + public void renderLink(Appendable writer, Map<String, Object> context, ModelMenuItem.Link link) throws IOException { ModelMenuItem menuItem = link.getLinkMenuItem(); String target = link.getTarget(context); if (menuItem.getDisabled()) { @@ -367,12 +367,12 @@ } if (UtilValidate.isNotEmpty(target)) { // open tag - writer.write("<a"); + writer.append("<a"); String id = link.getId(context); if (UtilValidate.isNotEmpty(id)) { - writer.write(" id=\""); - writer.write(id); - writer.write("\""); + writer.append(" id=\""); + writer.append(id); + writer.append("\""); } /* @@ -395,24 +395,24 @@ } if (UtilValidate.isNotEmpty(style)) { - writer.write(" class=\""); - writer.write(style); - writer.write("\""); + writer.append(" class=\""); + writer.append(style); + writer.append("\""); } */ String name = link.getName(context); if (UtilValidate.isNotEmpty(name)) { - writer.write(" name=\""); - writer.write(name); - writer.write("\""); + writer.append(" name=\""); + writer.append(name); + writer.append("\""); } String targetWindow = link.getTargetWindow(context); if (UtilValidate.isNotEmpty(targetWindow)) { - writer.write(" target=\""); - writer.write(targetWindow); - writer.write("\""); + writer.append(" target=\""); + writer.append(targetWindow); + writer.append("\""); } - writer.write(" href=\""); + writer.append(" href=\""); String urlMode = link.getUrlMode(); String prefix = link.getPrefix(context); boolean fullPath = link.getFullPath(); @@ -425,17 +425,17 @@ ServletContext ctx = (ServletContext) req.getAttribute("servletContext"); RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_"); String urlString = rh.makeLink(req, res, target, fullPath, secure, encode); - writer.write(urlString); + writer.append(urlString); } else if (prefix != null) { - writer.write(prefix + target); + writer.append(prefix + target); } else { - writer.write(target); + writer.append(target); } } else if (urlMode != null && urlMode.equalsIgnoreCase("content")) { StringBuffer newURL = new StringBuffer(); ContentUrlTag.appendContentPrefix(req, newURL); newURL.append(target); - writer.write(newURL.toString()); + writer.append(newURL.toString()); } else if ("inter-app".equalsIgnoreCase(urlMode) && req != null) { String externalLoginKey = (String) req.getAttribute("externalLoginKey"); if (UtilValidate.isNotEmpty(externalLoginKey)) { @@ -444,63 +444,63 @@ } else { target += "?externalLoginKey=" + externalLoginKey; } - writer.write(target); + writer.append(target); } } else { - writer.write(target); + writer.append(target); } - writer.write("\">"); + writer.append("\">"); } // the text Image img = link.getImage(); if (img == null) - writer.write(link.getText(context)); + writer.append(link.getText(context)); else renderImage(writer, context, img); if (UtilValidate.isNotEmpty(target)) { // close tag - writer.write("</a>"); + writer.append("</a>"); } } - public void renderImage(Writer writer, Map<String, Object> context, ModelMenuItem.Image image) throws IOException { + public void renderImage(Appendable writer, Map<String, Object> context, ModelMenuItem.Image image) throws IOException { // open tag - writer.write("<img "); + writer.append("<img "); String id = image.getId(context); if (UtilValidate.isNotEmpty(id)) { - writer.write(" id=\""); - writer.write(id); - writer.write("\""); + writer.append(" id=\""); + writer.append(id); + writer.append("\""); } String style = image.getStyle(context); if (UtilValidate.isNotEmpty(style)) { - writer.write(" class=\""); - writer.write(style); - writer.write("\""); + writer.append(" class=\""); + writer.append(style); + writer.append("\""); } String wid = image.getWidth(context); if (UtilValidate.isNotEmpty(wid)) { - writer.write(" width=\""); - writer.write(wid); - writer.write("\""); + writer.append(" width=\""); + writer.append(wid); + writer.append("\""); } String hgt = image.getHeight(context); if (UtilValidate.isNotEmpty(hgt)) { - writer.write(" height=\""); - writer.write(hgt); - writer.write("\""); + writer.append(" height=\""); + writer.append(hgt); + writer.append("\""); } String border = image.getBorder(context); if (UtilValidate.isNotEmpty(border)) { - writer.write(" border=\""); - writer.write(border); - writer.write("\""); + writer.append(" border=\""); + writer.append(border); + writer.append("\""); } String src = image.getSrc(context); if (UtilValidate.isNotEmpty(src)) { - writer.write(" src=\""); + writer.append(" src=\""); String urlMode = image.getUrlMode(); boolean fullPath = false; boolean secure = false; @@ -512,24 +512,24 @@ ServletContext ctx = (ServletContext) request.getAttribute("servletContext"); RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_"); String urlString = rh.makeLink(request, response, src, fullPath, secure, encode); - writer.write(urlString); + writer.append(urlString); } else { - writer.write(src); + writer.append(src); } } else if (urlMode != null && urlMode.equalsIgnoreCase("content")) { if (request != null && response != null) { StringBuffer newURL = new StringBuffer(); ContentUrlTag.appendContentPrefix(request, newURL); newURL.append(src); - writer.write(newURL.toString()); + writer.append(newURL.toString()); } } else { - writer.write(src); + writer.append(src); } - writer.write("\""); + writer.append("\""); } - writer.write("/>"); + writer.append("/>"); } } Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java?rev=662328&r1=662327&r2=662328&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java Sun Jun 1 22:27:12 2008 @@ -67,14 +67,14 @@ return "hsr" + elementId; } - public void renderSectionBegin(Writer writer, Map<String, Object> context, ModelScreenWidget.Section section) throws IOException { + public void renderSectionBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.Section section) throws IOException { renderBeginningBoundaryComment(writer, section.isMainSection?"Screen":"Section Widget", section); } - public void renderSectionEnd(Writer writer, Map<String, Object> context, ModelScreenWidget.Section section) throws IOException { + public void renderSectionEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.Section section) throws IOException { renderEndingBoundaryComment(writer, section.isMainSection?"Screen":"Section Widget", section); } - public void renderContainerBegin(Writer writer, Map<String, Object> context, ModelScreenWidget.Container container) throws IOException { + public void renderContainerBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.Container container) throws IOException { String containerId = container.getId(context); String autoUpdateTarget = container.getAutoUpdateTargetExdr(context); HttpServletRequest request = (HttpServletRequest) context.get("request"); @@ -86,95 +86,95 @@ ServletContext ctx = (ServletContext) request.getAttribute("servletContext"); RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_"); - writer.write("<script type=\"text/javascript\">ajaxUpdateAreaPeriodic('"); - writer.write(containerId); - writer.write("', '"); - writer.write(rh.makeLink(request, response, autoUpdateTarget)); - writer.write("', '"); - writer.write("', '" + container.getAutoUpdateInterval() + "');</script>"); + writer.append("<script type=\"text/javascript\">ajaxUpdateAreaPeriodic('"); + writer.append(containerId); + writer.append("', '"); + writer.append(rh.makeLink(request, response, autoUpdateTarget)); + writer.append("', '"); + writer.append("', '" + container.getAutoUpdateInterval() + "');</script>"); appendWhitespace(writer); } - writer.write("<div"); + writer.append("<div"); if (UtilValidate.isNotEmpty(containerId)) { - writer.write(" id=\""); - writer.write(containerId); - writer.write("\""); + writer.append(" id=\""); + writer.append(containerId); + writer.append("\""); } String style = container.getStyle(context); if (UtilValidate.isNotEmpty(style)) { - writer.write(" class=\""); - writer.write(style); - writer.write("\""); + writer.append(" class=\""); + writer.append(style); + writer.append("\""); } - writer.write(">"); + writer.append(">"); appendWhitespace(writer); } - public void renderContainerEnd(Writer writer, Map<String, Object> context, ModelScreenWidget.Container container) throws IOException { - writer.write("</div>"); + public void renderContainerEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.Container container) throws IOException { + writer.append("</div>"); appendWhitespace(writer); } - public void renderScreenletBegin(Writer writer, Map<String, Object> context, boolean collapsed, ModelScreenWidget.Screenlet screenlet) throws IOException { + public void renderScreenletBegin(Appendable writer, Map<String, Object> context, boolean collapsed, ModelScreenWidget.Screenlet screenlet) throws IOException { HttpServletRequest request = (HttpServletRequest) context.get("request"); HttpServletResponse response = (HttpServletResponse) context.get("response"); ModelScreenWidget.Menu tabMenu = screenlet.getTabMenu(); if (tabMenu != null) { tabMenu.renderWidgetString(writer, context, this); } - writer.write("<div class=\"screenlet\""); + writer.append("<div class=\"screenlet\""); String id = screenlet.getId(context); if (UtilValidate.isNotEmpty(id)) { - writer.write(" id=\""); - writer.write(id); - writer.write("\""); + writer.append(" id=\""); + writer.append(id); + writer.append("\""); } - writer.write(">"); + writer.append(">"); appendWhitespace(writer); String title = screenlet.getTitle(context); ModelScreenWidget.Menu navMenu = screenlet.getNavigationMenu(); ModelScreenWidget.Form navForm = screenlet.getNavigationForm(); if (UtilValidate.isNotEmpty(title) || navMenu != null || navForm != null || screenlet.collapsible()) { - writer.write("<div class=\"screenlet-title-bar\">"); + writer.append("<div class=\"screenlet-title-bar\">"); appendWhitespace(writer); - writer.write("<ul>"); + writer.append("<ul>"); appendWhitespace(writer); if (UtilValidate.isNotEmpty(title)) { - writer.write("<li class=\"h3\">"); - writer.write(title); - writer.write("</li>"); + writer.append("<li class=\"h3\">"); + writer.append(title); + writer.append("</li>"); appendWhitespace(writer); } if (screenlet.collapsible()) { String toolTip = null; Map uiLabelMap = (Map) context.get("uiLabelMap"); Map requestParameters = new HashMap((Map)context.get("requestParameters")); - writer.write("<li class=\""); + writer.append("<li class=\""); if (collapsed) { requestParameters.put(screenlet.getPreferenceKey(context) + "_collapsed", "false"); String queryString = UtilHttp.urlEncodeArgs(requestParameters); - writer.write("collapsed\"><a href=\""); - writer.write(request.getRequestURI() + "?" + queryString); + writer.append("collapsed\"><a href=\""); + writer.append(request.getRequestURI() + "?" + queryString); if (uiLabelMap != null) { toolTip = (String) uiLabelMap.get("CommonExpand"); } } else { requestParameters.put(screenlet.getPreferenceKey(context) + "_collapsed", "true"); String queryString = UtilHttp.urlEncodeArgs(requestParameters); - writer.write("expanded\"><a href=\""); - writer.write(request.getRequestURI() + "?" + queryString); + writer.append("expanded\"><a href=\""); + writer.append(request.getRequestURI() + "?" + queryString); if (uiLabelMap != null) { toolTip = (String) uiLabelMap.get("CommonCollapse"); } } - writer.write("\""); + writer.append("\""); if (UtilValidate.isNotEmpty(toolTip)) { - writer.write(" title=\"" + toolTip + "\""); + writer.append(" title=\"" + toolTip + "\""); } - writer.write("> </a></li>"); + writer.append("> </a></li>"); appendWhitespace(writer); } if (!collapsed) { @@ -188,20 +188,20 @@ renderScreenletPaginateMenu(writer, context, navForm); } } - writer.write("</ul>"); + writer.append("</ul>"); appendWhitespace(writer); - writer.write("<br class=\"clear\" />"); + writer.append("<br class=\"clear\" />"); appendWhitespace(writer); - writer.write("</div>"); + writer.append("</div>"); appendWhitespace(writer); if (screenlet.padded()) { - writer.write("<div class=\"screenlet-body\">"); + writer.append("<div class=\"screenlet-body\">"); appendWhitespace(writer); } } } - protected void renderScreenletPaginateMenu(Writer writer, Map<String, Object> context, ModelScreenWidget.Form form) throws IOException { + protected void renderScreenletPaginateMenu(Appendable writer, Map<String, Object> context, ModelScreenWidget.Form form) throws IOException { HttpServletResponse response = (HttpServletResponse) context.get("response"); HttpServletRequest request = (HttpServletRequest) context.get("request"); ModelForm modelForm = form.getModelForm(context); @@ -285,69 +285,69 @@ // The current screenlet title bar navigation syling requires rendering // these links in reverse order // Last button - writer.write("<li class=\"" + modelForm.getPaginateLastStyle()); + writer.append("<li class=\"" + modelForm.getPaginateLastStyle()); if (highIndex < listSize) { - writer.write("\"><a href=\""); + writer.append("\"><a href=\""); int page = (listSize / viewSize) - 1; linkText = prepLinkText + page + anchor; // - make the link - writer.write(rh.makeLink(request, response, linkText)); - writer.write("\">" + modelForm.getPaginateLastLabel(context) + "</a>"); + writer.append(rh.makeLink(request, response, linkText)); + writer.append("\">" + modelForm.getPaginateLastLabel(context) + "</a>"); } else { // disabled button - writer.write(" disabled\">" + modelForm.getPaginateLastLabel(context)); + writer.append(" disabled\">" + modelForm.getPaginateLastLabel(context)); } - writer.write("</li>"); + writer.append("</li>"); appendWhitespace(writer); // Next button - writer.write("<li class=\"" + modelForm.getPaginateNextStyle()); + writer.append("<li class=\"" + modelForm.getPaginateNextStyle()); if (highIndex < listSize) { - writer.write("\"><a href=\""); + writer.append("\"><a href=\""); linkText = prepLinkText + (viewIndex + 1) + anchor; // - make the link - writer.write(rh.makeLink(request, response, linkText)); - writer.write("\">" + modelForm.getPaginateNextLabel(context) + "</a>"); + writer.append(rh.makeLink(request, response, linkText)); + writer.append("\">" + modelForm.getPaginateNextLabel(context) + "</a>"); } else { // disabled button - writer.write(" disabled\">" + modelForm.getPaginateNextLabel(context)); + writer.append(" disabled\">" + modelForm.getPaginateNextLabel(context)); } - writer.write("</li>"); + writer.append("</li>"); appendWhitespace(writer); if (listSize > 0) { - writer.write("<li>"); - writer.write((lowIndex + 1) + " - " + (lowIndex + actualPageSize ) + " " + ofLabel + " " + listSize); - writer.write("</li>"); + writer.append("<li>"); + writer.append((lowIndex + 1) + " - " + (lowIndex + actualPageSize ) + " " + ofLabel + " " + listSize); + writer.append("</li>"); appendWhitespace(writer); } // Previous button - writer.write("<li class=\"nav-previous"); + writer.append("<li class=\"nav-previous"); if (viewIndex > 0) { - writer.write("\"><a href=\""); + writer.append("\"><a href=\""); linkText = prepLinkText + (viewIndex - 1) + anchor; // - make the link - writer.write(rh.makeLink(request, response, linkText)); - writer.write("\">" + modelForm.getPaginatePreviousLabel(context) + "</a>"); + writer.append(rh.makeLink(request, response, linkText)); + writer.append("\">" + modelForm.getPaginatePreviousLabel(context) + "</a>"); } else { // disabled button - writer.write(" disabled\">" + modelForm.getPaginatePreviousLabel(context)); + writer.append(" disabled\">" + modelForm.getPaginatePreviousLabel(context)); } - writer.write("</li>"); + writer.append("</li>"); appendWhitespace(writer); // First button - writer.write("<li class=\"nav-first"); + writer.append("<li class=\"nav-first"); if (viewIndex > 0) { - writer.write("\"><a href=\""); + writer.append("\"><a href=\""); linkText = prepLinkText + 0 + anchor; - writer.write(rh.makeLink(request, response, linkText)); - writer.write("\">" + modelForm.getPaginateFirstLabel(context) + "</a>"); + writer.append(rh.makeLink(request, response, linkText)); + writer.append("\">" + modelForm.getPaginateFirstLabel(context) + "</a>"); } else { - writer.write(" disabled\">" + modelForm.getPaginateFirstLabel(context)); + writer.append(" disabled\">" + modelForm.getPaginateFirstLabel(context)); } - writer.write("</li>"); + writer.append("</li>"); appendWhitespace(writer); } - public void renderScreenletSubWidget(Writer writer, Map<String, Object> context, ModelScreenWidget subWidget, ModelScreenWidget.Screenlet screenlet) throws GeneralException, IOException { + public void renderScreenletSubWidget(Appendable writer, Map<String, Object> context, ModelScreenWidget subWidget, ModelScreenWidget.Screenlet screenlet) throws GeneralException, IOException { if (subWidget.equals(screenlet.getNavigationForm())) { HttpServletRequest request = (HttpServletRequest) context.get("request"); HttpServletResponse response = (HttpServletResponse) context.get("response"); @@ -364,12 +364,12 @@ } } - public void renderScreenletEnd(Writer writer, Map<String, Object> context, ModelScreenWidget.Screenlet screenlet) throws IOException { + public void renderScreenletEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.Screenlet screenlet) throws IOException { if (screenlet.padded()) { - writer.write("</div>"); + writer.append("</div>"); appendWhitespace(writer); } - writer.write("</div>"); + writer.append("</div>"); appendWhitespace(writer); } @@ -377,11 +377,11 @@ public ScreenletMenuRenderer(HttpServletRequest request, HttpServletResponse response) { super(request, response); } - public void renderMenuOpen(Writer writer, Map<String, Object> context, ModelMenu modelMenu) {} - public void renderMenuClose(Writer writer, Map<String, Object> context, ModelMenu modelMenu) {} + public void renderMenuOpen(Appendable writer, Map<String, Object> context, ModelMenu modelMenu) {} + public void renderMenuClose(Appendable writer, Map<String, Object> context, ModelMenu modelMenu) {} } - public void renderLabel(Writer writer, Map<String, Object> context, ModelScreenWidget.Label label) throws IOException { + public void renderLabel(Appendable writer, Map<String, Object> context, ModelScreenWidget.Label label) throws IOException { String labelText = label.getText(context); if (UtilValidate.isEmpty(labelText)) { // nothing to render @@ -391,63 +391,63 @@ String style = label.getStyle(context); String id = label.getId(context); if (UtilValidate.isNotEmpty(style) || UtilValidate.isNotEmpty(id) ) { - writer.write("<span"); + writer.append("<span"); if (UtilValidate.isNotEmpty(id)) { - writer.write(" id=\""); - writer.write(id); - writer.write("\""); + writer.append(" id=\""); + writer.append(id); + writer.append("\""); } if (UtilValidate.isNotEmpty(style)) { - writer.write(" class=\""); - writer.write(style); - writer.write("\""); + writer.append(" class=\""); + writer.append(style); + writer.append("\""); } - writer.write(">"); + writer.append(">"); // the text - writer.write(labelText); + writer.append(labelText); // close tag - writer.write("</span>"); + writer.append("</span>"); } else { - writer.write(labelText); + writer.append(labelText); } appendWhitespace(writer); } - public void renderLink(Writer writer, Map<String, Object> context, ModelScreenWidget.Link link) throws IOException { + public void renderLink(Appendable writer, Map<String, Object> context, ModelScreenWidget.Link link) throws IOException { // open tag - writer.write("<a"); + writer.append("<a"); String id = link.getId(context); if (UtilValidate.isNotEmpty(id)) { - writer.write(" id=\""); - writer.write(id); - writer.write("\""); + writer.append(" id=\""); + writer.append(id); + writer.append("\""); } String style = link.getStyle(context); if (UtilValidate.isNotEmpty(style)) { - writer.write(" class=\""); - writer.write(style); - writer.write("\""); + writer.append(" class=\""); + writer.append(style); + writer.append("\""); } String name = link.getName(context); if (UtilValidate.isNotEmpty(name)) { - writer.write(" name=\""); - writer.write(name); - writer.write("\""); + writer.append(" name=\""); + writer.append(name); + writer.append("\""); } String targetWindow = link.getTargetWindow(context); if (UtilValidate.isNotEmpty(targetWindow)) { - writer.write(" target=\""); - writer.write(targetWindow); - writer.write("\""); + writer.append(" target=\""); + writer.append(targetWindow); + writer.append("\""); } String target = link.getTarget(context); if (UtilValidate.isNotEmpty(target)) { - writer.write(" href=\""); + writer.append(" href=\""); String urlMode = link.getUrlMode(); String prefix = link.getPrefix(context); boolean fullPath = link.getFullPath(); @@ -460,18 +460,18 @@ ServletContext ctx = (ServletContext) request.getAttribute("servletContext"); RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_"); String urlString = rh.makeLink(request, response, target, fullPath, secure, encode); - writer.write(urlString); + writer.append(urlString); } else if (prefix != null) { - writer.write(prefix + target); + writer.append(prefix + target); } else { - writer.write(target); + writer.append(target); } } else if (urlMode != null && urlMode.equalsIgnoreCase("content")) { if (request != null && response != null) { StringBuffer newURL = new StringBuffer(); ContentUrlTag.appendContentPrefix(request, newURL); newURL.append(target); - writer.write(newURL.toString()); + writer.append(newURL.toString()); } } else if ("inter-app".equalsIgnoreCase(urlMode) && request != null) { String externalLoginKey = (String) request.getAttribute("externalLoginKey"); @@ -481,65 +481,65 @@ } else { target += "?externalLoginKey=" + externalLoginKey; } - writer.write(target); + writer.append(target); } } else { - writer.write(target); + writer.append(target); } - writer.write("\""); + writer.append("\""); } - writer.write(">"); + writer.append(">"); // the text ModelScreenWidget.Image img = link.getImage(); if (img == null) - writer.write(link.getText(context)); + writer.append(link.getText(context)); else renderImage(writer, context, img); // close tag - writer.write("</a>"); + writer.append("</a>"); appendWhitespace(writer); } - public void renderImage(Writer writer, Map<String, Object> context, ModelScreenWidget.Image image) throws IOException { + public void renderImage(Appendable writer, Map<String, Object> context, ModelScreenWidget.Image image) throws IOException { // open tag - writer.write("<img "); + writer.append("<img "); String id = image.getId(context); if (UtilValidate.isNotEmpty(id)) { - writer.write(" id=\""); - writer.write(id); - writer.write("\""); + writer.append(" id=\""); + writer.append(id); + writer.append("\""); } String style = image.getStyle(context); if (UtilValidate.isNotEmpty(style)) { - writer.write(" class=\""); - writer.write(style); - writer.write("\""); + writer.append(" class=\""); + writer.append(style); + writer.append("\""); } String wid = image.getWidth(context); if (UtilValidate.isNotEmpty(wid)) { - writer.write(" width=\""); - writer.write(wid); - writer.write("\""); + writer.append(" width=\""); + writer.append(wid); + writer.append("\""); } String hgt = image.getHeight(context); if (UtilValidate.isNotEmpty(hgt)) { - writer.write(" height=\""); - writer.write(hgt); - writer.write("\""); + writer.append(" height=\""); + writer.append(hgt); + writer.append("\""); } String border = image.getBorder(context); if (UtilValidate.isNotEmpty(border)) { - writer.write(" border=\""); - writer.write(border); - writer.write("\""); + writer.append(" border=\""); + writer.append(border); + writer.append("\""); } String src = image.getSrc(context); if (UtilValidate.isNotEmpty(src)) { - writer.write(" src=\""); + writer.append(" src=\""); String urlMode = image.getUrlMode(); boolean fullPath = false; boolean secure = false; @@ -551,30 +551,30 @@ ServletContext ctx = (ServletContext) request.getAttribute("servletContext"); RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_"); String urlString = rh.makeLink(request, response, src, fullPath, secure, encode); - writer.write(urlString); + writer.append(urlString); } else { - writer.write(src); + writer.append(src); } } else if (urlMode != null && urlMode.equalsIgnoreCase("content")) { if (request != null && response != null) { StringBuffer newURL = new StringBuffer(); ContentUrlTag.appendContentPrefix(request, newURL); newURL.append(src); - writer.write(newURL.toString()); + writer.append(newURL.toString()); } } else { - writer.write(src); + writer.append(src); } - writer.write("\""); + writer.append("\""); } - writer.write("/>"); + writer.append("/>"); appendWhitespace(writer); } - public void renderContentBegin(Writer writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException { + public void renderContentBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException { String editRequest = content.getEditRequest(context); String editContainerStyle = content.getEditContainerStyle(context); String enableEditName = content.getEnableEditName(context); @@ -583,13 +583,13 @@ if (Debug.verboseOn()) Debug.logVerbose("directEditRequest:" + editRequest, module); if (UtilValidate.isNotEmpty(editRequest) && "true".equals(enableEditValue)) { - writer.write("<div"); - writer.write(" class=\"" + editContainerStyle + "\"> "); + writer.append("<div"); + writer.append(" class=\"" + editContainerStyle + "\"> "); appendWhitespace(writer); } } - public void renderContentBody(Writer writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException { + public void renderContentBody(Appendable writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException { Locale locale = UtilMisc.ensureLocale(context.get("locale")); //Boolean nullThruDatesOnly = new Boolean(false); String mimeTypeId = "text/html"; @@ -639,7 +639,7 @@ renderedContent = UtilFormatOut.encodeXmlValue(renderedContent); } - writer.write(renderedContent); + writer.append(renderedContent); } } catch(GeneralException e) { @@ -653,7 +653,7 @@ } } - public void renderContentEnd(Writer writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException { + public void renderContentEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException { //Debug.logInfo("renderContentEnd, context:" + context, module); String expandedContentId = content.getContentId(context); @@ -678,16 +678,16 @@ RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_"); String urlString = rh.makeLink(request, response, editRequest, false, false, false); String linkString = "<a href=\"" + urlString + "\">" + editMode + "</a>"; - writer.write(linkString); + writer.append(linkString); } if (UtilValidate.isNotEmpty(editContainerStyle)) { - writer.write("</div>"); + writer.append("</div>"); } appendWhitespace(writer); } } - public void renderContentFrame(Writer writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException { + public void renderContentFrame(Appendable writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException { String dataResourceId = content.getDataResourceId(context); // String urlString = "/content/control/ViewSimpleContent?dataResourceId=" + dataResourceId; @@ -707,26 +707,26 @@ RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_"); String fullUrlString = rh.makeLink(request, response, urlString, true, false, false); String linkString = "<iframe src=\"" + fullUrlString + "\" " + widthString + heightString + borderString + " />"; - writer.write(linkString); + writer.append(linkString); } } - public void renderSubContentBegin(Writer writer, Map<String, Object> context, ModelScreenWidget.SubContent content) throws IOException { + public void renderSubContentBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.SubContent content) throws IOException { String editRequest = content.getEditRequest(context); String editContainerStyle = content.getEditContainerStyle(context); String enableEditName = content.getEnableEditName(context); String enableEditValue = (String)context.get(enableEditName); if (UtilValidate.isNotEmpty(editRequest) && "true".equals(enableEditValue)) { - writer.write("<div"); - writer.write(" class=\"" + editContainerStyle + "\"> "); + writer.append("<div"); + writer.append(" class=\"" + editContainerStyle + "\"> "); appendWhitespace(writer); } } - public void renderSubContentBody(Writer writer, Map<String, Object> context, ModelScreenWidget.SubContent content) throws IOException { + public void renderSubContentBody(Appendable writer, Map<String, Object> context, ModelScreenWidget.SubContent content) throws IOException { Locale locale = Locale.getDefault(); String mimeTypeId = "text/html"; String expandedContentId = content.getContentId(context); @@ -760,7 +760,7 @@ renderedContent = UtilFormatOut.encodeXmlValue(renderedContent); } - writer.write(renderedContent); + writer.append(renderedContent); } } catch(GeneralException e) { @@ -774,7 +774,7 @@ } } - public void renderSubContentEnd(Writer writer, Map<String, Object> context, ModelScreenWidget.SubContent content) throws IOException { + public void renderSubContentEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.SubContent content) throws IOException { String editMode = "Edit"; String editRequest = content.getEditRequest(context); @@ -813,10 +813,10 @@ RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_"); String urlString = rh.makeLink(request, response, editRequest, false, false, false); String linkString = "<a href=\"" + urlString + "\">" + editMode + "</a>"; - writer.write(linkString); + writer.append(linkString); } if (UtilValidate.isNotEmpty(editContainerStyle)) { - writer.write("</div>"); + writer.append("</div>"); } appendWhitespace(writer); } Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java?rev=662328&r1=662327&r2=662328&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java Sun Jun 1 22:27:12 2008 @@ -57,7 +57,7 @@ return buf.toString(); } - public void renderNodeBegin(Writer writer, Map<String, Object> context, ModelTree.ModelNode node, int depth, boolean isLast) throws IOException { + public void renderNodeBegin(Appendable writer, Map<String, Object> context, ModelTree.ModelNode node, int depth, boolean isLast) throws IOException { String pathString = buildPathString(node.getModelTree(), depth); String currentNodeTrailPiped = null; @@ -69,10 +69,10 @@ if (node.isRootNode()) { appendWhitespace(writer); renderBeginningBoundaryComment(writer, "Tree Widget", node.getModelTree()); - writer.write("<ul class=\"basic-tree\">"); + writer.append("<ul class=\"basic-tree\">"); } appendWhitespace(writer); - writer.write("<li>"); + writer.append("<li>"); String pkName = node.getPkName(); String entityId = null; @@ -153,99 +153,99 @@ } renderLink( writer, context, expandCollapseLink); } else if (!hasChildren){ - //writer.write(" "); + //writer.append(" "); context.put("processChildren", Boolean.FALSE); //currentNodeTrail.add(contentId); } } - public void renderNodeEnd(Writer writer, Map<String, Object> context, ModelTree.ModelNode node) throws IOException { + public void renderNodeEnd(Appendable writer, Map<String, Object> context, ModelTree.ModelNode node) throws IOException { Boolean processChildren = (Boolean) context.get("processChildren"); if (processChildren.booleanValue()) { appendWhitespace(writer); - writer.write("</ul>"); + writer.append("</ul>"); } appendWhitespace(writer); - writer.write("</li>"); + writer.append("</li>"); if (node.isRootNode()){ appendWhitespace(writer); - writer.write("</ul>"); + writer.append("</ul>"); appendWhitespace(writer); renderEndingBoundaryComment(writer, "Tree Widget", node.getModelTree()); } } - public void renderLastElement(Writer writer, Map<String, Object> context, ModelTree.ModelNode node) throws IOException { + public void renderLastElement(Appendable writer, Map<String, Object> context, ModelTree.ModelNode node) throws IOException { Boolean processChildren = (Boolean) context.get("processChildren"); if (processChildren.booleanValue()) { appendWhitespace(writer); - writer.write("<ul class=\"basic-tree\">"); + writer.append("<ul class=\"basic-tree\">"); } } - public void renderLabel(Writer writer, Map<String, Object> context, ModelTree.ModelNode.Label label) throws IOException { + public void renderLabel(Appendable writer, Map<String, Object> context, ModelTree.ModelNode.Label label) throws IOException { // open tag - writer.write("<span"); + writer.append("<span"); String id = label.getId(context); if (UtilValidate.isNotEmpty(id)) { - writer.write(" id=\""); - writer.write(id); - writer.write("\""); + writer.append(" id=\""); + writer.append(id); + writer.append("\""); } String style = label.getStyle(context); if (UtilValidate.isNotEmpty(style)) { - writer.write(" class=\""); - writer.write(style); - writer.write("\""); + writer.append(" class=\""); + writer.append(style); + writer.append("\""); } - writer.write(">"); + writer.append(">"); // the text - writer.write(label.getText(context)); + writer.append(label.getText(context)); // close tag - writer.write("</span>"); + writer.append("</span>"); appendWhitespace(writer); } - public void renderLink(Writer writer, Map<String, Object> context, ModelTree.ModelNode.Link link) throws IOException { + public void renderLink(Appendable writer, Map<String, Object> context, ModelTree.ModelNode.Link link) throws IOException { // open tag - writer.write("<a"); + writer.append("<a"); String id = link.getId(context); if (UtilValidate.isNotEmpty(id)) { - writer.write(" id=\""); - writer.write(id); - writer.write("\""); + writer.append(" id=\""); + writer.append(id); + writer.append("\""); } String style = link.getStyle(context); if (UtilValidate.isNotEmpty(style)) { - writer.write(" class=\""); - writer.write(style); - writer.write("\""); + writer.append(" class=\""); + writer.append(style); + writer.append("\""); } String name = link.getName(context); if (UtilValidate.isNotEmpty(name)) { - writer.write(" name=\""); - writer.write(name); - writer.write("\""); + writer.append(" name=\""); + writer.append(name); + writer.append("\""); } String title = link.getTitle(context); if (UtilValidate.isNotEmpty(title)) { - writer.write(" title=\""); - writer.write(title); - writer.write("\""); + writer.append(" title=\""); + writer.append(title); + writer.append("\""); } String targetWindow = link.getTargetWindow(context); if (UtilValidate.isNotEmpty(targetWindow)) { - writer.write(" target=\""); - writer.write(targetWindow); - writer.write("\""); + writer.append(" target=\""); + writer.append(targetWindow); + writer.append("\""); } String target = link.getTarget(context); if (UtilValidate.isNotEmpty(target)) { - writer.write(" href=\""); + writer.append(" href=\""); String urlMode = link.getUrlMode(); String prefix = link.getPrefix(context); boolean fullPath = link.getFullPath(); @@ -258,17 +258,17 @@ ServletContext ctx = (ServletContext) req.getAttribute("servletContext"); RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_"); String urlString = rh.makeLink(req, res, target, fullPath, secure, encode); - writer.write(urlString); + writer.append(urlString); } else if (prefix != null) { - writer.write(prefix + target); + writer.append(prefix + target); } else { - writer.write(target); + writer.append(target); } } else if (urlMode != null && urlMode.equalsIgnoreCase("content")) { StringBuffer newURL = new StringBuffer(); ContentUrlTag.appendContentPrefix(req, newURL); newURL.append(target); - writer.write(newURL.toString()); + writer.append(newURL.toString()); } else if ("inter-app".equalsIgnoreCase(urlMode) && req != null) { String externalLoginKey = (String) req.getAttribute("externalLoginKey"); if (UtilValidate.isNotEmpty(externalLoginKey)) { @@ -277,65 +277,65 @@ } else { target += "?externalLoginKey=" + externalLoginKey; } - writer.write(target); + writer.append(target); } } else { - writer.write(target); + writer.append(target); } - writer.write("\""); + writer.append("\""); } - writer.write(">"); + writer.append(">"); // the text ModelTree.ModelNode.Image img = link.getImage(); if (img == null) - writer.write(link.getText(context)); + writer.append(link.getText(context)); else renderImage(writer, context, img); // close tag - writer.write("</a>"); + writer.append("</a>"); // appendWhitespace(writer); } - public void renderImage(Writer writer, Map<String, Object> context, ModelTree.ModelNode.Image image) throws IOException { + public void renderImage(Appendable writer, Map<String, Object> context, ModelTree.ModelNode.Image image) throws IOException { // open tag - writer.write("<img "); + writer.append("<img "); String id = image.getId(context); if (UtilValidate.isNotEmpty(id)) { - writer.write(" id=\""); - writer.write(id); - writer.write("\""); + writer.append(" id=\""); + writer.append(id); + writer.append("\""); } String style = image.getStyle(context); if (UtilValidate.isNotEmpty(style)) { - writer.write(" class=\""); - writer.write(style); - writer.write("\""); + writer.append(" class=\""); + writer.append(style); + writer.append("\""); } String wid = image.getWidth(context); if (UtilValidate.isNotEmpty(wid)) { - writer.write(" width=\""); - writer.write(wid); - writer.write("\""); + writer.append(" width=\""); + writer.append(wid); + writer.append("\""); } String hgt = image.getHeight(context); if (UtilValidate.isNotEmpty(hgt)) { - writer.write(" height=\""); - writer.write(hgt); - writer.write("\""); + writer.append(" height=\""); + writer.append(hgt); + writer.append("\""); } String border = image.getBorder(context); if (UtilValidate.isNotEmpty(border)) { - writer.write(" border=\""); - writer.write(border); - writer.write("\""); + writer.append(" border=\""); + writer.append(border); + writer.append("\""); } String src = image.getSrc(context); if (UtilValidate.isNotEmpty(src)) { - writer.write(" src=\""); + writer.append(" src=\""); String urlMode = image.getUrlMode(); boolean fullPath = false; boolean secure = false; @@ -347,24 +347,24 @@ ServletContext ctx = (ServletContext) request.getAttribute("servletContext"); RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_"); String urlString = rh.makeLink(request, response, src, fullPath, secure, encode); - writer.write(urlString); + writer.append(urlString); } else { - writer.write(src); + writer.append(src); } } else if (urlMode != null && urlMode.equalsIgnoreCase("content")) { if (request != null && response != null) { StringBuffer newURL = new StringBuffer(); ContentUrlTag.appendContentPrefix(request, newURL); newURL.append(src); - writer.write(newURL.toString()); + writer.append(newURL.toString()); } } else { - writer.write(src); + writer.append(src); } - writer.write("\""); + writer.append("\""); } - writer.write("/>"); + writer.append("/>"); } Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlWidgetRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlWidgetRenderer.java?rev=662328&r1=662327&r2=662328&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlWidgetRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlWidgetRenderer.java Sun Jun 1 22:27:12 2008 @@ -41,8 +41,8 @@ * Helper method used to append whitespace characters to the end of each rendered element. * @param writer The writer to write to */ - public void appendWhitespace(Writer writer) throws IOException { - writer.write(whiteSpace); + public void appendWhitespace(Appendable writer) throws IOException { + writer.append(whiteSpace); } /** @@ -65,9 +65,9 @@ * @param widgetType The widget type: "Screen Widget", "Form Widget", etc. * @param modelWidget The widget */ - public void renderBeginningBoundaryComment(Writer writer, String widgetType, ModelWidget modelWidget) throws IOException { + public void renderBeginningBoundaryComment(Appendable writer, String widgetType, ModelWidget modelWidget) throws IOException { if (modelWidget.boundaryCommentsEnabled()) { - writer.write(this.buildBoundaryComment("Begin", widgetType, modelWidget.getBoundaryCommentName())); + writer.append(this.buildBoundaryComment("Begin", widgetType, modelWidget.getBoundaryCommentName())); } } @@ -77,9 +77,9 @@ * @param widgetType The widget type: "Screen Widget", "Form Widget", etc. * @param modelWidget The widget */ - public void renderEndingBoundaryComment(Writer writer, String widgetType, ModelWidget modelWidget) throws IOException { + public void renderEndingBoundaryComment(Appendable writer, String widgetType, ModelWidget modelWidget) throws IOException { if (modelWidget.boundaryCommentsEnabled()) { - writer.write(this.buildBoundaryComment("End", widgetType, modelWidget.getBoundaryCommentName())); + writer.append(this.buildBoundaryComment("End", widgetType, modelWidget.getBoundaryCommentName())); } } Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuStringRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuStringRenderer.java?rev=662328&r1=662327&r2=662328&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuStringRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuStringRenderer.java Sun Jun 1 22:27:12 2008 @@ -27,13 +27,13 @@ * Widget Library - Form String Renderer interface */ public interface MenuStringRenderer { - public void renderMenuItem(Writer writer, Map<String, Object> context, ModelMenuItem menuItem) throws IOException ; - public void renderMenuOpen(Writer writer, Map<String, Object> context, ModelMenu menu) throws IOException ; - public void renderMenuClose(Writer writer, Map<String, Object> context, ModelMenu menu) throws IOException ; - public void renderFormatSimpleWrapperOpen(Writer writer, Map<String, Object> context, ModelMenu menu) throws IOException ; - public void renderFormatSimpleWrapperClose(Writer writer, Map<String, Object> context, ModelMenu menu) throws IOException ; - public void renderFormatSimpleWrapperRows(Writer writer, Map<String, Object> context, Object menu) throws IOException ; + public void renderMenuItem(Appendable writer, Map<String, Object> context, ModelMenuItem menuItem) throws IOException ; + public void renderMenuOpen(Appendable writer, Map<String, Object> context, ModelMenu menu) throws IOException ; + public void renderMenuClose(Appendable writer, Map<String, Object> context, ModelMenu menu) throws IOException ; + public void renderFormatSimpleWrapperOpen(Appendable writer, Map<String, Object> context, ModelMenu menu) throws IOException ; + public void renderFormatSimpleWrapperClose(Appendable writer, Map<String, Object> context, ModelMenu menu) throws IOException ; + public void renderFormatSimpleWrapperRows(Appendable writer, Map<String, Object> context, Object menu) throws IOException ; public void setUserLoginIdHasChanged(boolean b) throws IOException ; - public void renderLink(Writer writer, Map<String, Object> context, ModelMenuItem.Link link) throws IOException ; - public void renderImage(Writer writer, Map<String, Object> context, ModelMenuItem.Image image) throws IOException ; + public void renderLink(Appendable writer, Map<String, Object> context, ModelMenuItem.Link link) throws IOException ; + public void renderImage(Appendable writer, Map<String, Object> context, ModelMenuItem.Image image) throws IOException ; } Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java?rev=662328&r1=662327&r2=662328&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java Sun Jun 1 22:27:12 2008 @@ -313,7 +313,7 @@ * different menu elements; implementing you own makes it possible to * use the same menu definitions for many types of menu UIs */ - public void renderMenuString(Writer writer, Map<String, Object> context, MenuStringRenderer menuStringRenderer) throws IOException { + public void renderMenuString(Appendable writer, Map<String, Object> context, MenuStringRenderer menuStringRenderer) throws IOException { setWidgetBoundaryComments(context); boolean passed = true; @@ -330,7 +330,7 @@ //Debug.logInfo("in ModelMenu, buffer:" + buffer.toString(), module); } - public void renderSimpleMenuString(Writer writer, Map<String, Object> context, MenuStringRenderer menuStringRenderer) throws IOException { + public void renderSimpleMenuString(Appendable writer, Map<String, Object> context, MenuStringRenderer menuStringRenderer) throws IOException { //Iterator menuItemIter = null; //Set alreadyRendered = new TreeSet(); Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java?rev=662328&r1=662327&r2=662328&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java Sun Jun 1 22:27:12 2008 @@ -246,7 +246,7 @@ */ } - public void renderMenuItemString(Writer writer, Map<String, Object> context, MenuStringRenderer menuStringRenderer) throws IOException { + public void renderMenuItemString(Appendable writer, Map<String, Object> context, MenuStringRenderer menuStringRenderer) throws IOException { boolean passed = true; if (this.condition != null) { @@ -599,7 +599,7 @@ } - public void renderLinkString(Writer writer, Map<String, Object> context, MenuStringRenderer menuStringRenderer) throws IOException { + public void renderLinkString(Appendable writer, Map<String, Object> context, MenuStringRenderer menuStringRenderer) throws IOException { menuStringRenderer.renderLink(writer, context, this); } @@ -748,7 +748,7 @@ } - public void renderImageString(Writer writer, Map<String, Object> context, MenuStringRenderer menuStringRenderer) throws IOException { + public void renderImageString(Appendable writer, Map<String, Object> context, MenuStringRenderer menuStringRenderer) throws IOException { menuStringRenderer.renderImage(writer, context, this); } Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java?rev=662328&r1=662327&r2=662328&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java Sun Jun 1 22:27:12 2008 @@ -63,7 +63,7 @@ } } - public void renderWidgetString(Writer writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException { + public void renderWidgetString(Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException { for (ModelScreenWidget subWidget : subWidgets) { subWidget.renderWidgetString(writer, context, screenStringRenderer); } @@ -78,7 +78,7 @@ return buffer.toString(); } - public static void renderHtmlTemplate(Writer writer, FlexibleStringExpander locationExdr, Map<String, Object> context) { + public static void renderHtmlTemplate(Appendable writer, FlexibleStringExpander locationExdr, Map<String, Object> context) { String location = locationExdr.expandString(context); //Debug.logInfo("Rendering template at location [" + location + "] with context: \n" + context, module); @@ -91,11 +91,11 @@ Map parameters = (Map) context.get("parameters"); boolean insertWidgetBoundaryComments = ModelWidget.widgetBoundaryCommentsEnabled(parameters); if (insertWidgetBoundaryComments) { - writer.write(HtmlWidgetRenderer.formatBoundaryComment("Begin", "Template", location)); + writer.append(HtmlWidgetRenderer.formatBoundaryComment("Begin", "Template", location)); } FreeMarkerWorker.renderTemplateAtLocation(location, context, writer); if (insertWidgetBoundaryComments) { - writer.write(HtmlWidgetRenderer.formatBoundaryComment("End", "Template", location)); + writer.append(HtmlWidgetRenderer.formatBoundaryComment("End", "Template", location)); } } catch (IllegalArgumentException e) { String errMsg = "Error rendering included template at location [" + location + "]: " + e.toString(); @@ -120,9 +120,9 @@ } // TODO: We can make this more fancy, but for now this is very functional - public static void writeError(Writer writer, String message) { + public static void writeError(Appendable writer, String message) { try { - writer.write(message); + writer.append(message); } catch (IOException e) { } } @@ -135,7 +135,7 @@ this.locationExdr = new FlexibleStringExpander(htmlTemplateElement.getAttribute("location")); } - public void renderWidgetString(Writer writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) { + public void renderWidgetString(Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) { renderHtmlTemplate(writer, this.locationExdr, context); } @@ -161,7 +161,7 @@ } } - public void renderWidgetString(Writer writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) { + public void renderWidgetString(Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) { // isolate the scope if (!(context instanceof MapStack)) { context = MapStack.create(context); @@ -199,7 +199,7 @@ this.subWidgets = ModelScreenWidget.readSubWidgets(this.modelScreen, subElementList); } - public void renderWidgetString(Writer writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException { + public void renderWidgetString(Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException { // render sub-widgets renderSubWidgetsString(this.subWidgets, writer, context, screenStringRenderer); } Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/IterateSectionWidget.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/IterateSectionWidget.java?rev=662328&r1=662327&r2=662328&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/IterateSectionWidget.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/IterateSectionWidget.java Sun Jun 1 22:27:12 2008 @@ -86,7 +86,7 @@ } } - public void renderWidgetString(Writer writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException { + public void renderWidgetString(Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException { boolean isEntrySet = false; if (!(context instanceof MapStack)) { @@ -265,7 +265,7 @@ } - public void renderNextPrev(Writer writer, Map<String, Object> context) throws IOException { + public void renderNextPrev(Appendable writer, Map<String, Object> context) throws IOException { String targetService = this.getPaginateTarget(context); if (targetService == null) { targetService = "${targetService}"; @@ -327,12 +327,12 @@ ServletContext ctx = (ServletContext) request.getAttribute("servletContext"); RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_"); - writer.write("<table border=\"0\" width=\"100%\" cellpadding=\"2\">\n"); - writer.write(" <tr>\n"); - writer.write(" <td align=\"right\">\n"); - writer.write(" <b>\n"); + writer.append("<table border=\"0\" width=\"100%\" cellpadding=\"2\">\n"); + writer.append(" <tr>\n"); + writer.append(" <td align=\"right\">\n"); + writer.append(" <b>\n"); if (viewIndex > 0) { - writer.write(" <a href=\""); + writer.append(" <a href=\""); String linkText = targetService; if (linkText.indexOf("?") < 0) linkText += "?"; else linkText += "&"; @@ -340,29 +340,29 @@ linkText += "VIEW_SIZE=" + viewSize + "&VIEW_INDEX=" + (viewIndex - 1) + "\""; // make the link - writer.write(rh.makeLink(request, response, linkText, false, false, false)); - writer.write(" class=\"buttontext\">[Previous]</a>\n"); + writer.append(rh.makeLink(request, response, linkText, false, false, false)); + writer.append(" class=\"buttontext\">[Previous]</a>\n"); } if (listSize > 0) { - writer.write(" <span class=\"tabletext\">" + (lowIndex + 1) + " - " + (lowIndex + actualPageSize) + " of " + listSize + "</span> \n"); + writer.append(" <span class=\"tabletext\">" + (lowIndex + 1) + " - " + (lowIndex + actualPageSize) + " of " + listSize + "</span> \n"); } if (highIndex < listSize) { - writer.write(" <a href=\""); + writer.append(" <a href=\""); String linkText = targetService; if (linkText.indexOf("?") < 0) linkText += "?"; else linkText += "&"; linkText += "VIEW_SIZE=" + viewSize + "&VIEW_INDEX=" + (viewIndex + 1) + "\""; // make the link - writer.write(rh.makeLink(request, response, linkText, false, false, false)); - writer.write(" class=\"buttontext\">[Next]</a>\n"); + writer.append(rh.makeLink(request, response, linkText, false, false, false)); + writer.append(" class=\"buttontext\">[Next]</a>\n"); } - writer.write(" </b>\n"); - writer.write(" </td>\n"); - writer.write(" </tr>\n"); - writer.write("</table>\n"); + writer.append(" </b>\n"); + writer.append(" </td>\n"); + writer.append(" </tr>\n"); + writer.append("</table>\n"); } Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java?rev=662328&r1=662327&r2=662328&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java Sun Jun 1 22:27:12 2008 @@ -351,7 +351,7 @@ * different screen elements; implementing your own makes it possible to * use the same screen definitions for many types of screen UIs */ - public void renderScreenString(Writer writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws ScreenRenderException { + public void renderScreenString(Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws ScreenRenderException { // make sure the "null" object is in there for entity ops context.put("null", GenericEntity.NULL_FIELD); |
Free forum by Nabble | Edit this page |