Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormWrapper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormWrapper.java?rev=662123&r1=662122&r2=662123&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormWrapper.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormWrapper.java Sat May 31 18:50:41 2008
@@ -52,7 +52,7 @@
protected HttpServletResponse response;
protected ModelForm modelForm;
protected FormStringRenderer renderer;
- protected Map context;
+ protected Map<String, Object> context;
protected HtmlFormWrapper() {}
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=662123&r1=662122&r2=662123&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 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.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -27,7 +29,6 @@
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
-import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.StringUtil;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.entity.GenericDelegator;
@@ -60,7 +61,7 @@
this.response = response;
}
- public void appendOfbizUrl(StringBuffer buffer, String location) {
+ public void appendOfbizUrl(Writer 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, "");
@@ -71,7 +72,7 @@
//if (Debug.infoOn()) Debug.logInfo("in appendOfbizUrl, session is null(1)", "");
}
if (ctx == null) {
- throw new RuntimeException("ctx is null. buffer=" + buffer.toString() + " location:" + location);
+ throw new RuntimeException("ctx is null. location:" + location);
}
//if (Debug.infoOn()) Debug.logInfo("in appendOfbizUrl, ctx is NOT null(2)", "");
}
@@ -85,10 +86,10 @@
if (s.indexOf("null") >= 0) {
//if (Debug.infoOn()) Debug.logInfo("in appendOfbizUrl(3), url: " + s, "");
}
- buffer.append(s);
+ writer.write(s);
}
- public void appendContentUrl(StringBuffer buffer, String location) {
+ public void appendContentUrl(Writer 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, "");
@@ -99,7 +100,7 @@
//if (Debug.infoOn()) Debug.logInfo("in appendContentUrl, session is null(1)", "");
}
if (ctx == null) {
- throw new RuntimeException("ctx is null. buffer=" + buffer.toString() + " location:" + location);
+ throw new RuntimeException("ctx is null. location:" + location);
}
//if (Debug.infoOn()) Debug.logInfo("in appendContentUrl, ctx is NOT null(2)", "");
this.request.setAttribute("servletContext", ctx);
@@ -108,28 +109,30 @@
if (delegator == null) {
//if (Debug.infoOn()) Debug.logInfo("in appendContentUrl, delegator is null(6)", "");
}
+ 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, ModelMenuItem modelMenuItem) {
+ public void appendTooltip(Writer writer, Map<String, Object> context, ModelMenuItem modelMenuItem) throws IOException {
// render the tooltip
String tooltip = modelMenuItem.getTooltip(context);
if (UtilValidate.isNotEmpty(tooltip)) {
- buffer.append("<span class=\"");
+ writer.write("<span class=\"");
String tooltipStyle = modelMenuItem.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 renderFormatSimpleWrapperRows(StringBuffer buffer, Map context, Object menuObj) {
+ public void renderFormatSimpleWrapperRows(Writer writer, Map<String, Object> context, Object menuObj) throws IOException {
List menuItemList = ((ModelMenu)menuObj).getMenuItemList();
Iterator menuItemIter = menuItemList.iterator();
@@ -137,11 +140,11 @@
while (menuItemIter.hasNext()) {
currentMenuItem = (ModelMenuItem)menuItemIter.next();
- renderMenuItem(buffer, context, currentMenuItem);
+ renderMenuItem(writer, context, currentMenuItem);
}
}
- public void renderMenuItem(StringBuffer buffer, Map context, ModelMenuItem menuItem) {
+ public void renderMenuItem(Writer writer, Map<String, Object> context, ModelMenuItem menuItem) throws IOException {
//Debug.logInfo("in renderMenuItem, menuItem:" + menuItem.getName() + " context:" + context ,"");
boolean hideThisItem = isHideIfSelected(menuItem, context);
@@ -162,32 +165,32 @@
style = menuItem.getDisabledTitleStyle();
}
- buffer.append(" <li");
+ writer.write(" <li");
String alignStyle = menuItem.getAlignStyle();
if (UtilValidate.isNotEmpty(style) || UtilValidate.isNotEmpty(alignStyle)) {
- buffer.append(" class=\"");
+ writer.write(" class=\"");
if (UtilValidate.isNotEmpty(style)) {
- buffer.append(style + " ");
+ writer.write(style + " ");
}
if (UtilValidate.isNotEmpty(alignStyle)) {
- buffer.append(alignStyle);
+ writer.write(alignStyle);
}
- buffer.append("\"");
+ writer.write("\"");
}
- buffer.append(">");
+ writer.write(">");
Link link = menuItem.getLink();
//if (Debug.infoOn()) Debug.logInfo("in HtmlMenuRendererImage, link(0):" + link,"");
if (link != null) {
- renderLink(buffer, context, link);
+ renderLink(writer, context, link);
}
- buffer.append("</li>");
+ writer.write("</li>");
- appendWhitespace(buffer);
+ appendWhitespace(writer);
}
- public boolean isDisableIfEmpty(ModelMenuItem menuItem, Map context) {
+ public boolean isDisableIfEmpty(ModelMenuItem menuItem, Map<String, Object> context) {
boolean disabled = false;
String disableIfEmpty = menuItem.getDisableIfEmpty();
@@ -206,64 +209,64 @@
}
/*
- public String buildDivStr(ModelMenuItem menuItem, Map context) {
+ public String buildDivStr(ModelMenuItem menuItem, Map<String, Object> context) {
String divStr = "";
divStr = menuItem.getTitle(context);
return divStr;
}
*/
- public void renderMenuOpen(StringBuffer buffer, Map context, ModelMenu modelMenu) {
+ public void renderMenuOpen(Writer writer, Map<String, Object> context, ModelMenu modelMenu) throws IOException {
if (!userLoginIdHasChanged) {
userLoginIdHasChanged = userLoginIdHasChanged();
}
//Debug.logInfo("in HtmlMenuRenderer, userLoginIdHasChanged:" + userLoginIdHasChanged,"");
- renderBeginningBoundaryComment(buffer, "Menu Widget", modelMenu);
- buffer.append("<div");
+ renderBeginningBoundaryComment(writer, "Menu Widget", modelMenu);
+ writer.write("<div");
String menuId = modelMenu.getId();
if (UtilValidate.isNotEmpty(menuId)) {
- buffer.append(" id=\"" + menuId + "\"");
+ writer.write(" id=\"" + menuId + "\"");
} else {
// TODO: Remove else after UI refactor - allow both id and style
String menuContainerStyle = modelMenu.getMenuContainerStyle(context);
if (UtilValidate.isNotEmpty(menuContainerStyle)) {
- buffer.append(" class=\"" + menuContainerStyle + "\"");
+ writer.write(" class=\"" + menuContainerStyle + "\"");
}
}
String menuWidth = modelMenu.getMenuWidth();
// TODO: Eliminate embedded styling after refactor
if (UtilValidate.isNotEmpty(menuWidth)) {
- buffer.append(" style=\"width:" + menuWidth + ";\"");
+ writer.write(" style=\"width:" + menuWidth + ";\"");
}
- buffer.append(">");
+ writer.write(">");
String menuTitle = modelMenu.getTitle(context);
if (UtilValidate.isNotEmpty(menuTitle)) {
- appendWhitespace(buffer);
- buffer.append(" <h2>" + menuTitle + "</h2>");
+ appendWhitespace(writer);
+ writer.write(" <h2>" + menuTitle + "</h2>");
}
- appendWhitespace(buffer);
- buffer.append(" <ul>");
+ appendWhitespace(writer);
+ writer.write(" <ul>");
- appendWhitespace(buffer);
+ appendWhitespace(writer);
}
/* (non-Javadoc)
- * @see org.ofbiz.widget.menu.MenuStringRenderer#renderMenuClose(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.menu.ModelMenu)
+ * @see org.ofbiz.widget.menu.MenuStringRenderer#renderMenuClose(java.io.Writer, java.util.Map, org.ofbiz.widget.menu.ModelMenu)
*/
- public void renderMenuClose(StringBuffer buffer, Map context, ModelMenu modelMenu) {
+ public void renderMenuClose(Writer writer, Map<String, Object> context, ModelMenu modelMenu) throws IOException {
String fillStyle = modelMenu.getFillStyle();
if (UtilValidate.isNotEmpty(fillStyle)) {
- buffer.append("<div class=\"" + fillStyle + "\"> </div>");
+ writer.write("<div class=\"" + fillStyle + "\"> </div>");
}
//String menuContainerStyle = modelMenu.getMenuContainerStyle(context);
- buffer.append(" </ul>");
- appendWhitespace(buffer);
- buffer.append(" <br class=\"clear\"/>");
- appendWhitespace(buffer);
- buffer.append("</div>");
- appendWhitespace(buffer);
- renderEndingBoundaryComment(buffer, "Menu Widget", modelMenu);
+ writer.write(" </ul>");
+ appendWhitespace(writer);
+ writer.write(" <br class=\"clear\"/>");
+ appendWhitespace(writer);
+ writer.write("</div>");
+ appendWhitespace(writer);
+ renderEndingBoundaryComment(writer, "Menu Widget", modelMenu);
userLoginIdHasChanged = userLoginIdHasChanged();
GenericValue userLogin = (GenericValue)request.getSession().getAttribute("userLogin");
@@ -277,12 +280,12 @@
}
}
- public void renderFormatSimpleWrapperOpen(StringBuffer buffer, Map context, ModelMenu modelMenu) {
- //appendWhitespace(buffer);
+ public void renderFormatSimpleWrapperOpen(Writer writer, Map<String, Object> context, ModelMenu modelMenu) throws IOException {
+ //appendWhitespace(writer);
}
- public void renderFormatSimpleWrapperClose(StringBuffer buffer, Map context, ModelMenu modelMenu) {
- //appendWhitespace(buffer);
+ public void renderFormatSimpleWrapperClose(Writer writer, Map<String, Object> context, ModelMenu modelMenu) throws IOException {
+ //appendWhitespace(writer);
}
public void setRequest(HttpServletRequest request) {
@@ -309,7 +312,7 @@
return this.userLoginIdAtPermGrant;
}
- public boolean isHideIfSelected(ModelMenuItem menuItem, Map context) {
+ public boolean isHideIfSelected(ModelMenuItem menuItem, Map<String, Object> context) {
ModelMenu menu = menuItem.getModelMenu();
String currentMenuItemName = menu.getSelectedMenuItemContextFieldName(context);
String currentItemName = menuItem.getName();
@@ -350,13 +353,13 @@
}
- public String getTitle(ModelMenuItem menuItem, Map context) {
+ public String getTitle(ModelMenuItem menuItem, Map<String, Object> context) {
String title = null;
title = menuItem.getTitle(context);
return title;
}
- public void renderLink(StringBuffer buffer, Map context, ModelMenuItem.Link link) {
+ public void renderLink(Writer writer, Map<String, Object> context, ModelMenuItem.Link link) throws IOException {
ModelMenuItem menuItem = link.getLinkMenuItem();
String target = link.getTarget(context);
if (menuItem.getDisabled()) {
@@ -364,12 +367,12 @@
}
if (UtilValidate.isNotEmpty(target)) {
// open tag
- buffer.append("<a");
+ writer.write("<a");
String id = link.getId(context);
if (UtilValidate.isNotEmpty(id)) {
- buffer.append(" id=\"");
- buffer.append(id);
- buffer.append("\"");
+ writer.write(" id=\"");
+ writer.write(id);
+ writer.write("\"");
}
/*
@@ -392,24 +395,24 @@
}
if (UtilValidate.isNotEmpty(style)) {
- buffer.append(" class=\"");
- buffer.append(style);
- buffer.append("\"");
+ writer.write(" class=\"");
+ writer.write(style);
+ writer.write("\"");
}
*/
String name = link.getName(context);
if (UtilValidate.isNotEmpty(name)) {
- buffer.append(" name=\"");
- buffer.append(name);
- buffer.append("\"");
+ writer.write(" name=\"");
+ writer.write(name);
+ writer.write("\"");
}
String targetWindow = link.getTargetWindow(context);
if (UtilValidate.isNotEmpty(targetWindow)) {
- buffer.append(" target=\"");
- buffer.append(targetWindow);
- buffer.append("\"");
+ writer.write(" target=\"");
+ writer.write(targetWindow);
+ writer.write("\"");
}
- buffer.append(" href=\"");
+ writer.write(" href=\"");
String urlMode = link.getUrlMode();
String prefix = link.getPrefix(context);
boolean fullPath = link.getFullPath();
@@ -422,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);
- buffer.append(urlString);
+ writer.write(urlString);
} else if (prefix != null) {
- buffer.append(prefix + target);
+ writer.write(prefix + target);
} else {
- buffer.append(target);
+ writer.write(target);
}
} else if (urlMode != null && urlMode.equalsIgnoreCase("content")) {
StringBuffer newURL = new StringBuffer();
ContentUrlTag.appendContentPrefix(req, newURL);
newURL.append(target);
- buffer.append(newURL.toString());
+ writer.write(newURL.toString());
} else if ("inter-app".equalsIgnoreCase(urlMode) && req != null) {
String externalLoginKey = (String) req.getAttribute("externalLoginKey");
if (UtilValidate.isNotEmpty(externalLoginKey)) {
@@ -441,63 +444,63 @@
} else {
target += "?externalLoginKey=" + externalLoginKey;
}
- buffer.append(target);
+ writer.write(target);
}
} else {
- buffer.append(target);
+ writer.write(target);
}
- buffer.append("\">");
+ writer.write("\">");
}
// the text
Image img = link.getImage();
if (img == null)
- buffer.append(link.getText(context));
+ writer.write(link.getText(context));
else
- renderImage(buffer, context, img);
+ renderImage(writer, context, img);
if (UtilValidate.isNotEmpty(target)) {
// close tag
- buffer.append("</a>");
+ writer.write("</a>");
}
}
- public void renderImage(StringBuffer buffer, Map context, ModelMenuItem.Image image) {
+ public void renderImage(Writer writer, Map<String, Object> context, ModelMenuItem.Image image) throws IOException {
// open tag
- buffer.append("<img ");
+ writer.write("<img ");
String id = image.getId(context);
if (UtilValidate.isNotEmpty(id)) {
- buffer.append(" id=\"");
- buffer.append(id);
- buffer.append("\"");
+ writer.write(" id=\"");
+ writer.write(id);
+ writer.write("\"");
}
String style = image.getStyle(context);
if (UtilValidate.isNotEmpty(style)) {
- buffer.append(" class=\"");
- buffer.append(style);
- buffer.append("\"");
+ writer.write(" class=\"");
+ writer.write(style);
+ writer.write("\"");
}
String wid = image.getWidth(context);
if (UtilValidate.isNotEmpty(wid)) {
- buffer.append(" width=\"");
- buffer.append(wid);
- buffer.append("\"");
+ writer.write(" width=\"");
+ writer.write(wid);
+ writer.write("\"");
}
String hgt = image.getHeight(context);
if (UtilValidate.isNotEmpty(hgt)) {
- buffer.append(" height=\"");
- buffer.append(hgt);
- buffer.append("\"");
+ writer.write(" height=\"");
+ writer.write(hgt);
+ writer.write("\"");
}
String border = image.getBorder(context);
if (UtilValidate.isNotEmpty(border)) {
- buffer.append(" border=\"");
- buffer.append(border);
- buffer.append("\"");
+ writer.write(" border=\"");
+ writer.write(border);
+ writer.write("\"");
}
String src = image.getSrc(context);
if (UtilValidate.isNotEmpty(src)) {
- buffer.append(" src=\"");
+ writer.write(" src=\"");
String urlMode = image.getUrlMode();
boolean fullPath = false;
boolean secure = false;
@@ -509,24 +512,25 @@
ServletContext ctx = (ServletContext) request.getAttribute("servletContext");
RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_");
String urlString = rh.makeLink(request, response, src, fullPath, secure, encode);
- buffer.append(urlString);
+ writer.write(urlString);
} else {
- buffer.append(src);
+ writer.write(src);
}
} else if (urlMode != null && urlMode.equalsIgnoreCase("content")) {
if (request != null && response != null) {
StringBuffer newURL = new StringBuffer();
ContentUrlTag.appendContentPrefix(request, newURL);
newURL.append(src);
- buffer.append(newURL.toString());
+ writer.write(newURL.toString());
}
} else {
- buffer.append(src);
+ writer.write(src);
}
- buffer.append("\"");
+ writer.write("\"");
}
- buffer.append("/>");
+ writer.write("/>");
}
}
+
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRendererImage.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRendererImage.java?rev=662123&r1=662122&r2=662123&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRendererImage.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRendererImage.java Sat May 31 18:50:41 2008
@@ -18,17 +18,20 @@
*******************************************************************************/
package org.ofbiz.widget.html;
+import java.io.IOException;
+import java.io.StringWriter;
import java.util.Map;
+
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilValidate;
-import org.ofbiz.widget.WidgetContentWorker;
-import org.ofbiz.widget.menu.ModelMenuItem;
import org.ofbiz.entity.GenericDelegator;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
+import org.ofbiz.widget.WidgetContentWorker;
+import org.ofbiz.widget.menu.ModelMenuItem;
/**
* Widget Library - HTML Menu Renderer implementation
@@ -43,7 +46,7 @@
}
- public String buildDivStr(ModelMenuItem menuItem, Map context) {
+ public String buildDivStr(ModelMenuItem menuItem, Map<String, Object> context) throws IOException {
String imgStr = "<img src=\"";
String contentId = menuItem.getAssociatedContentId(context);
@@ -61,7 +64,7 @@
throw new RuntimeException(e.getMessage());
}
String medallionLogoStr = webSitePublishPoint.getString("medallionLogo");
- StringBuffer buf = new StringBuffer();
+ StringWriter buf = new StringWriter();
appendContentUrl(buf, medallionLogoStr);
imgStr += buf.toString();
//Debug.logInfo("in HtmlMenuRendererImage, imgStr:" + imgStr,"");
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuWrapper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuWrapper.java?rev=662123&r1=662122&r2=662123&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuWrapper.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuWrapper.java Sat May 31 18:50:41 2008
@@ -19,8 +19,11 @@
package org.ofbiz.widget.html;
import java.io.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
import java.util.HashMap;
import java.util.Map;
+
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -30,11 +33,10 @@
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilHttp;
import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.entity.GenericValue;
import org.ofbiz.widget.menu.MenuFactory;
import org.ofbiz.widget.menu.MenuStringRenderer;
import org.ofbiz.widget.menu.ModelMenu;
-import org.ofbiz.entity.GenericValue;
-
import org.xml.sax.SAXException;
@@ -51,7 +53,7 @@
protected HttpServletResponse response;
protected ModelMenu modelMenu;
protected MenuStringRenderer renderer;
- protected Map context;
+ protected Map<String, Object> context;
protected HtmlMenuWrapper() {}
@@ -99,15 +101,15 @@
return new HtmlMenuRenderer(request, response);
}
- public String renderMenuString() {
+ public String renderMenuString() throws IOException {
HttpServletRequest req = ((HtmlMenuRenderer)renderer).request;
ServletContext ctx = (ServletContext) req.getAttribute("servletContext");
if (ctx == null) {
if (Debug.infoOn()) Debug.logInfo("in renderMenuString, ctx is null(0)" , "");
}
- StringBuffer buffer = new StringBuffer();
- modelMenu.renderMenuString(buffer, context, renderer);
+ Writer writer = new StringWriter();
+ modelMenu.renderMenuString(writer, context, renderer);
HttpServletRequest req2 = ((HtmlMenuRenderer)renderer).request;
ServletContext ctx2 = (ServletContext) req2.getAttribute("servletContext");
@@ -115,7 +117,7 @@
if (Debug.infoOn()) Debug.logInfo("in renderMenuString, ctx is null(2)" , "");
}
- return buffer.toString();
+ return writer.toString();
}
/**
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=662123&r1=662122&r2=662123&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 Sat May 31 18:50:41 2008
@@ -67,14 +67,14 @@
return "hsr" + elementId;
}
- public void renderSectionBegin(Writer writer, Map context, ModelScreenWidget.Section section) throws IOException {
+ public void renderSectionBegin(Writer writer, Map<String, Object> context, ModelScreenWidget.Section section) throws IOException {
renderBeginningBoundaryComment(writer, section.isMainSection?"Screen":"Section Widget", section);
}
- public void renderSectionEnd(Writer writer, Map context, ModelScreenWidget.Section section) throws IOException {
+ public void renderSectionEnd(Writer writer, Map<String, Object> context, ModelScreenWidget.Section section) throws IOException {
renderEndingBoundaryComment(writer, section.isMainSection?"Screen":"Section Widget", section);
}
- public void renderContainerBegin(Writer writer, Map context, ModelScreenWidget.Container container) throws IOException {
+ public void renderContainerBegin(Writer 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");
@@ -112,12 +112,12 @@
writer.write(">");
appendWhitespace(writer);
}
- public void renderContainerEnd(Writer writer, Map context, ModelScreenWidget.Container container) throws IOException {
+ public void renderContainerEnd(Writer writer, Map<String, Object> context, ModelScreenWidget.Container container) throws IOException {
writer.write("</div>");
appendWhitespace(writer);
}
- public void renderScreenletBegin(Writer writer, Map context, boolean collapsed, ModelScreenWidget.Screenlet screenlet) throws IOException {
+ public void renderScreenletBegin(Writer 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();
@@ -201,7 +201,7 @@
}
}
- protected void renderScreenletPaginateMenu(Writer writer, Map context, ModelScreenWidget.Form form) throws IOException {
+ protected void renderScreenletPaginateMenu(Writer 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);
@@ -347,7 +347,7 @@
appendWhitespace(writer);
}
- public void renderScreenletSubWidget(Writer writer, Map context, ModelScreenWidget subWidget, ModelScreenWidget.Screenlet screenlet) throws GeneralException {
+ public void renderScreenletSubWidget(Writer 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,7 +364,7 @@
}
}
- public void renderScreenletEnd(Writer writer, Map context, ModelScreenWidget.Screenlet screenlet) throws IOException {
+ public void renderScreenletEnd(Writer writer, Map<String, Object> context, ModelScreenWidget.Screenlet screenlet) throws IOException {
if (screenlet.padded()) {
writer.write("</div>");
appendWhitespace(writer);
@@ -377,11 +377,11 @@
public ScreenletMenuRenderer(HttpServletRequest request, HttpServletResponse response) {
super(request, response);
}
- public void renderMenuOpen(StringBuffer buffer, Map context, ModelMenu modelMenu) {}
- public void renderMenuClose(StringBuffer buffer, Map context, ModelMenu modelMenu) {}
+ public void renderMenuOpen(Writer writer, Map<String, Object> context, ModelMenu modelMenu) {}
+ public void renderMenuClose(Writer writer, Map<String, Object> context, ModelMenu modelMenu) {}
}
- public void renderLabel(Writer writer, Map context, ModelScreenWidget.Label label) throws IOException {
+ public void renderLabel(Writer writer, Map<String, Object> context, ModelScreenWidget.Label label) throws IOException {
String labelText = label.getText(context);
if (UtilValidate.isEmpty(labelText)) {
// nothing to render
@@ -418,7 +418,7 @@
appendWhitespace(writer);
}
- public void renderLink(Writer writer, Map context, ModelScreenWidget.Link link) throws IOException {
+ public void renderLink(Writer writer, Map<String, Object> context, ModelScreenWidget.Link link) throws IOException {
// open tag
writer.write("<a");
String id = link.getId(context);
@@ -504,7 +504,7 @@
appendWhitespace(writer);
}
- public void renderImage(Writer writer, Map context, ModelScreenWidget.Image image) throws IOException {
+ public void renderImage(Writer writer, Map<String, Object> context, ModelScreenWidget.Image image) throws IOException {
// open tag
writer.write("<img ");
String id = image.getId(context);
@@ -574,7 +574,7 @@
appendWhitespace(writer);
}
- public void renderContentBegin(Writer writer, Map context, ModelScreenWidget.Content content) throws IOException {
+ public void renderContentBegin(Writer 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);
@@ -589,7 +589,7 @@
}
}
- public void renderContentBody(Writer writer, Map context, ModelScreenWidget.Content content) throws IOException {
+ public void renderContentBody(Writer 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";
@@ -653,7 +653,7 @@
}
}
- public void renderContentEnd(Writer writer, Map context, ModelScreenWidget.Content content) throws IOException {
+ public void renderContentEnd(Writer writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException {
//Debug.logInfo("renderContentEnd, context:" + context, module);
String expandedContentId = content.getContentId(context);
@@ -687,7 +687,7 @@
}
}
- public void renderContentFrame(Writer writer, Map context, ModelScreenWidget.Content content) throws IOException {
+ public void renderContentFrame(Writer writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException {
String dataResourceId = content.getDataResourceId(context);
// String urlString = "/content/control/ViewSimpleContent?dataResourceId=" + dataResourceId;
@@ -712,7 +712,7 @@
}
- public void renderSubContentBegin(Writer writer, Map context, ModelScreenWidget.SubContent content) throws IOException {
+ public void renderSubContentBegin(Writer writer, Map<String, Object> context, ModelScreenWidget.SubContent content) throws IOException {
String editRequest = content.getEditRequest(context);
String editContainerStyle = content.getEditContainerStyle(context);
@@ -726,7 +726,7 @@
}
}
- public void renderSubContentBody(Writer writer, Map context, ModelScreenWidget.SubContent content) throws IOException {
+ public void renderSubContentBody(Writer writer, Map<String, Object> context, ModelScreenWidget.SubContent content) throws IOException {
Locale locale = Locale.getDefault();
String mimeTypeId = "text/html";
String expandedContentId = content.getContentId(context);
@@ -774,7 +774,7 @@
}
}
- public void renderSubContentEnd(Writer writer, Map context, ModelScreenWidget.SubContent content) throws IOException {
+ public void renderSubContentEnd(Writer writer, Map<String, Object> context, ModelScreenWidget.SubContent content) throws IOException {
String editMode = "Edit";
String editRequest = content.getEditRequest(context);
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=662123&r1=662122&r2=662123&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 Sat May 31 18:50:41 2008
@@ -57,7 +57,7 @@
return buf.toString();
}
- public void renderNodeBegin(Writer writer, Map context, ModelTree.ModelNode node, int depth, boolean isLast) throws IOException {
+ public void renderNodeBegin(Writer writer, Map<String, Object> context, ModelTree.ModelNode node, int depth, boolean isLast) throws IOException {
String pathString = buildPathString(node.getModelTree(), depth);
String currentNodeTrailPiped = null;
@@ -159,7 +159,7 @@
}
}
- public void renderNodeEnd(Writer writer, Map context, ModelTree.ModelNode node) throws IOException {
+ public void renderNodeEnd(Writer writer, Map<String, Object> context, ModelTree.ModelNode node) throws IOException {
Boolean processChildren = (Boolean) context.get("processChildren");
if (processChildren.booleanValue()) {
appendWhitespace(writer);
@@ -175,7 +175,7 @@
}
}
- public void renderLastElement(Writer writer, Map context, ModelTree.ModelNode node) throws IOException {
+ public void renderLastElement(Writer writer, Map<String, Object> context, ModelTree.ModelNode node) throws IOException {
Boolean processChildren = (Boolean) context.get("processChildren");
if (processChildren.booleanValue()) {
appendWhitespace(writer);
@@ -183,7 +183,7 @@
}
}
- public void renderLabel(Writer writer, Map context, ModelTree.ModelNode.Label label) throws IOException {
+ public void renderLabel(Writer writer, Map<String, Object> context, ModelTree.ModelNode.Label label) throws IOException {
// open tag
writer.write("<span");
String id = label.getId(context);
@@ -210,7 +210,7 @@
}
- public void renderLink(Writer writer, Map context, ModelTree.ModelNode.Link link) throws IOException {
+ public void renderLink(Writer writer, Map<String, Object> context, ModelTree.ModelNode.Link link) throws IOException {
// open tag
writer.write("<a");
String id = link.getId(context);
@@ -300,7 +300,7 @@
// appendWhitespace(writer);
}
- public void renderImage(Writer writer, Map context, ModelTree.ModelNode.Image image) throws IOException {
+ public void renderImage(Writer writer, Map<String, Object> context, ModelTree.ModelNode.Image image) throws IOException {
// open tag
writer.write("<img ");
String id = image.getId(context);
@@ -368,7 +368,7 @@
}
- public ScreenStringRenderer getScreenStringRenderer(Map context) {
+ public ScreenStringRenderer getScreenStringRenderer(Map<String, Object> context) {
ScreenRenderer screenRenderer = (ScreenRenderer)context.get("screens");
if (screenRenderer != null) {
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=662123&r1=662122&r2=662123&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 Sat May 31 18:50:41 2008
@@ -46,14 +46,6 @@
}
/**
- * Helper method used to append whitespace characters to the end of each rendered element.
- * @param buffer The buffer to write to
- */
- public void appendWhitespace(StringBuffer buffer) {
- buffer.append(whiteSpace);
- }
-
- /**
* Helper method used to build the boundary comment string.
* @param boundaryType The boundary type: "Begin" or "End"
* @param widgetType The widget type: "Screen Widget", "Form Widget", etc.
@@ -69,18 +61,6 @@
/**
* Renders the beginning boundary comment string.
- * @param buffer The buffer to write to
- * @param widgetType The widget type: "Screen Widget", "Form Widget", etc.
- * @param modelWidget The widget
- */
- public void renderBeginningBoundaryComment(StringBuffer buffer, String widgetType, ModelWidget modelWidget) {
- if (modelWidget.boundaryCommentsEnabled()) {
- buffer.append(this.buildBoundaryComment("Begin", widgetType, modelWidget.getBoundaryCommentName()));
- }
- }
-
- /**
- * Renders the beginning boundary comment string.
* @param writer The writer to write to
* @param widgetType The widget type: "Screen Widget", "Form Widget", etc.
* @param modelWidget The widget
@@ -103,18 +83,6 @@
}
}
- /**
- * Renders the ending boundary comment string.
- * @param buffer The buffer to write to
- * @param widgetType The widget type: "Screen Widget", "Form Widget", etc.
- * @param modelWidget The widget
- */
- public void renderEndingBoundaryComment(StringBuffer buffer, String widgetType, ModelWidget modelWidget) {
- if (modelWidget.boundaryCommentsEnabled()) {
- buffer.append(this.buildBoundaryComment("End", widgetType, modelWidget.getBoundaryCommentName()));
- }
- }
-
/** Extracts parameters from a target URL string, prepares them for an Ajax
* JavaScript call. This method is currently set to return a parameter string
* suitable for the Prototype.js library.
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=662123&r1=662122&r2=662123&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 Sat May 31 18:50:41 2008
@@ -4,7 +4,7 @@
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
+ * "License") throws IOException ; you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@@ -18,6 +18,8 @@
*******************************************************************************/
package org.ofbiz.widget.menu;
+import java.io.IOException;
+import java.io.Writer;
import java.util.Map;
@@ -25,13 +27,13 @@
* Widget Library - Form String Renderer interface
*/
public interface MenuStringRenderer {
- public void renderMenuItem(StringBuffer buffer, Map context, ModelMenuItem menuItem);
- public void renderMenuOpen(StringBuffer buffer, Map context, ModelMenu menu);
- public void renderMenuClose(StringBuffer buffer, Map context, ModelMenu menu);
- public void renderFormatSimpleWrapperOpen(StringBuffer buffer, Map context, ModelMenu menu);
- public void renderFormatSimpleWrapperClose(StringBuffer buffer, Map context, ModelMenu menu);
- public void renderFormatSimpleWrapperRows(StringBuffer buffer, Map context, Object menu);
- public void setUserLoginIdHasChanged(boolean b);
- public void renderLink(StringBuffer buffer, Map context, ModelMenuItem.Link link);
- public void renderImage(StringBuffer buffer, Map context, ModelMenuItem.Image image);
+ 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 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 ;
}
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=662123&r1=662122&r2=662123&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 Sat May 31 18:50:41 2008
@@ -18,6 +18,8 @@
*******************************************************************************/
package org.ofbiz.widget.menu;
+import java.io.IOException;
+import java.io.Writer;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
@@ -28,8 +30,8 @@
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.base.util.UtilXml;
-import org.ofbiz.base.util.string.FlexibleStringExpander;
import org.ofbiz.base.util.collections.FlexibleMapAccessor;
+import org.ofbiz.base.util.string.FlexibleStringExpander;
import org.ofbiz.entity.GenericDelegator;
import org.ofbiz.service.LocalDispatcher;
import org.ofbiz.widget.ModelWidget;
@@ -279,7 +281,7 @@
return existingMenuItem;
}
- public ModelMenuItem getModelMenuItemByContentId(String contentId, Map context) {
+ public ModelMenuItem getModelMenuItemByContentId(String contentId, Map<String, Object> context) {
ModelMenuItem existingMenuItem = null;
if (UtilValidate.isEmpty(contentId))
@@ -300,7 +302,7 @@
* Renders this menu to a String, i.e. in a text format, as defined with the
* MenuStringRenderer implementation.
*
- * @param buffer The StringBuffer that the menu text will be written to
+ * @param writer The Writer that the menu text will be written to
* @param context Map containing the menu context; the following are
* reserved words in this context: parameters (Map), isError (Boolean),
* itemIndex (Integer, for lists only, otherwise null), bshInterpreter,
@@ -311,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(StringBuffer buffer, Map context, MenuStringRenderer menuStringRenderer) {
+ public void renderMenuString(Writer writer, Map<String, Object> context, MenuStringRenderer menuStringRenderer) throws IOException {
setWidgetBoundaryComments(context);
boolean passed = true;
@@ -320,7 +322,7 @@
if (passed) {
ModelMenuAction.runSubActions(this.actions, context);
if ("simple".equals(this.type)) {
- this.renderSimpleMenuString(buffer, context, menuStringRenderer);
+ this.renderSimpleMenuString(writer, context, menuStringRenderer);
} else {
throw new IllegalArgumentException("The type " + this.getType() + " is not supported for menu with name " + this.getName());
}
@@ -328,30 +330,30 @@
//Debug.logInfo("in ModelMenu, buffer:" + buffer.toString(), module);
}
- public void renderSimpleMenuString(StringBuffer buffer, Map context, MenuStringRenderer menuStringRenderer) {
+ public void renderSimpleMenuString(Writer writer, Map<String, Object> context, MenuStringRenderer menuStringRenderer) throws IOException {
//Iterator menuItemIter = null;
//Set alreadyRendered = new TreeSet();
// render menu open
- menuStringRenderer.renderMenuOpen(buffer, context, this);
+ menuStringRenderer.renderMenuOpen(writer, context, this);
// render formatting wrapper open
- menuStringRenderer.renderFormatSimpleWrapperOpen(buffer, context, this);
+ menuStringRenderer.renderFormatSimpleWrapperOpen(writer, context, this);
//Debug.logInfo("in ModelMenu, menuItemList:" + menuItemList, module);
// render each menuItem row, except hidden & ignored rows
- //menuStringRenderer.renderFormatSimpleWrapperRows(buffer, context, this);
+ //menuStringRenderer.renderFormatSimpleWrapperRows(writer, context, this);
Iterator iter = menuItemList.iterator();
while (iter.hasNext()) {
ModelMenuItem item = (ModelMenuItem)iter.next();
- item.renderMenuItemString(buffer, context, menuStringRenderer);
+ item.renderMenuItemString(writer, context, menuStringRenderer);
}
// render formatting wrapper close
- menuStringRenderer.renderFormatSimpleWrapperClose(buffer, context, this);
+ menuStringRenderer.renderFormatSimpleWrapperClose(writer, context, this);
// render menu close
- menuStringRenderer.renderMenuClose(buffer, context, this);
+ menuStringRenderer.renderMenuClose(writer, context, this);
}
@@ -437,7 +439,7 @@
/**
* @return
*/
- public String getSelectedMenuItemContextFieldName(Map context) {
+ public String getSelectedMenuItemContextFieldName(Map<String, Object> context) {
String menuItemName = (String)this.selectedMenuItemContextFieldName.get(context);
if (UtilValidate.isEmpty(menuItemName)) {
return this.defaultMenuItemName;
@@ -445,7 +447,7 @@
return menuItemName;
}
- public String getCurrentMenuName(Map context) {
+ public String getCurrentMenuName(Map<String, Object> context) {
return this.name;
}
@@ -459,7 +461,7 @@
/**
* @return
*/
- public String getTitle(Map context) {
+ public String getTitle(Map<String, Object> context) {
return title.expandString(context);
}
@@ -481,7 +483,7 @@
return menuLocation + "#" + name;
}
- public Interpreter getBshInterpreter(Map context) throws EvalError {
+ public Interpreter getBshInterpreter(Map<String, Object> context) throws EvalError {
Interpreter bsh = (Interpreter) context.get("bshInterpreter");
if (bsh == null) {
bsh = BshUtil.makeInterpreter(context);
@@ -599,13 +601,13 @@
/**
* @return
*/
- public String getDefaultAssociatedContentId(Map context) {
+ public String getDefaultAssociatedContentId(Map<String, Object> context) {
return defaultAssociatedContentId.expandString(context);
}
/**
* @return
*/
- public String getMenuContainerStyle(Map context) {
+ public String getMenuContainerStyle(Map<String, Object> context) {
return menuContainerStyleExdr.expandString(context);
}
@@ -725,28 +727,4 @@
return menuItemList;
}
- public void dump(StringBuffer buffer ) {
- buffer.append("ModelMenu:"
- + "\n name=" + this.name
- + "\n type=" + this.type
- + "\n target=" + this.target
- + "\n id=" + this.id
- + "\n title=" + this.title
- + "\n tooltip=" + this.tooltip
- + "\n defaultEntityName=" + this.defaultEntityName
- + "\n defaultTitleStyle=" + this.defaultTitleStyle
- + "\n defaultWidgetStyle=" + this.defaultWidgetStyle
- + "\n defaultTooltipStyle=" + this.defaultTooltipStyle
- + "\n defaultSelectedStyle=" + this.defaultSelectedStyle
- + "\n defaultMenuItemName=" + this.defaultMenuItemName
- + "\n\n");
-
- Iterator iter = menuItemList.iterator();
- while (iter.hasNext()) {
- ModelMenuItem menuItem = (ModelMenuItem)iter.next();
- menuItem.dump(buffer);
- }
-
- }
-
}
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuAction.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuAction.java?rev=662123&r1=662122&r2=662123&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuAction.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuAction.java Sat May 31 18:50:41 2008
@@ -68,7 +68,7 @@
if (Debug.verboseOn()) Debug.logVerbose("Reading Screen action with name: " + actionElement.getNodeName(), module);
}
- public abstract void runAction(Map context);
+ public abstract void runAction(Map<String, Object> context);
public static List readSubActions(ModelMenuItem modelMenuItem, Element parentElement) {
return readSubActions(modelMenuItem.getModelMenu(), parentElement);
@@ -105,7 +105,7 @@
return actions;
}
- public static void runSubActions(List actions, Map context) {
+ public static void runSubActions(List actions, Map<String, Object> context) {
if (actions == null) return;
Iterator actionIter = actions.iterator();
@@ -141,7 +141,7 @@
}
}
- public void runAction(Map context) {
+ public void runAction(Map<String, Object> context) {
String globalStr = this.globalExdr.expandString(context);
// default to false
boolean global = "true".equals(globalStr);
@@ -245,7 +245,7 @@
this.globalExdr = new FlexibleStringExpander(setElement.getAttribute("global"));
}
- public void runAction(Map context) {
+ public void runAction(Map<String, Object> context) {
String globalStr = this.globalExdr.expandString(context);
// default to false
boolean global = "true".equals(globalStr);
@@ -285,7 +285,7 @@
this.globalExdr = new FlexibleStringExpander(setElement.getAttribute("global"));
}
- public void runAction(Map context) {
+ public void runAction(Map<String, Object> context) {
// default to false
Locale locale = (Locale) context.get("locale");
@@ -326,7 +326,7 @@
this.location = scriptElement.getAttribute("location");
}
- public void runAction(Map context) {
+ public void runAction(Map<String, Object> context) {
if (location.endsWith(".bsh")) {
try {
BshUtil.runBshAtLocation(location, context);
@@ -367,7 +367,7 @@
}
}
- public void runAction(Map context) {
+ public void runAction(Map<String, Object> context) {
String serviceNameExpanded = this.serviceNameExdr.expandString(context);
if (UtilValidate.isEmpty(serviceNameExpanded)) {
throw new IllegalArgumentException("Service name was empty, expanded from: " + this.serviceNameExdr.getOriginal());
@@ -417,7 +417,7 @@
finder = new PrimaryKeyFinder(entityOneElement);
}
- public void runAction(Map context) {
+ public void runAction(Map<String, Object> context) {
try {
finder.runFind(context, this.modelMenu.getDelegator());
} catch (GeneralException e) {
@@ -436,7 +436,7 @@
finder = new ByAndFinder(entityAndElement);
}
- public void runAction(Map context) {
+ public void runAction(Map<String, Object> context) {
try {
finder.runFind(context, this.modelMenu.getDelegator());
} catch (GeneralException e) {
@@ -455,7 +455,7 @@
finder = new ByConditionFinder(entityConditionElement);
}
- public void runAction(Map context) {
+ public void runAction(Map<String, Object> context) {
try {
finder.runFind(context, this.modelMenu.getDelegator());
} catch (GeneralException e) {
@@ -468,3 +468,4 @@
}
+
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuCondition.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuCondition.java?rev=662123&r1=662122&r2=662123&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuCondition.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuCondition.java Sat May 31 18:50:41 2008
@@ -66,7 +66,7 @@
this.rootCondition = readCondition(modelMenuItem, firstChildElement);
}
- public boolean eval(Map context) {
+ public boolean eval(Map<String, Object> context) {
if (rootCondition == null) {
return true;
}
@@ -95,7 +95,7 @@
this.modelMenuItem = modelMenuItem;
}
- public abstract boolean eval(Map context);
+ public abstract boolean eval(Map<String, Object> context);
}
public static List readSubConditions(ModelMenuItem modelMenuItem, Element conditionElement) {
@@ -150,7 +150,7 @@
this.subConditions = readSubConditions(modelMenuItem, condElement);
}
- public boolean eval(Map context) {
+ public boolean eval(Map<String, Object> context) {
// return false for the first one in the list that is false, basic and algo
Iterator subConditionIter = this.subConditions.iterator();
while (subConditionIter.hasNext()) {
@@ -171,7 +171,7 @@
this.subConditions = readSubConditions(modelMenuItem, condElement);
}
- public boolean eval(Map context) {
+ public boolean eval(Map<String, Object> context) {
// if more than one is true stop immediately and return false; if all are false return false; if only one is true return true
boolean foundOneTrue = false;
Iterator subConditionIter = this.subConditions.iterator();
@@ -198,7 +198,7 @@
this.subConditions = readSubConditions(modelMenuItem, condElement);
}
- public boolean eval(Map context) {
+ public boolean eval(Map<String, Object> context) {
// return true for the first one in the list that is true, basic or algo
Iterator subConditionIter = this.subConditions.iterator();
while (subConditionIter.hasNext()) {
@@ -220,7 +220,7 @@
this.subCondition = readCondition(modelMenuItem, firstChildElement);
}
- public boolean eval(Map context) {
+ public boolean eval(Map<String, Object> context) {
return !this.subCondition.eval(context);
}
}
@@ -237,7 +237,7 @@
this.resExdr = new FlexibleStringExpander(condElement.getAttribute("resource-description"));
}
- public boolean eval(Map context) {
+ public boolean eval(Map<String, Object> context) {
// if no user is logged in, treat as if the user does not have permission
GenericValue userLogin = (GenericValue) context.get("userLogin");
if (userLogin != null) {
@@ -306,7 +306,7 @@
this.actionExdr = new FlexibleStringExpander(condElement.getAttribute("action"));
}
- public boolean eval(Map context) {
+ public boolean eval(Map<String, Object> context) {
// if no user is logged in, treat as if the user does not have permission
GenericValue userLogin = (GenericValue) context.get("userLogin");
if (userLogin != null) {
@@ -342,7 +342,7 @@
this.classExdr = new FlexibleStringExpander(condElement.getAttribute("class"));
}
- public boolean eval(Map context) {
+ public boolean eval(Map<String, Object> context) {
String methodName = this.methodExdr.expandString(context);
String className = this.classExdr.expandString(context);
@@ -408,7 +408,7 @@
this.formatExdr = new FlexibleStringExpander(condElement.getAttribute("format"));
}
- public boolean eval(Map context) {
+ public boolean eval(Map<String, Object> context) {
String value = this.valueExdr.expandString(context);
String format = this.formatExdr.expandString(context);
@@ -457,7 +457,7 @@
this.formatExdr = new FlexibleStringExpander(condElement.getAttribute("format"));
}
- public boolean eval(Map context) {
+ public boolean eval(Map<String, Object> context) {
String format = this.formatExdr.expandString(context);
Object fieldVal = this.fieldAcsr.get(context);
@@ -500,7 +500,7 @@
this.exprExdr = new FlexibleStringExpander(condElement.getAttribute("expr"));
}
- public boolean eval(Map context) {
+ public boolean eval(Map<String, Object> context) {
Object fieldVal = this.fieldAcsr.get(context);
String expr = this.exprExdr.expandString(context);
Pattern pattern = null;
@@ -533,7 +533,7 @@
this.fieldAcsr = new FlexibleMapAccessor(condElement.getAttribute("field-name"));
}
- public boolean eval(Map context) {
+ public boolean eval(Map<String, Object> context) {
Object fieldVal = this.fieldAcsr.get(context);
return ObjectType.isEmpty(fieldVal);
}
@@ -546,7 +546,7 @@
this.permissionChecker = new EntityPermissionChecker(condElement);
}
- public boolean eval(Map context) {
+ public boolean eval(Map<String, Object> context) {
boolean passed = permissionChecker.runPermissionCheck(context);
return passed;
@@ -555,3 +555,4 @@
}
+
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=662123&r1=662122&r2=662123&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 Sat May 31 18:50:41 2008
@@ -19,6 +19,7 @@
package org.ofbiz.widget.menu;
import java.io.IOException;
+import java.io.Writer;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
@@ -245,7 +246,7 @@
*/
}
- public void renderMenuItemString(StringBuffer buffer, Map context, MenuStringRenderer menuStringRenderer) {
+ public void renderMenuItemString(Writer writer, Map<String, Object> context, MenuStringRenderer menuStringRenderer) throws IOException {
boolean passed = true;
if (this.condition != null) {
@@ -256,7 +257,7 @@
//Debug.logInfo("in ModelMenu, name:" + this.getName(), module);
if (passed) {
ModelMenuAction.runSubActions(this.actions, context);
- menuStringRenderer.renderMenuItem(buffer, context, this);
+ menuStringRenderer.renderMenuItem(writer, context, this);
}
}
@@ -317,7 +318,7 @@
/**
* @return
*/
- public String getTitle(Map context) {
+ public String getTitle(Map<String, Object> context) {
return title.expandString(context);
}
@@ -367,7 +368,7 @@
/**
* @return
*/
- public String getTooltip(Map context) {
+ public String getTooltip(Map<String, Object> context) {
if (tooltip != null && !tooltip.isEmpty()) {
return tooltip.expandString(context);
} else {
@@ -484,7 +485,7 @@
/**
* @return
*/
- public String getAssociatedContentId(Map context) {
+ public String getAssociatedContentId(Map<String, Object> context) {
String retStr = null;
if (this.associatedContentId != null) {
retStr = associatedContentId.expandString(context);
@@ -553,23 +554,11 @@
return this.hasPermission;
}
- public void dump(StringBuffer buffer ) {
- buffer.append("ModelMenuItem:" + "\n title=")
- .append(this.title).append("\n name=")
- .append(this.name).append("\n entityName=")
- .append(this.entityName).append("\n titleStyle=")
- .append(this.titleStyle).append("\n widgetStyle=")
- .append(this.widgetStyle).append("\n tooltipStyle=")
- .append(this.tooltipStyle).append("\n selectedStyle=")
- .append(this.selectedStyle)
- .append("\n\n");
- }
-
public Link getLink() {
return this.link;
}
- public boolean isSelected(Map context) {
+ public boolean isSelected(Map<String, Object> context) {
return this.name.equals(modelMenu.getSelectedMenuItemContextFieldName(context));
}
@@ -610,22 +599,22 @@
}
- public void renderLinkString(StringBuffer buffer, Map context, MenuStringRenderer menuStringRenderer) {
- menuStringRenderer.renderLink(buffer, context, this);
+ public void renderLinkString(Writer writer, Map<String, Object> context, MenuStringRenderer menuStringRenderer) throws IOException {
+ menuStringRenderer.renderLink(writer, context, this);
}
- public String getText(Map context) {
+ public String getText(Map<String, Object> context) {
String txt = this.textExdr.expandString(context);
if (UtilValidate.isEmpty(txt))
txt = linkMenuItem.getTitle(context);
return txt;
}
- public String getId(Map context) {
+ public String getId(Map<String, Object> context) {
return this.idExdr.expandString(context);
}
- public String getStyle(Map context) {
+ public String getStyle(Map<String, Object> context) {
String style = this.styleExdr.expandString(context);
if (UtilValidate.isEmpty(style)) {
style = this.linkMenuItem.getWidgetStyle();
@@ -633,15 +622,15 @@
return style;
}
- public String getName(Map context) {
+ public String getName(Map<String, Object> context) {
return this.nameExdr.expandString(context);
}
- public String getTarget(Map context) {
+ public String getTarget(Map<String, Object> context) {
return this.targetExdr.expandString(context);
}
- public String getTargetWindow(Map context) {
+ public String getTargetWindow(Map<String, Object> context) {
return this.targetWindowExdr.expandString(context);
}
@@ -649,7 +638,7 @@
return this.urlMode;
}
- public String getPrefix(Map context) {
+ public String getPrefix(Map<String, Object> context) {
return this.prefixExdr.expandString(context);
}
@@ -759,31 +748,31 @@
}
- public void renderImageString(StringBuffer buffer, Map context, MenuStringRenderer menuStringRenderer) {
- menuStringRenderer.renderImage(buffer, context, this);
+ public void renderImageString(Writer writer, Map<String, Object> context, MenuStringRenderer menuStringRenderer) throws IOException {
+ menuStringRenderer.renderImage(writer, context, this);
}
- public String getSrc(Map context) {
+ public String getSrc(Map<String, Object> context) {
return this.srcExdr.expandString(context);
}
- public String getId(Map context) {
+ public String getId(Map<String, Object> context) {
return this.idExdr.expandString(context);
}
- public String getStyle(Map context) {
+ public String getStyle(Map<String, Object> context) {
return this.styleExdr.expandString(context);
}
- public String getWidth(Map context) {
+ public String getWidth(Map<String, Object> context) {
return this.widthExdr.expandString(context);
}
- public String getHeight(Map context) {
+ public String getHeight(Map<String, Object> context) {
return this.heightExdr.expandString(context);
}
- public String getBorder(Map context) {
+ public String getBorder(Map<String, Object> context) {
return this.borderExdr.expandString(context);
}
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=662123&r1=662122&r2=662123&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 Sat May 31 18:50:41 2008
@@ -63,14 +63,14 @@
}
}
- public void renderWidgetString(Writer writer, Map context, ScreenStringRenderer screenStringRenderer) throws GeneralException {
+ public void renderWidgetString(Writer writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException {
for (ModelScreenWidget subWidget : subWidgets) {
subWidget.renderWidgetString(writer, context, screenStringRenderer);
}
}
public String rawString() {
- StringBuffer buffer = new StringBuffer("<html-widget>");
+ StringBuilder buffer = new StringBuilder("<html-widget>");
for (ModelScreenWidget subWidget : subWidgets) {
buffer.append(subWidget.rawString());
}
@@ -78,7 +78,7 @@
return buffer.toString();
}
- public static void renderHtmlTemplate(Writer writer, FlexibleStringExpander locationExdr, Map context) {
+ public static void renderHtmlTemplate(Writer writer, FlexibleStringExpander locationExdr, Map<String, Object> context) {
String location = locationExdr.expandString(context);
//Debug.logInfo("Rendering template at location [" + location + "] with context: \n" + context, module);
@@ -135,7 +135,7 @@
this.locationExdr = new FlexibleStringExpander(htmlTemplateElement.getAttribute("location"));
}
- public void renderWidgetString(Writer writer, Map context, ScreenStringRenderer screenStringRenderer) {
+ public void renderWidgetString(Writer writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) {
renderHtmlTemplate(writer, this.locationExdr, context);
}
@@ -161,7 +161,7 @@
}
}
- public void renderWidgetString(Writer writer, Map context, ScreenStringRenderer screenStringRenderer) {
+ public void renderWidgetString(Writer 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 context, ScreenStringRenderer screenStringRenderer) throws GeneralException {
+ public void renderWidgetString(Writer 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=662123&r1=662122&r2=662123&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 Sat May 31 18:50:41 2008
@@ -86,7 +86,7 @@
}
}
- public void renderWidgetString(Writer writer, Map context, ScreenStringRenderer screenStringRenderer) throws GeneralException {
+ public void renderWidgetString(Writer writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException {
boolean isEntrySet = false;
if (!(context instanceof MapStack)) {
@@ -162,7 +162,7 @@
/*
* @return
*/
- public String getPaginateTarget(Map context) {
+ public String getPaginateTarget(Map<String, Object> context) {
return this.paginateTarget.expandString(context);
}
@@ -230,7 +230,7 @@
return actualPageSize;
}
- public void getListLimits(Map context, List items) {
+ public void getListLimits(Map<String, Object> context, List items) {
listSize = items.size();
if (paginate) {
@@ -265,7 +265,7 @@
}
- public void renderNextPrev(Writer writer, Map context) throws IOException {
+ public void renderNextPrev(Writer writer, Map<String, Object> context) throws IOException {
String targetService = this.getPaginateTarget(context);
if (targetService == null) {
targetService = "${targetService}";
@@ -372,3 +372,4 @@
}
}
+
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=662123&r1=662122&r2=662123&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 Sat May 31 18:50:41 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 context, ScreenStringRenderer screenStringRenderer) throws ScreenRenderException {
+ public void renderScreenString(Writer 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);
@@ -435,14 +435,15 @@
}
}
- public LocalDispatcher getDispatcher(Map context) {
+ public LocalDispatcher getDispatcher(Map<String, Object> context) {
LocalDispatcher dispatcher = (LocalDispatcher) context.get("dispatcher");
return dispatcher;
}
- public GenericDelegator getDelegator(Map context) {
+ public GenericDelegator getDelegator(Map<String, Object> context) {
GenericDelegator delegator = (GenericDelegator) context.get("delegator");
return delegator;
}
}
+
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenAction.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenAction.java?rev=662123&r1=662122&r2=662123&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenAction.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenAction.java Sat May 31 18:50:41 2008
@@ -75,7 +75,7 @@
if (Debug.verboseOn()) Debug.logVerbose("Reading Screen action with name: " + actionElement.getNodeName(), module);
}
- public abstract void runAction(Map context) throws GeneralException;
+ public abstract void runAction(Map<String, Object> context) throws GeneralException;
public static List readSubActions(ModelScreen modelScreen, Element parentElement) {
List actions = FastList.newInstance();
@@ -112,7 +112,7 @@
return actions;
}
- public static void runSubActions(List actions, Map context) throws GeneralException {
+ public static void runSubActions(List actions, Map<String, Object> context) throws GeneralException {
if (actions == null) return;
Iterator actionIter = actions.iterator();
@@ -148,7 +148,7 @@
}
}
- public void runAction(Map context) {
+ public void runAction(Map<String, Object> context) {
String globalStr = this.globalExdr.expandString(context);
// default to false
boolean global = "true".equals(globalStr);
@@ -248,7 +248,7 @@
}
}
- public Object getInMemoryPersistedFromField(Object storeAgent, Map context) {
+ public Object getInMemoryPersistedFromField(Object storeAgent, Map<String, Object> context) {
Object newValue = null;
String originalName = this.fromField.getOriginalName();
List currentWidgetTrail = (List)context.get("_WIDGETTRAIL_");
@@ -290,7 +290,7 @@
this.globalExdr = new FlexibleStringExpander(setElement.getAttribute("global"));
}
- public void runAction(Map context) {
+ public void runAction(Map<String, Object> context) {
String globalStr = this.globalExdr.expandString(context);
// default to false
boolean global = "true".equals(globalStr);
@@ -343,7 +343,7 @@
this.globalExdr = new FlexibleStringExpander(setElement.getAttribute("global"));
}
- public void runAction(Map context) {
+ public void runAction(Map<String, Object> context) {
//String globalStr = this.globalExdr.expandString(context);
// default to false
//boolean global = "true".equals(globalStr);
@@ -386,7 +386,7 @@
this.location = scriptElement.getAttribute("location");
}
- public void runAction(Map context) throws GeneralException {
+ public void runAction(Map<String, Object> context) throws GeneralException {
if (location.endsWith(".bsh")) {
try {
BshUtil.runBshAtLocation(location, context);
@@ -432,7 +432,7 @@
this.fieldMap = EntityFinderUtil.makeFieldMap(serviceElement);
}
- public void runAction(Map context) {
+ public void runAction(Map<String, Object> context) {
String serviceNameExpanded = this.serviceNameExdr.expandString(context);
if (UtilValidate.isEmpty(serviceNameExpanded)) {
throw new IllegalArgumentException("Service name was empty, expanded from: " + this.serviceNameExdr.getOriginal());
@@ -501,7 +501,7 @@
finder = new PrimaryKeyFinder(entityOneElement);
}
- public void runAction(Map context) {
+ public void runAction(Map<String, Object> context) {
try {
finder.runFind(context, this.modelScreen.getDelegator(context));
} catch (GeneralException e) {
@@ -520,7 +520,7 @@
finder = new ByAndFinder(entityAndElement);
}
- public void runAction(Map context) {
+ public void runAction(Map<String, Object> context) {
try {
finder.runFind(context, this.modelScreen.getDelegator(context));
} catch (GeneralException e) {
@@ -539,7 +539,7 @@
finder = new ByConditionFinder(entityConditionElement);
}
- public void runAction(Map context) {
+ public void runAction(Map<String, Object> context) {
try {
finder.runFind(context, this.modelScreen.getDelegator(context));
} catch (GeneralException e) {
@@ -564,7 +564,7 @@
this.useCache = "true".equals(getRelatedOneElement.getAttribute("use-cache"));
}
- public void runAction(Map context) {
+ public void runAction(Map<String, Object> context) {
Object valueObject = valueNameAcsr.get(context);
if (valueObject == null) {
Debug.logVerbose("Value not found with name: " + valueNameAcsr + ", not getting related...", module);
@@ -609,7 +609,7 @@
this.useCache = "true".equals(getRelatedElement.getAttribute("use-cache"));
}
- public void runAction(Map context) {
+ public void runAction(Map<String, Object> context) {
Object valueObject = valueNameAcsr.get(context);
if (valueObject == null) {
Debug.logVerbose("Value not found with name: " + valueNameAcsr + ", not getting related...", module);
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenCondition.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenCondition.java?rev=662123&r1=662122&r2=662123&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenCondition.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenCondition.java Sat May 31 18:50:41 2008
@@ -60,7 +60,7 @@
this.rootCondition = readCondition(modelScreen, firstChildElement);
}
- public boolean eval(Map context) {
+ public boolean eval(Map<String, Object> context) {
if (rootCondition == null) {
return true;
}
@@ -74,7 +74,7 @@
this.modelScreen = modelScreen;
}
- public abstract boolean eval(Map context);
+ public abstract boolean eval(Map<String, Object> context);
}
public static List readSubConditions(ModelScreen modelScreen, Element conditionElement) {
@@ -129,7 +129,7 @@
this.subConditions = readSubConditions(modelScreen, condElement);
}
- public boolean eval(Map context) {
+ public boolean eval(Map<String, Object> context) {
// return false for the first one in the list that is false, basic and algo
Iterator subConditionIter = this.subConditions.iterator();
while (subConditionIter.hasNext()) {
@@ -150,7 +150,7 @@
this.subConditions = readSubConditions(modelScreen, condElement);
}
- public boolean eval(Map context) {
+ public boolean eval(Map<String, Object> context) {
// if more than one is true stop immediately and return false; if all are false return false; if only one is true return true
boolean foundOneTrue = false;
Iterator subConditionIter = this.subConditions.iterator();
@@ -177,7 +177,7 @@
this.subConditions = readSubConditions(modelScreen, condElement);
}
- public boolean eval(Map context) {
+ public boolean eval(Map<String, Object> context) {
// return true for the first one in the list that is true, basic or algo
Iterator subConditionIter = this.subConditions.iterator();
while (subConditionIter.hasNext()) {
@@ -199,7 +199,7 @@
this.subCondition = readCondition(modelScreen, firstChildElement);
}
- public boolean eval(Map context) {
+ public boolean eval(Map<String, Object> context) {
return !this.subCondition.eval(context);
}
}
@@ -218,7 +218,7 @@
this.resExdr = new FlexibleStringExpander(condElement.getAttribute("resource-description"));
}
- public boolean eval(Map context) {
+ public boolean eval(Map<String, Object> context) {
// if no user is logged in, treat as if the user does not have permission
GenericValue userLogin = (GenericValue) context.get("userLogin");
if (userLogin != null) {
@@ -300,7 +300,7 @@
this.actionExdr = new FlexibleStringExpander(condElement.getAttribute("action"));
}
- public boolean eval(Map context) {
+ public boolean eval(Map<String, Object> context) {
// if no user is logged in, treat as if the user does not have permission
GenericValue userLogin = (GenericValue) context.get("userLogin");
if (userLogin != null) {
@@ -336,7 +336,7 @@
this.classExdr = new FlexibleStringExpander(condElement.getAttribute("class"));
}
- public boolean eval(Map context) {
+ public boolean eval(Map<String, Object> context) {
String methodName = this.methodExdr.expandString(context);
String className = this.classExdr.expandString(context);
@@ -402,7 +402,7 @@
this.formatExdr = new FlexibleStringExpander(condElement.getAttribute("format"));
}
- public boolean eval(Map context) {
+ public boolean eval(Map<String, Object> context) {
String value = this.valueExdr.expandString(context);
String format = this.formatExdr.expandString(context);
@@ -451,7 +451,7 @@
this.formatExdr = new FlexibleStringExpander(condElement.getAttribute("format"));
}
- public boolean eval(Map context) {
+ public boolean eval(Map<String, Object> context) {
String format = this.formatExdr.expandString(context);
Object fieldVal = this.fieldAcsr.get(context);
@@ -494,7 +494,7 @@
this.exprExdr = new FlexibleStringExpander(condElement.getAttribute("expr"));
}
- public boolean eval(Map context) {
+ public boolean eval(Map<String, Object> context) {
Object fieldVal = this.fieldAcsr.get(context);
String expr = this.exprExdr.expandString(context);
Pattern pattern;
@@ -527,7 +527,7 @@
this.fieldAcsr = new FlexibleMapAccessor(condElement.getAttribute("field-name"));
}
- public boolean eval(Map context) {
+ public boolean eval(Map<String, Object> context) {
Object fieldVal = this.fieldAcsr.get(context);
return ObjectType.isEmpty(fieldVal);
}
@@ -540,10 +540,11 @@
this.permissionChecker = new EntityPermissionChecker(condElement);
}
- public boolean eval(Map context) {
+ public boolean eval(Map<String, Object> context) {
return permissionChecker.runPermissionCheck(context);
}
}
}
+
|