You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by do...@apache.org on 2009/03/22 00:25:00 UTC
svn commit: r757077 [3/5] - in
/ofbiz/trunk/framework/widget/src/org/ofbiz/widget: ./ cache/ fo/ form/
html/ menu/ screen/ text/ tree/ xml/
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=757077&r1=757076&r2=757077&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 Mar 21 23:24:58 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); 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
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -101,14 +101,14 @@
writer.append(containerId);
writer.append("\"");
}
-
+
String style = container.getStyle(context);
if (UtilValidate.isNotEmpty(style)) {
writer.append(" class=\"");
writer.append(style);
writer.append("\"");
}
-
+
writer.append(">");
appendWhitespace(writer);
}
@@ -235,7 +235,7 @@
appendWhitespace(writer);
}
}
-
+
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");
@@ -378,7 +378,7 @@
writer.append("</li>");
appendWhitespace(writer);
}
-
+
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");
@@ -424,7 +424,7 @@
String id = label.getId(context);
if (UtilValidate.isNotEmpty(style) || UtilValidate.isNotEmpty(id) ) {
writer.append("<span");
-
+
if (UtilValidate.isNotEmpty(id)) {
writer.append(" id=\"");
writer.append(id);
@@ -436,17 +436,17 @@
writer.append("\"");
}
writer.append(">");
-
+
// the text
writer.append(labelText);
-
+
// close tag
writer.append("</span>");
-
+
} else {
writer.append(labelText);
}
-
+
appendWhitespace(writer);
}
@@ -456,7 +456,7 @@
String targetWindow = link.getTargetWindow(context);
String target = link.getTarget(context);
-
+
String uniqueItemName = link.getModelScreen().getName() + "_LF_" + UtilMisc.<String>addToBigDecimalInMap(context, "screenUniqueItemIndex", BigDecimal.ONE);
String linkType = WidgetWorker.determineAutoLinkType(link.getLinkType(), target, link.getUrlMode(), request);
@@ -464,7 +464,7 @@
writer.append("<form method=\"post\"");
writer.append(" action=\"");
// note that this passes null for the parameterList on purpose so they won't be put into the URL
- WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), null, link.getPrefix(context),
+ WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), null, link.getPrefix(context),
link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context);
writer.append("\"");
@@ -487,10 +487,10 @@
writer.append(parameter.getValue(context));
writer.append("\" type=\"hidden\"/>");
}
-
+
writer.append("</form>");
}
-
+
writer.append("<a");
String id = link.getId(context);
if (UtilValidate.isNotEmpty(id)) {
@@ -522,13 +522,13 @@
writer.append(uniqueItemName);
writer.append(".submit()");
} else {
- WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterList(), link.getPrefix(context),
+ WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterList(), link.getPrefix(context),
link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context);
}
writer.append("\"");
}
writer.append(">");
-
+
// the text
ModelScreenWidget.Image img = link.getImage();
if (img == null) {
@@ -536,10 +536,10 @@
} else {
renderImage(writer, context, img);
}
-
+
// close tag
writer.append("</a>");
-
+
appendWhitespace(writer);
}
@@ -586,7 +586,7 @@
writer.append(alt);
writer.append("\"");
}
-
+
writer.append(" src=\"");
String urlMode = image.getUrlMode();
boolean fullPath = false;
@@ -613,9 +613,9 @@
} else {
writer.append(src);
}
-
+
writer.append("\"/>");
-
+
appendWhitespace(writer);
}
@@ -624,9 +624,9 @@
String editContainerStyle = content.getEditContainerStyle(context);
String enableEditName = content.getEnableEditName(context);
String enableEditValue = (String)context.get(enableEditName);
-
+
if (Debug.verboseOn()) Debug.logVerbose("directEditRequest:" + editRequest, module);
-
+
if (UtilValidate.isNotEmpty(editRequest) && "true".equals(enableEditValue)) {
writer.append("<div");
writer.append(" class=\"" + editContainerStyle + "\"> ");
@@ -649,7 +649,7 @@
contentContext.putAll(context);
String dataResourceId = (String)contentContext.get("dataResourceId");
if (Debug.verboseOn()) Debug.logVerbose("expandedContentId:" + expandedContentId, module);
-
+
try {
if (UtilValidate.isNotEmpty(dataResourceId)) {
if (WidgetDataResourceWorker.dataresourceWorker != null) {
@@ -683,7 +683,7 @@
if (content.xmlEscape()) {
renderedContent = UtilFormatOut.encodeXmlValue(renderedContent);
}
-
+
writer.append(renderedContent);
}
@@ -711,7 +711,7 @@
editMode += " Image";
}
//String editRequestWithParams = editRequest + "?contentId=${currentValue.contentId}&drDataResourceId=${currentValue.drDataResourceId}&directEditRequest=${directEditRequest}&indirectEditRequest=${indirectEditRequest}&caContentIdTo=${currentValue.caContentIdTo}&caFromDate=${currentValue.caFromDate}&caContentAssocTypeId=${currentValue.caContentAssocTypeId}";
-
+
if (UtilValidate.isNotEmpty(editRequest) && "true".equals(enableEditValue)) {
HttpServletResponse response = (HttpServletResponse) context.get("response");
HttpServletRequest request = (HttpServletRequest) context.get("request");
@@ -733,18 +733,18 @@
}
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;
String urlString = "/ViewSimpleContent?dataResourceId=" + dataResourceId;
-
+
String width = content.getWidth();
String widthString=" width=\"" + width + "\"";
String height = content.getHeight();
String heightString=" height=\"" + height + "\"";
String border = content.getBorder();
String borderString = (UtilValidate.isNotEmpty(border)) ? " border=\"" + border + "\"" : "";
-
+
HttpServletRequest request = (HttpServletRequest) context.get("request");
HttpServletResponse response = (HttpServletResponse) context.get("response");
if (request != null && response != null) {
@@ -754,7 +754,7 @@
String linkString = "<iframe src=\"" + fullUrlString + "\" " + widthString + heightString + borderString + " />";
writer.append(linkString);
}
-
+
}
public void renderSubContentBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.SubContent content) throws IOException {
@@ -766,7 +766,7 @@
if (UtilValidate.isNotEmpty(editRequest) && "true".equals(enableEditValue)) {
writer.append("<div");
writer.append(" class=\"" + editContainerStyle + "\"> ");
-
+
appendWhitespace(writer);
}
}
@@ -804,7 +804,7 @@
if (content.xmlEscape()) {
renderedContent = UtilFormatOut.encodeXmlValue(renderedContent);
}
-
+
writer.append(renderedContent);
}
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=757077&r1=757076&r2=757077&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 Mar 21 23:24:58 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); 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
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -43,7 +43,7 @@
public class HtmlTreeRenderer extends HtmlWidgetRenderer implements TreeStringRenderer {
ScreenStringRenderer screenStringRenderer = null;
- public static final String module = HtmlTreeRenderer.class.getName();
+ public static final String module = HtmlTreeRenderer.class.getName();
public HtmlTreeRenderer() {}
@@ -77,7 +77,7 @@
if (depth < targetNodeTrail.size()) {
targetEntityId = (String)targetNodeTrail.get(depth);
}
-
+
int openDepth = node.getModelTree().getOpenDepth();
if (depth >= openDepth && (targetEntityId == null || !targetEntityId.equals(entityId))) {
// Not on the trail
@@ -151,7 +151,7 @@
writer.append("<ul class=\"basic-tree\">");
}
}
-
+
public void renderLabel(Appendable writer, Map<String, Object> context, ModelTree.ModelNode.Label label) throws IOException {
// open tag
writer.append("<span");
@@ -168,13 +168,13 @@
writer.append("\"");
}
writer.append(">");
-
+
// the text
writer.append(label.getText(context));
-
+
// close tag
writer.append("</span>");
-
+
appendWhitespace(writer);
}
@@ -205,7 +205,7 @@
writer.append(" title=\"");
writer.append(title);
writer.append("\"");
- }
+ }
String targetWindow = link.getTargetWindow(context);
if (UtilValidate.isNotEmpty(targetWindow)) {
writer.append(" target=\"");
@@ -254,7 +254,7 @@
writer.append("\"");
}
writer.append(">");
-
+
// the text
ModelTree.ModelNode.Image img = link.getImage();
if (img == null) {
@@ -330,11 +330,11 @@
writer.append("\"");
}
writer.append("/>");
-
+
}
public ScreenStringRenderer getScreenStringRenderer(Map<String, Object> context) {
- ScreenRenderer screenRenderer = (ScreenRenderer)context.get("screens");
+ ScreenRenderer screenRenderer = (ScreenRenderer)context.get("screens");
if (screenRenderer != null) {
screenStringRenderer = screenRenderer.getScreenStringRenderer();
} else {
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=757077&r1=757076&r2=757077&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 Mar 21 23:24:58 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); 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
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -43,7 +43,7 @@
public void appendWhitespace(Appendable writer) throws IOException {
writer.append(whiteSpace);
}
-
+
/**
* Helper method used to build the boundary comment string.
* @param boundaryType The boundary type: "Begin" or "End"
@@ -53,7 +53,7 @@
public String buildBoundaryComment(String boundaryType, String widgetType, String widgetName) {
return formatBoundaryComment(boundaryType, widgetType, widgetName);
}
-
+
public static String formatBoundaryComment(String boundaryType, String widgetType, String widgetName) {
return "<!-- " + boundaryType + " " + widgetType + " " + widgetName + " -->" + whiteSpace;
}
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuFactory.java?rev=757077&r1=757076&r2=757077&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuFactory.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuFactory.java Sat Mar 21 23:24:58 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); 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
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -45,18 +45,18 @@
* Widget Library - Menu factory class
*/
public class MenuFactory {
-
+
public static final String module = MenuFactory.class.getName();
public static final UtilCache<String, Map<String, ModelMenu>> menuWebappCache = new UtilCache<String, Map<String, ModelMenu>>("widget.menu.webappResource", 0, 0, false);
public static final UtilCache<String, Map<String, ModelMenu>> menuLocationCache = new UtilCache<String, Map<String, ModelMenu>>("widget.menu.locationResource", 0, 0, false);
-
- public static ModelMenu getMenuFromWebappContext(String resourceName, String menuName, HttpServletRequest request)
+
+ public static ModelMenu getMenuFromWebappContext(String resourceName, String menuName, HttpServletRequest request)
throws IOException, SAXException, ParserConfigurationException {
String webappName = UtilHttp.getApplicationName(request);
String cacheKey = webappName + "::" + resourceName;
-
-
+
+
Map<String, ModelMenu> modelMenuMap = menuWebappCache.get(cacheKey);
if (modelMenuMap == null) {
synchronized (MenuFactory.class) {
@@ -65,7 +65,7 @@
ServletContext servletContext = (ServletContext) request.getAttribute("servletContext");
GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator");
LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
-
+
URL menuFileUrl = servletContext.getResource(resourceName);
Document menuFileDoc = UtilXml.readXmlDocument(menuFileUrl, true);
modelMenuMap = readMenuDocument(menuFileDoc, delegator, dispatcher, cacheKey);
@@ -73,18 +73,18 @@
}
}
}
-
+
if (UtilValidate.isEmpty(modelMenuMap)) {
throw new IllegalArgumentException("Could not find menu file in webapp resource [" + resourceName + "] in the webapp [" + webappName + "]");
}
-
+
ModelMenu modelMenu = (ModelMenu) modelMenuMap.get(menuName);
if (modelMenu == null) {
throw new IllegalArgumentException("Could not find menu with name [" + menuName + "] in webapp resource [" + resourceName + "] in the webapp [" + webappName + "]");
}
return modelMenu;
}
-
+
public static Map<String, ModelMenu> readMenuDocument(Document menuFileDoc, GenericDelegator delegator, LocalDispatcher dispatcher, String menuLocation) {
Map<String, ModelMenu> modelMenuMap = new HashMap<String, ModelMenu>();
if (menuFileDoc != null) {
@@ -102,7 +102,7 @@
return modelMenuMap;
}
- public static ModelMenu getMenuFromLocation(String resourceName, String menuName, GenericDelegator delegator, LocalDispatcher dispatcher)
+ public static ModelMenu getMenuFromLocation(String resourceName, String menuName, GenericDelegator delegator, LocalDispatcher dispatcher)
throws IOException, SAXException, ParserConfigurationException {
Map<String, ModelMenu> modelMenuMap = menuLocationCache.get(resourceName);
if (modelMenuMap == null) {
@@ -113,7 +113,7 @@
if (loader == null) {
loader = MenuFactory.class.getClassLoader();
}
-
+
URL menuFileUrl = null;
menuFileUrl = FlexibleLocation.resolveLocation(resourceName); //, loader);
Document menuFileDoc = UtilXml.readXmlDocument(menuFileUrl, true);
@@ -126,12 +126,12 @@
if (UtilValidate.isEmpty(modelMenuMap)) {
throw new IllegalArgumentException("Could not find menu file in location [" + resourceName + "]");
}
-
+
ModelMenu modelMenu = (ModelMenu) modelMenuMap.get(menuName);
if (modelMenu == null) {
throw new IllegalArgumentException("Could not find menu with name [" + menuName + "] in location [" + resourceName + "]");
}
return modelMenu;
}
-
+
}
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=757077&r1=757076&r2=757077&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 Mar 21 23:24:58 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "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
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuWrapTransform.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuWrapTransform.java?rev=757077&r1=757076&r2=757077&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuWrapTransform.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuWrapTransform.java Sat Mar 21 23:24:58 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); 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
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -47,7 +47,7 @@
//import com.clarkware.profiler.Profiler;
/**
* MenuWrapTransform - Freemarker Transform for URLs (links)
- *
+ *
* This is an interactive FreeMarker tranform that allows the user to modify the contents that are placed within it.
*/
public class MenuWrapTransform implements TemplateTransformModel {
@@ -55,7 +55,7 @@
public static final String module = MenuWrapTransform.class.getName();
public static final String [] upSaveKeyNames = {"globalNodeTrail"};
public static final String [] saveKeyNames = {"contentId", "subContentId", "subDataResourceTypeId", "mimeTypeId", "whenMap", "locale", "wrapTemplateId", "encloseWrapText", "nullThruDatesOnly", "renderOnStart", "renderOnClose", "menuDefFile", "menuName", "associatedContentId", "wrapperClassName"};
-
+
/**
* A wrapper for the FreeMarkerWorker version.
*/
@@ -168,7 +168,7 @@
}
public void renderMenu() throws IOException {
-
+
String menuDefFile = (String)templateCtx.get("menuDefFile");
String menuName = (String)templateCtx.get("menuName");
String menuWrapperClassName = (String)templateCtx.get("menuWrapperClassName");
@@ -183,7 +183,7 @@
String menuStr = menuWrapper.renderMenuString();
out.write(menuStr);
}
-
+
};
}
}
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=757077&r1=757076&r2=757077&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 Mar 21 23:24:58 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); 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
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -100,10 +100,10 @@
* with conditions is not possible.
*/
protected Map<String, ModelMenuItem> menuItemMap = new HashMap<String, ModelMenuItem>();
-
+
protected List<ModelMenuAction> actions;
-
+
// ===== CONSTRUCTORS =====
/** Default Constructor */
public ModelMenu() {}
@@ -222,7 +222,7 @@
//Debug.logInfo("in ModelMenu, hideIfSelected, val:" + val, module);
if (val != null && val.equalsIgnoreCase("true"))
defaultHideIfSelected = Boolean.TRUE;
- else
+ else
defaultHideIfSelected = Boolean.FALSE;
}
if (this.defaultDisabledTitleStyle == null || menuElement.hasAttribute("default-disabled-title-style"))
@@ -350,7 +350,7 @@
List <GenericValue> portalPages = null;
try {
// first get public pages
- EntityCondition cond =
+ EntityCondition cond =
EntityCondition.makeCondition(UtilMisc.toList(
EntityCondition.makeCondition("ownerUserLoginId", EntityOperator.EQUALS, "_NA_"),
EntityCondition.makeCondition(UtilMisc.toList(
@@ -371,7 +371,7 @@
portalPages.remove(portalPage);
portalPages.add(privatePortalPages.get(0));
}
- }
+ }
// add any other created private pages
cond = EntityCondition.makeCondition(UtilMisc.toList(
EntityCondition.makeCondition("ownerUserLoginId", EntityOperator.EQUALS, userLoginId),
@@ -385,8 +385,8 @@
}
for (GenericValue portalPage : portalPages) {
if (UtilValidate.isNotEmpty(portalPage.getString("portalPageName"))) {
- item.setName(portalPage.getString("portalPageId"));
- item.setTitle(portalPage.getString("portalPageName"));
+ item.setName(portalPage.getString("portalPageId"));
+ item.setTitle(portalPage.getString("portalPageName"));
item.link = new Link(item);
item.link.setTarget("showPortalPage?portalPageId=" + portalPage.getString("portalPageId") + "&parentPortalPageId=" + parentPortalPageId);
item.renderMenuItemString(writer, context, menuStringRenderer);
@@ -484,7 +484,7 @@
public String getBoundaryCommentName() {
return menuLocation + "#" + name;
}
-
+
public Interpreter getBshInterpreter(Map<String, Object> context) throws EvalError {
Interpreter bsh = (Interpreter) context.get("bshInterpreter");
if (bsh == null) {
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=757077&r1=757076&r2=757077&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 Mar 21 23:24:58 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); 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
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -63,19 +63,19 @@
this.modelMenu = modelMenu;
if (Debug.verboseOn()) Debug.logVerbose("Reading Screen action with name: " + actionElement.getNodeName(), module);
}
-
+
public ModelMenuAction(ModelMenuItem modelMenuItem, Element actionElement) {
this.modelMenuItem = modelMenuItem;
this.modelMenu = modelMenuItem.getModelMenu();
if (Debug.verboseOn()) Debug.logVerbose("Reading Screen action with name: " + actionElement.getNodeName(), module);
}
-
+
public abstract void runAction(Map<String, Object> context);
-
+
public static List<ModelMenuAction> readSubActions(ModelMenuItem modelMenuItem, Element parentElement) {
return readSubActions(modelMenuItem.getModelMenu(), parentElement);
}
-
+
public static List<ModelMenuAction> readSubActions(ModelMenu modelMenu, Element parentElement) {
List<? extends Element> actionElementList = UtilXml.childElementList(parentElement);
ArrayList<ModelMenuAction> actions = new ArrayList<ModelMenuAction>(actionElementList.size());
@@ -103,7 +103,7 @@
actions.trimToSize();
return actions;
}
-
+
public static void runSubActions(List<ModelMenuAction> actions, Map<String, Object> context) {
if (actions == null) return;
for (ModelMenuAction action : actions) {
@@ -111,7 +111,7 @@
action.runAction(context);
}
}
-
+
public static class SetField extends ModelMenuAction {
protected FlexibleMapAccessor<Object> field;
protected FlexibleMapAccessor<Object> fromField;
@@ -121,7 +121,7 @@
protected String type;
protected String toScope;
protected String fromScope;
-
+
public SetField(ModelMenu modelMenu, Element setElement) {
super (modelMenu, setElement);
this.field = FlexibleMapAccessor.getInstance(setElement.getAttribute("field"));
@@ -136,12 +136,12 @@
throw new IllegalArgumentException("Cannot specify a from-field [" + setElement.getAttribute("from-field") + "] and a value [" + setElement.getAttribute("value") + "] on the set action in a screen widget");
}
}
-
+
public void runAction(Map<String, Object> context) {
String globalStr = this.globalExdr.expandString(context);
// default to false
boolean global = "true".equals(globalStr);
-
+
Object newValue = null;
if (this.fromScope != null && this.fromScope.equals("user")) {
if (!this.fromField.isEmpty()) {
@@ -154,7 +154,7 @@
} else if (!this.valueExdr.isEmpty()) {
newValue = this.valueExdr.expandString(context);
}
-
+
} else if (this.fromScope != null && this.fromScope.equals("application")) {
if (!this.fromField.isEmpty()) {
String originalName = this.fromField.getOriginalName();
@@ -166,7 +166,7 @@
} else if (!this.valueExdr.isEmpty()) {
newValue = this.valueExdr.expandString(context);
}
-
+
} else {
if (!this.fromField.isEmpty()) {
newValue = this.fromField.get(context);
@@ -182,7 +182,7 @@
newValue = this.defaultExdr.expandString(context);
}
}
-
+
if (UtilValidate.isNotEmpty(this.type)) {
try {
newValue = ObjectType.simpleTypeConvert(newValue, this.type, null, (TimeZone) context.get("timeZone"), (Locale) context.get("locale"), true);
@@ -191,7 +191,7 @@
Debug.logError(e, errMsg, module);
throw new IllegalArgumentException(errMsg);
}
-
+
}
if (this.toScope != null && this.toScope.equals("user")) {
String originalName = this.field.getOriginalName();
@@ -200,7 +200,7 @@
HttpSession session = (HttpSession)context.get("session");
session.setAttribute(newKey, newValue);
if (Debug.verboseOn()) Debug.logVerbose("In user setting value for field from [" + this.field.getOriginalName() + "]: " + newValue, module);
-
+
} else if (this.toScope != null && this.toScope.equals("application")) {
String originalName = this.field.getOriginalName();
String currentWidgetTrail = (String)context.get("_WIDGETTRAIL_");
@@ -208,19 +208,19 @@
ServletContext servletContext = (ServletContext)context.get("application");
servletContext.setAttribute(newKey, newValue);
if (Debug.verboseOn()) Debug.logVerbose("In application setting value for field from [" + this.field.getOriginalName() + "]: " + newValue, module);
-
+
} else {
if (Debug.verboseOn()) Debug.logVerbose("In screen setting field [" + this.field.getOriginalName() + "] to value: " + newValue, module);
this.field.put(context, newValue);
}
-
+
if (global) {
Map<String, Object> globalCtx = UtilGenerics.checkMap(context.get("globalContext"));
if (globalCtx != null) {
this.field.put(globalCtx, newValue);
}
}
-
+
// this is a hack for backward compatibility with the JPublish page object
Map<String, Object> page = UtilGenerics.checkMap(context.get("page"));
if (page != null) {
@@ -228,19 +228,19 @@
}
}
}
-
+
public static class PropertyMap extends ModelMenuAction {
protected FlexibleStringExpander resourceExdr;
protected FlexibleMapAccessor<Map<String, Object>> mapNameAcsr;
protected FlexibleStringExpander globalExdr;
-
+
public PropertyMap(ModelMenu modelMenu, Element setElement) {
super (modelMenu, setElement);
this.resourceExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("resource"));
this.mapNameAcsr = FlexibleMapAccessor.getInstance(setElement.getAttribute("map-name"));
this.globalExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("global"));
}
-
+
public void runAction(Map<String, Object> context) {
String globalStr = this.globalExdr.expandString(context);
// default to false
@@ -259,9 +259,9 @@
}
}
}
-
+
public static class PropertyToField extends ModelMenuAction {
-
+
protected FlexibleStringExpander resourceExdr;
protected FlexibleStringExpander propertyExdr;
protected FlexibleMapAccessor<Object> fieldAcsr;
@@ -280,14 +280,14 @@
this.argListAcsr = FlexibleMapAccessor.getInstance(setElement.getAttribute("arg-list-name"));
this.globalExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("global"));
}
-
+
public void runAction(Map<String, Object> context) {
// default to false
Locale locale = (Locale) context.get("locale");
String resource = this.resourceExdr.expandString(context, locale);
String property = this.propertyExdr.expandString(context, locale);
-
+
String value = null;
if (noLocale) {
value = UtilProperties.getPropertyValue(resource, property);
@@ -297,8 +297,8 @@
if (value == null || value.length() == 0) {
value = this.defaultExdr.expandString(context);
}
-
- // note that expanding the value string here will handle defaultValue and the string from
+
+ // note that expanding the value string here will handle defaultValue and the string from
// the properties file; if we decide later that we don't want the string from the properties
// file to be expanded we should just expand the defaultValue at the beginning of this method.
value = FlexibleStringExpander.expandString(value, context);
@@ -313,15 +313,15 @@
fieldAcsr.put(context, value);
}
}
-
+
public static class Script extends ModelMenuAction {
protected String location;
-
+
public Script(ModelMenu modelMenu, Element scriptElement) {
super (modelMenu, scriptElement);
this.location = scriptElement.getAttribute("location");
}
-
+
public void runAction(Map<String, Object> context) {
if (location.endsWith(".bsh")) {
try {
@@ -350,34 +350,34 @@
protected FlexibleMapAccessor<Map<String, Object>> resultMapNameAcsr;
protected FlexibleStringExpander autoFieldMapExdr;
protected Map<FlexibleMapAccessor<Object>, FlexibleMapAccessor<Object>> fieldMap;
-
+
public Service(ModelMenu modelMenu, Element serviceElement) {
super (modelMenu, serviceElement);
this.serviceNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("service-name"));
this.resultMapNameAcsr = FlexibleMapAccessor.getInstance(serviceElement.getAttribute("result-map-name"));
this.autoFieldMapExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("auto-field-map"));
-
+
List<? extends Element> fieldMapElementList = UtilXml.childElementList(serviceElement, "field-map");
if (fieldMapElementList.size() > 0) {
this.fieldMap = FastMap.newInstance();
for (Element fieldMapElement: fieldMapElementList) {
// set the env-name for each field-name, noting that if no field-name is specified it defaults to the env-name
this.fieldMap.put(
- FlexibleMapAccessor.getInstance(UtilFormatOut.checkEmpty(fieldMapElement.getAttribute("field-name"), fieldMapElement.getAttribute("env-name"))),
+ FlexibleMapAccessor.getInstance(UtilFormatOut.checkEmpty(fieldMapElement.getAttribute("field-name"), fieldMapElement.getAttribute("env-name"))),
FlexibleMapAccessor.getInstance(fieldMapElement.getAttribute("env-name")));
}
}
}
-
+
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());
}
-
+
String autoFieldMapString = this.autoFieldMapExdr.expandString(context);
boolean autoFieldMapBool = !"false".equals(autoFieldMapString);
-
+
try {
Map<String, Object> serviceContext = null;
if (autoFieldMapBool) {
@@ -385,7 +385,7 @@
} else {
serviceContext = FastMap.newInstance();
}
-
+
if (this.fieldMap != null) {
for (Map.Entry<FlexibleMapAccessor<Object>, FlexibleMapAccessor<Object>> entry: this.fieldMap.entrySet()) {
FlexibleMapAccessor<Object> serviceContextFieldAcsr = entry.getKey();
@@ -393,9 +393,9 @@
serviceContextFieldAcsr.put(serviceContext, contextEnvAcsr.get(context));
}
}
-
+
Map<String, Object> result = this.modelMenu.getDispacher().runSync(serviceNameExpanded, serviceContext);
-
+
if (!this.resultMapNameAcsr.isEmpty()) {
this.resultMapNameAcsr.put(context, result);
} else {
@@ -411,12 +411,12 @@
public static class EntityOne extends ModelMenuAction {
protected PrimaryKeyFinder finder;
-
+
public EntityOne(ModelMenu modelMenu, Element entityOneElement) {
super (modelMenu, entityOneElement);
finder = new PrimaryKeyFinder(entityOneElement);
}
-
+
public void runAction(Map<String, Object> context) {
try {
finder.runFind(context, this.modelMenu.getDelegator());
@@ -430,12 +430,12 @@
public static class EntityAnd extends ModelMenuAction {
protected ByAndFinder finder;
-
+
public EntityAnd(ModelMenu modelMenu, Element entityAndElement) {
super (modelMenu, entityAndElement);
finder = new ByAndFinder(entityAndElement);
}
-
+
public void runAction(Map<String, Object> context) {
try {
finder.runFind(context, this.modelMenu.getDelegator());
@@ -449,12 +449,12 @@
public static class EntityCondition extends ModelMenuAction {
ByConditionFinder finder;
-
+
public EntityCondition(ModelMenu modelMenu, Element entityConditionElement) {
super (modelMenu, entityConditionElement);
finder = new ByConditionFinder(entityConditionElement);
}
-
+
public void runAction(Map<String, Object> context) {
try {
finder.runFind(context, this.modelMenu.getDelegator());
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=757077&r1=757076&r2=757077&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 Mar 21 23:24:58 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); 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
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -77,30 +77,30 @@
if (cond) {
String passStyle = passStyleExdr.expandString(context);
if (UtilValidate.isNotEmpty(passStyle)) {
- modelMenuItem.setWidgetStyle(passStyle);
+ modelMenuItem.setWidgetStyle(passStyle);
}
modelMenuItem.setDisabled(false);
} else {
String failStyle = failStyleExdr.expandString(context);
if (UtilValidate.isNotEmpty(failStyle)) {
- modelMenuItem.setDisabledTitleStyle(failStyle);
+ modelMenuItem.setDisabledTitleStyle(failStyle);
modelMenuItem.setDisabled(true);
cond = true;
}
}
return cond;
}
-
+
public static abstract class MenuCondition {
protected ModelMenuItem modelMenuItem;
public MenuCondition(ModelMenuItem modelMenuItem, Element conditionElement) {
this.modelMenuItem = modelMenuItem;
}
-
+
public abstract boolean eval(Map<String, Object> context);
}
-
+
public static List<MenuCondition> readSubConditions(ModelMenuItem modelMenuItem, Element conditionElement) {
List<MenuCondition> condList = FastList.newInstance();
List<? extends Element> subElementList = UtilXml.childElementList(conditionElement);
@@ -109,7 +109,7 @@
}
return condList;
}
-
+
public static MenuCondition readCondition(ModelMenuItem modelMenuItem, Element conditionElement) {
if (conditionElement == null) {
return null;
@@ -142,15 +142,15 @@
throw new IllegalArgumentException("Condition element not supported with name: " + conditionElement.getNodeName());
}
}
-
+
public static class And extends MenuCondition {
protected List<MenuCondition> subConditions;
-
+
public And(ModelMenuItem modelMenuItem, Element condElement) {
super (modelMenuItem, condElement);
this.subConditions = readSubConditions(modelMenuItem, condElement);
}
-
+
public boolean eval(Map<String, Object> context) {
// return false for the first one in the list that is false, basic and algo
for (MenuCondition subCondition: this.subConditions) {
@@ -161,15 +161,15 @@
return true;
}
}
-
+
public static class Xor extends MenuCondition {
protected List<MenuCondition> subConditions;
-
+
public Xor(ModelMenuItem modelMenuItem, Element condElement) {
super (modelMenuItem, condElement);
this.subConditions = readSubConditions(modelMenuItem, condElement);
}
-
+
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;
@@ -186,15 +186,15 @@
return foundOneTrue;
}
}
-
+
public static class Or extends MenuCondition {
protected List<MenuCondition> subConditions;
-
+
public Or(ModelMenuItem modelMenuItem, Element condElement) {
super (modelMenuItem, condElement);
this.subConditions = readSubConditions(modelMenuItem, condElement);
}
-
+
public boolean eval(Map<String, Object> context) {
// return true for the first one in the list that is true, basic or algo
for (MenuCondition subCondition: this.subConditions) {
@@ -205,16 +205,16 @@
return false;
}
}
-
+
public static class Not extends MenuCondition {
protected MenuCondition subCondition;
-
+
public Not(ModelMenuItem modelMenuItem, Element condElement) {
super (modelMenuItem, condElement);
Element firstChildElement = UtilXml.firstChildElement(condElement);
this.subCondition = readCondition(modelMenuItem, firstChildElement);
}
-
+
public boolean eval(Map<String, Object> context) {
return !this.subCondition.eval(context);
}
@@ -229,7 +229,7 @@
super(modelMenuItem, condElement);
this.serviceExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("service-name"));
this.actionExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("main-action"));
- this.resExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("resource-description"));
+ this.resExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("resource-description"));
}
public boolean eval(Map<String, Object> context) {
@@ -294,20 +294,20 @@
public static class IfHasPermission extends MenuCondition {
protected FlexibleStringExpander permissionExdr;
protected FlexibleStringExpander actionExdr;
-
+
public IfHasPermission(ModelMenuItem modelMenuItem, Element condElement) {
super (modelMenuItem, condElement);
this.permissionExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("permission"));
this.actionExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("action"));
}
-
+
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) {
String permission = permissionExdr.expandString(context);
String action = actionExdr.expandString(context);
-
+
Security security = (Security) context.get("security");
if (action != null && action.length() > 0) {
// run hasEntityPermission
@@ -329,7 +329,7 @@
protected FlexibleMapAccessor<Object> fieldAcsr;
protected FlexibleStringExpander methodExdr;
protected FlexibleStringExpander classExdr;
-
+
public IfValidateMethod(ModelMenuItem modelMenuItem, Element condElement) {
super (modelMenuItem, condElement);
this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field"));
@@ -337,11 +337,11 @@
this.methodExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("method"));
this.classExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("class"));
}
-
+
public boolean eval(Map<String, Object> context) {
String methodName = this.methodExdr.expandString(context);
String className = this.classExdr.expandString(context);
-
+
Object fieldVal = this.fieldAcsr.get(context);
String fieldString = null;
if (fieldVal != null) {
@@ -384,7 +384,7 @@
return resultBool.booleanValue();
}
}
-
+
public static class IfCompare extends MenuCondition {
protected FlexibleMapAccessor<Object> fieldAcsr;
protected FlexibleStringExpander valueExdr;
@@ -392,25 +392,25 @@
protected String operator;
protected String type;
protected FlexibleStringExpander formatExdr;
-
+
public IfCompare(ModelMenuItem modelMenuItem, Element condElement) {
super (modelMenuItem, condElement);
this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field"));
if (this.fieldAcsr.isEmpty()) this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name"));
this.valueExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("value"));
-
+
this.operator = condElement.getAttribute("operator");
this.type = condElement.getAttribute("type");
this.formatExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("format"));
}
-
+
public boolean eval(Map<String, Object> context) {
String value = this.valueExdr.expandString(context);
String format = this.formatExdr.expandString(context);
-
+
Object fieldVal = this.fieldAcsr.get(context);
-
+
// always use an empty string by default
if (fieldVal == null) {
fieldVal = "";
@@ -429,11 +429,11 @@
throw new IllegalArgumentException(fullString.toString());
}
-
+
return resultBool.booleanValue();
}
}
-
+
public static class IfCompareField extends MenuCondition {
protected FlexibleMapAccessor<Object> fieldAcsr;
protected FlexibleMapAccessor<Object> toFieldAcsr;
@@ -441,26 +441,26 @@
protected String operator;
protected String type;
protected FlexibleStringExpander formatExdr;
-
+
public IfCompareField(ModelMenuItem modelMenuItem, Element condElement) {
super (modelMenuItem, condElement);
this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field"));
if (this.fieldAcsr.isEmpty()) this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name"));
this.toFieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("to-field"));
if (this.toFieldAcsr.isEmpty()) this.toFieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("to-field-name"));
-
+
this.operator = condElement.getAttribute("operator");
this.type = condElement.getAttribute("type");
this.formatExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("format"));
}
-
+
public boolean eval(Map<String, Object> context) {
String format = this.formatExdr.expandString(context);
-
+
Object fieldVal = this.fieldAcsr.get(context);
Object toFieldVal = this.toFieldAcsr.get(context);
-
+
// always use an empty string by default
if (fieldVal == null) {
fieldVal = "";
@@ -479,25 +479,25 @@
throw new IllegalArgumentException(fullString.toString());
}
-
+
return resultBool.booleanValue();
}
}
-
+
public static class IfRegexp extends MenuCondition {
static PatternMatcher matcher = new Perl5Matcher();
static PatternCompiler compiler = new Perl5Compiler();
protected FlexibleMapAccessor<Object> fieldAcsr;
protected FlexibleStringExpander exprExdr;
-
+
public IfRegexp(ModelMenuItem modelMenuItem, Element condElement) {
super (modelMenuItem, condElement);
this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field"));
if (this.fieldAcsr.isEmpty()) this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name"));
this.exprExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("expr"));
}
-
+
public boolean eval(Map<String, Object> context) {
Object fieldVal = this.fieldAcsr.get(context);
String expr = this.exprExdr.expandString(context);
@@ -518,20 +518,20 @@
}
// always use an empty string by default
if (fieldString == null) fieldString = "";
-
+
return matcher.matches(fieldString, pattern);
}
}
-
+
public static class IfEmpty extends MenuCondition {
protected FlexibleMapAccessor<Object> fieldAcsr;
-
+
public IfEmpty(ModelMenuItem modelMenuItem, Element condElement) {
super (modelMenuItem, condElement);
this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field"));
if (this.fieldAcsr.isEmpty()) this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name"));
}
-
+
public boolean eval(Map<String, Object> context) {
Object fieldVal = this.fieldAcsr.get(context);
return ObjectType.isEmpty(fieldVal);
@@ -539,14 +539,14 @@
}
public static class IfEntityPermission extends MenuCondition {
protected EntityPermissionChecker permissionChecker;
-
+
public IfEntityPermission(ModelMenuItem modelMenuItem, Element condElement) {
super (modelMenuItem, condElement);
this.permissionChecker = new EntityPermissionChecker(condElement);
}
-
+
public boolean eval(Map<String, Object> context) {
-
+
boolean passed = permissionChecker.runPermissionCheck(context);
return passed;
}
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=757077&r1=757076&r2=757077&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 Mar 21 23:24:58 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); 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
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -68,13 +68,13 @@
protected String disableIfEmpty;
protected ModelMenu subMenu;
protected Link link;
-
+
protected List<ModelMenuItem> menuItemList = new LinkedList<ModelMenuItem>();
protected Map<String, ModelMenuItem> menuItemMap = new HashMap<String, ModelMenuItem>();
public static String DEFAULT_TARGET_TYPE = "intra-app";
-
+
protected EntityPermissionChecker permissionChecker;
protected ModelMenuItem parentMenuItem;
protected ModelMenuCondition condition;
@@ -82,7 +82,7 @@
protected List<ModelMenuAction> actions;
protected String align;
protected String alignStyle;
-
+
// ===== CONSTRUCTORS =====
/** Default Constructor */
public ModelMenuItem(ModelMenu modelMenu) {
@@ -94,12 +94,12 @@
parentMenuItem = modelMenuItem;
loadMenuItem(fieldElement, modelMenuItem.getModelMenu());
}
-
+
public ModelMenuItem(Element fieldElement, ModelMenu modelMenu) {
loadMenuItem(fieldElement, modelMenu);
}
-
+
public void loadMenuItem(Element fieldElement, ModelMenu modelMenu) {
this.modelMenu = modelMenu;
this.name = fieldElement.getAttribute("name");
@@ -159,7 +159,7 @@
if (linkElement != null) {
link = new Link(linkElement, this);
}
-
+
// Element permissionElement = UtilXml.firstChildElement(fieldElement, "if-entity-permission");
// if (permissionElement != null)
// permissionChecker = new EntityPermissionChecker(permissionElement);
@@ -183,7 +183,7 @@
}
}
-
+
public ModelMenuItem addUpdateMenuItem(ModelMenuItem modelMenuItem) {
// not a conditional item, see if a named item exists in Map
@@ -213,11 +213,11 @@
}
public void setDisabled(boolean val) {
- this.disabled = val;
+ this.disabled = val;
}
public boolean getDisabled() {
- return this.disabled;
+ return this.disabled;
}
public void mergeOverrideModelMenuItem(ModelMenuItem overrideMenuItem) {
@@ -247,7 +247,7 @@
}
public void renderMenuItemString(Appendable writer, Map<String, Object> context, MenuStringRenderer menuStringRenderer) throws IOException {
-
+
boolean passed = true;
if (this.condition != null) {
if (!this.condition.eval(context)) {
@@ -323,7 +323,7 @@
return this.modelMenu.getDefaultDisabledTitleStyle();
}
}
-
+
public void setDisabledTitleStyle(String style) {
this.disabledTitleStyle = style;
}
@@ -509,7 +509,7 @@
public Link getLink() {
return this.link;
}
-
+
public boolean isSelected(Map<String, Object> context) {
return this.name.equals(modelMenu.getSelectedMenuItemContextFieldName(context));
}
@@ -548,7 +548,7 @@
if (imageElement != null) {
this.image = new Image(imageElement);
}
-
+
this.linkType = linkElement.getAttribute("link-type");
List<? extends Element> parameterElementList = UtilXml.childElementList(linkElement, "parameter");
for (Element parameterElement: parameterElementList) {
@@ -583,7 +583,7 @@
if (simpleEncoder != null) {
txt = simpleEncoder.encode(txt);
}
-
+
return txt;
}
@@ -643,7 +643,7 @@
public String getLinkType() {
return this.linkType;
}
-
+
public List<WidgetWorker.Parameter> getParameterList() {
return this.parameterList;
}
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=757077&r1=757076&r2=757077&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 Mar 21 23:24:58 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); 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
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -65,7 +65,7 @@
/* NOTE: don't use this and the StringHtmlWrapperForFtl or things will be double-encoded
if (object instanceof GenericValue) {
return new GenericValueHtmlWrapperForFtl((GenericValue) object, this);
- }*/
+ }*/
// This StringHtmlWrapperForFtl option seems to be the best option
// and handles most things without causing too many problems
if (object instanceof String) {
@@ -83,11 +83,11 @@
return StringUtil.htmlEncoder.encode(super.getAsString());
}
}
-
+
// End Static, begin class section
-
+
protected List<ModelScreenWidget> subWidgets = new ArrayList<ModelScreenWidget>();
-
+
public HtmlWidget(ModelScreen modelScreen, Element htmlElement) {
super(modelScreen, htmlElement);
List<? extends Element> childElementList = UtilXml.childElementList(htmlElement);
@@ -116,20 +116,20 @@
buffer.append("</html-widget>");
return buffer.toString();
}
-
+
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);
-
+
if (UtilValidate.isEmpty(location)) {
throw new IllegalArgumentException("Template location is empty");
}
-
+
/*
- // =======================================================================
+ // =======================================================================
// Go through the context and find GenericValue objects and wrap them
-
+
// NOTE PROBLEM: there are still problems with this as it gets some things
// but does not get non-entity data including lots of strings
// directly in the context or things prepared or derived right in
@@ -137,19 +137,19 @@
// do something more aggressive to encode and wrap EVERYTHING in
// the context, but I've been thinking that even this is too much
// overhead and that would be crazy
-
+
// NOTE ALTERNATIVE1: considering instead to use the FTL features to wrap
- // everything in an <#escape x as x?html>...</#escape>, but that could
+ // everything in an <#escape x as x?html>...</#escape>, but that could
// cause problems with ${} expansions that have HTML in them, including:
- // included screens (using ${screens.render(...)}), content that should
+ // included screens (using ${screens.render(...)}), content that should
// have HTML in it (lots of general, product, category, etc content), etc
-
+
// NOTE ALTERNATIVE2: kind of like the "#escape X as x?html" option,
// implement an FTL *Model class and load it through a ObjectWrapper
// FINAL NOTE: after testing all of these alternatives, this one seems
- // to behave the best, so going with that for now.
-
- // isolate the scope so these wrapper objects go away after rendering is done
+ // to behave the best, so going with that for now.
+
+ // isolate the scope so these wrapper objects go away after rendering is done
MapStack<String> contextMs;
if (!(context instanceof MapStack)) {
contextMs = MapStack.create(context);
@@ -174,15 +174,15 @@
}
}
// TODO and NOTE: should get most stuff, but we could support Maps
- // and Lists in Maps and such; that's tricky because we have to go
- // through the entire Map and not just one entry, and we would
+ // and Lists in Maps and such; that's tricky because we have to go
+ // through the entire Map and not just one entry, and we would
// have to shallow copy the whole Map too
-
+
}
// this line goes at the end of the method, but moved up here to be part of the big comment about this
contextMs.pop();
*/
-
+
if (location.endsWith(".ftl")) {
try {
Map<String, ? extends Object> parameters = UtilGenerics.checkMap(context.get("parameters"));
@@ -190,7 +190,7 @@
if (insertWidgetBoundaryComments) {
writer.append(HtmlWidgetRenderer.formatBoundaryComment("Begin", "Template", location));
}
-
+
//FreeMarkerWorker.renderTemplateAtLocation(location, context, writer);
Template template = null;
if (location.endsWith(".fo.ftl")) { // FOP can't render correctly escaped characters
@@ -199,7 +199,7 @@
template = FreeMarkerWorker.getTemplate(location, specialTemplateCache, specialConfig);
}
FreeMarkerWorker.renderTemplate(template, context, writer);
-
+
if (insertWidgetBoundaryComments) {
writer.append(HtmlWidgetRenderer.formatBoundaryComment("End", "Template", location));
}
@@ -235,7 +235,7 @@
public static class HtmlTemplate extends ModelScreenWidget {
protected FlexibleStringExpander locationExdr;
-
+
public HtmlTemplate(ModelScreen modelScreen, Element htmlTemplateElement) {
super(modelScreen, htmlTemplateElement);
this.locationExdr = FlexibleStringExpander.getInstance(htmlTemplateElement.getAttribute("location"));
@@ -253,11 +253,11 @@
public static class HtmlTemplateDecorator extends ModelScreenWidget {
protected FlexibleStringExpander locationExdr;
protected Map<String, HtmlTemplateDecoratorSection> sectionMap = FastMap.newInstance();
-
+
public HtmlTemplateDecorator(ModelScreen modelScreen, Element htmlTemplateDecoratorElement) {
super(modelScreen, htmlTemplateDecoratorElement);
this.locationExdr = FlexibleStringExpander.getInstance(htmlTemplateDecoratorElement.getAttribute("location"));
-
+
List<? extends Element> htmlTemplateDecoratorSectionElementList = UtilXml.childElementList(htmlTemplateDecoratorElement, "html-template-decorator-section");
for (Element htmlTemplateDecoratorSectionElement: htmlTemplateDecoratorSectionElementList) {
String name = htmlTemplateDecoratorSectionElement.getAttribute("name");
@@ -279,7 +279,7 @@
MapStack<String> standAloneStack = contextMs.standAloneChildStack();
standAloneStack.put("screens", new ScreenRenderer(writer, standAloneStack, screenStringRenderer));
SectionsRenderer sections = new SectionsRenderer(this.sectionMap, standAloneStack, writer, screenStringRenderer);
-
+
// put the sectionMap in the context, make sure it is in the sub-scope, ie after calling push on the MapStack
contextMs.push();
context.put("sections", sections);
@@ -296,7 +296,7 @@
public static class HtmlTemplateDecoratorSection extends ModelScreenWidget {
protected String name;
protected List<ModelScreenWidget> subWidgets;
-
+
public HtmlTemplateDecoratorSection(ModelScreen modelScreen, Element htmlTemplateDecoratorSectionElement) {
super(modelScreen, htmlTemplateDecoratorSectionElement);
this.name = htmlTemplateDecoratorSectionElement.getAttribute("name");
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=757077&r1=757076&r2=757077&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 Mar 21 23:24:58 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); 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
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -53,7 +53,7 @@
@SuppressWarnings("serial")
public class IterateSectionWidget extends ModelScreenWidget {
public static final String module = IterateSectionWidget.class.getName();
-
+
protected ModelScreenWidget childWidget;
protected List<ModelScreenWidget.Section> sectionList;
protected FlexibleMapAccessor<Object> listNameExdr;
@@ -61,7 +61,7 @@
protected FlexibleStringExpander keyNameExdr;
protected FlexibleStringExpander paginateTarget;
protected boolean paginate = true;
-
+
public static int DEFAULT_PAGE_SIZE = 5;
protected int viewIndex = 0;
protected int viewSize = DEFAULT_PAGE_SIZE;
@@ -69,7 +69,7 @@
protected int highIndex = -1;
protected int listSize = 0;
protected int actualPageSize = 0;
-
+
public IterateSectionWidget(ModelScreen modelScreen, Element iterateSectionElement) {
super(modelScreen, iterateSectionElement);
@@ -79,11 +79,11 @@
if (entryNameExdr.isEmpty()) entryNameExdr = FlexibleStringExpander.getInstance(iterateSectionElement.getAttribute("entry-name"));
keyNameExdr = FlexibleStringExpander.getInstance(iterateSectionElement.getAttribute("key"));
if (keyNameExdr.isEmpty()) keyNameExdr = FlexibleStringExpander.getInstance(iterateSectionElement.getAttribute("key-name"));
-
+
if (this.paginateTarget == null || iterateSectionElement.hasAttribute("paginate-target")) {
this.paginateTarget = FlexibleStringExpander.getInstance(iterateSectionElement.getAttribute("paginate-target"));
}
-
+
paginate = "true".equals(iterateSectionElement.getAttribute("paginate"));
if (iterateSectionElement.hasAttribute("view-size")) {
setViewSize(iterateSectionElement.getAttribute("view-size"));
@@ -97,7 +97,7 @@
}
public void renderWidgetString(Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException {
-
+
boolean isEntrySet = false;
// create a standAloneStack, basically a "save point" for this SectionsRenderer, and make a new "screens" object just for it so it is isolated and doesn't follow the stack down
MapStack<String> contextMs = MapStack.create(context);
@@ -111,7 +111,7 @@
}
List theList = null;
if (obj instanceof Map ) {
- Set entrySet = ((Map)obj).entrySet();
+ Set entrySet = ((Map)obj).entrySet();
Object [] a = entrySet.toArray();
theList = Arrays.asList(a);
isEntrySet = true;
@@ -137,13 +137,13 @@
continue;
}
if (isEntrySet) {
- contextMs.put(entryName, ((Map)item).get("value"));
- contextMs.put(keyName, ((Map)item).get("key"));
+ contextMs.put(entryName, ((Map)item).get("value"));
+ contextMs.put(keyName, ((Map)item).get("key"));
} else {
contextMs.put(entryName, item);
}
contextMs.put("itemIndex", Integer.valueOf(itemIndex));
-
+
rowCount++;
for (ModelScreenWidget.Section section: this.sectionList) {
section.renderWidgetString(writer, contextMs, screenStringRenderer);
@@ -157,19 +157,19 @@
if (paginate) {
try {
Integer lastPageNumber = null;
- Map<String, Object> globalCtx = UtilGenerics.checkMap(context.get("globalContext"));
+ Map<String, Object> globalCtx = UtilGenerics.checkMap(context.get("globalContext"));
if (globalCtx != null) {
lastPageNumber = (Integer)globalCtx.get("PAGINATOR_NUMBER");
globalCtx.put("PAGINATOR_NUMBER", Integer.valueOf(startPageNumber));
- }
-
- renderNextPrev(writer, context);
+ }
+
+ renderNextPrev(writer, context);
if (globalCtx != null) {
globalCtx.put("PAGINATOR_NUMBER", lastPageNumber);
}
} catch (IOException e) {
- Debug.logError(e, module);
+ Debug.logError(e, module);
throw new RuntimeException(e.getMessage());
}
}
@@ -181,15 +181,15 @@
public String getPaginateTarget(Map<String, Object> context) {
return this.paginateTarget.expandString(context);
}
-
+
public boolean getPaginate() {
return this.paginate;
}
-
+
public void setPaginate(boolean val) {
paginate = val;
}
-
+
public void setViewIndex(int val) {
viewIndex = val;
}
@@ -202,7 +202,7 @@
try {
viewSize = Integer.parseInt(val);
} catch (NumberFormatException e) {
- viewSize = DEFAULT_PAGE_SIZE;
+ viewSize = DEFAULT_PAGE_SIZE;
}
}
@@ -240,14 +240,14 @@
public int getHighIndex() {
return highIndex;
}
-
+
public int getActualPageSize() {
return actualPageSize;
}
-
+
public void getListLimits(Map<String, Object> context, List<?> items) {
listSize = items.size();
-
+
if (paginate) {
try {
Map params = (Map)context.get("parameters");
@@ -273,14 +273,14 @@
highIndex = DEFAULT_PAGE_SIZE;
}
}
-
+
public void renderNextPrev(Appendable writer, Map<String, Object> context) throws IOException {
String targetService = this.getPaginateTarget(context);
if (targetService == null) {
targetService = "${targetService}";
}
-
+
Map<String, Object> inputFields = UtilGenerics.checkMap(context.get("requestParameters"));
Map<String, Object> queryStringMap = UtilGenerics.toMap(context.get("queryStringMap"));
if (UtilValidate.isNotEmpty(queryStringMap)) {
@@ -290,13 +290,13 @@
String queryString = UtilHttp.urlEncodeArgs(inputFields);
int paginatorNumber = this.getPaginatorNumber(context);
queryString = UtilHttp.stripViewParamsFromQueryString(queryString, "" + paginatorNumber);
-
-
-
-
+
+
+
+
if (UtilValidate.isEmpty(targetService)) {
- Debug.logWarning("TargetService is empty.", module);
- return;
+ Debug.logWarning("TargetService is empty.", module);
+ return;
}
int viewIndex = -1;
@@ -334,8 +334,8 @@
} catch (Exception e) {
lowIndex = 0;
}
-*/
-
+*/
+
int lowIndex = viewIndex * viewSize;
int highIndex = (viewIndex + 1) * viewSize;
int actualPageSize = this.getActualPageSize();
@@ -366,13 +366,13 @@
linkText.append("VIEW_SIZE_"+ paginatorNumber + "=").append(viewSize).append("&VIEW_INDEX_" + paginatorNumber + "=").append(viewIndex - 1).append("\"");
// make the link
- writer.append(rh.makeLink(request, response, linkText.toString(), false, false, false));
+ writer.append(rh.makeLink(request, response, linkText.toString(), false, false, false));
String previous = UtilProperties.getMessage("CommonUiLabels", "CommonPrevious", (Locale) context.get("locale"));
writer.append(" class=\"buttontext\">[").append(previous).append("]</a>\n");
}
if (listSize > 0) {
- Map<String, Integer> messageMap = UtilMisc.toMap("lowCount", Integer.valueOf(lowIndex + 1), "highCount", Integer.valueOf(lowIndex + actualPageSize), "total", Integer.valueOf(listSize));
+ Map<String, Integer> messageMap = UtilMisc.toMap("lowCount", Integer.valueOf(lowIndex + 1), "highCount", Integer.valueOf(lowIndex + actualPageSize), "total", Integer.valueOf(listSize));
String commonDisplaying = UtilProperties.getMessage("CommonUiLabels", "CommonDisplaying", messageMap, (Locale) context.get("locale"));
writer.append(" <span class=\"tabletext\">").append(commonDisplaying).append("</span> \n");
}
@@ -383,7 +383,7 @@
else linkText.append("&");
if (UtilValidate.isNotEmpty(queryString)) {
linkText.append(queryString).append("&");
- }
+ }
linkText.append("VIEW_SIZE_" + paginatorNumber + "=").append(viewSize).append("&VIEW_INDEX_" + paginatorNumber + "=").append(viewIndex + 1).append("\"");
// make the link
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroFormRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroFormRenderer.java?rev=757077&r1=757076&r2=757077&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroFormRenderer.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroFormRenderer.java Sat Mar 21 23:24:58 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); 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
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -75,7 +75,7 @@
public static final String module = MacroFormRenderer.class.getName();
private Template macroLibrary;
private Environment environment;
-
+
public MacroFormRenderer(String macroLibraryPath, Appendable writer) throws TemplateException, IOException {
macroLibrary = FreeMarkerWorker.getTemplate(macroLibraryPath);
Map<String, Object> input = UtilMisc.toMap("key", null);
@@ -324,11 +324,11 @@
public void renderFieldGroupClose(Appendable writer, Map<String, Object> context, ModelForm.FieldGroup fieldGroup) {
// TODO
}
-
+
public void renderBanner(Appendable writer, Map<String, Object> context, ModelForm.Banner banner) {
// TODO
}
-
+
public void renderHyperlinkTitle(Appendable writer, Map<String, Object> context, ModelFormField modelFormField, String titleText) {
}
}
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java?rev=757077&r1=757076&r2=757077&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java Sat Mar 21 23:24:58 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); 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
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -61,7 +61,7 @@
private Template macroLibrary;
private Environment environment;
private int elementId = 999;
-
+
public MacroScreenRenderer(String macroLibraryPath, Appendable writer) throws TemplateException, IOException {
macroLibrary = FreeMarkerWorker.getTemplate(macroLibraryPath);
Map<String, Object> input = UtilMisc.toMap("key", null);
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java?rev=757077&r1=757076&r2=757077&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java Sat Mar 21 23:24:58 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); 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
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -49,7 +49,7 @@
import freemarker.template.utility.StandardCompress;
public class MacroScreenViewHandler extends AbstractViewHandler {
-
+
public static final String module = MacroScreenViewHandler.class.getName();
protected ServletContext servletContext = null;
@@ -79,14 +79,14 @@
}
boolean compressOutput = "compressed".equals(encoding);
if (!compressOutput && this.servletContext != null) {
- compressOutput = "true".equals((String) this.servletContext.getAttribute("compressHTML"));
+ compressOutput = "true".equals((String) this.servletContext.getAttribute("compressHTML"));
}
if (compressOutput) {
// StandardCompress defaults to a 2k buffer. That could be increased
// to speed up output.
writer = new StandardCompress().getWriter(writer, null);
}
-
+
ScreenStringRenderer screenStringRenderer = new MacroScreenRenderer(UtilProperties.getPropertyValue("widget", getName() + ".screenrenderer"), writer);
FormStringRenderer formStringRenderer = new MacroFormRenderer(UtilProperties.getPropertyValue("widget", getName() + ".formrenderer"), writer);
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=757077&r1=757076&r2=757077&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 Mar 21 23:24:58 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); 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
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -52,7 +52,7 @@
protected FlexibleStringExpander transactionTimeoutExdr;
protected Map<String, ModelScreen> modelScreenMap;
protected boolean useCache;
-
+
protected ModelScreenWidget.Section section;
// ===== CONSTRUCTORS =====
@@ -75,7 +75,7 @@
this.section = new ModelScreenWidget.Section(this, sectionElement);
this.section.isMainSection = true;
}
-
+
public String getSourceLocation() {
return sourceLocation;
}
@@ -263,7 +263,7 @@
}
}
}
-
+
public Set<String> getAllRequestsLocationAndUri() throws GeneralException {
Set<String> allRequestNamesIncluded = FastSet.newInstance();
findRequestNamesLinkedtoInWidget(this.section, allRequestNamesIncluded);
@@ -275,7 +275,7 @@
String target = link.getTarget(null);
String urlMode = link.getUrlMode();
// Debug.logInfo("In findRequestNamesLinkedtoInWidget found link [" + link.rawString() + "] with target [" + target + "]", module);
-
+
Set<String> controllerLocAndRequestSet = ConfigXMLReader.findControllerRequestUniqueForTargetType(target, urlMode);
if (controllerLocAndRequestSet == null) return;
allRequestNamesIncluded.addAll(controllerLocAndRequestSet);
@@ -322,7 +322,7 @@
}
}
}
-
+
/**
* Renders this screen to a String, i.e. in a text format, as defined with the
@@ -335,10 +335,10 @@
* - userLogin (if a user is logged in)
* - autoUserLogin (if a user is automatically logged in, ie no password has been entered)
* - formStringRenderer
- * - request, response, session, application (special case, only in HTML contexts, etc)
+ * - request, response, session, application (special case, only in HTML contexts, etc)
* - delegator, dispatcher, security
* - null (represents a null field value for entity operations)
- * - sections (used for decorators to reference the sections to be decorated and render them)
+ * - sections (used for decorators to reference the sections to be decorated and render them)
* @param screenStringRenderer An implementation of the ScreenStringRenderer
* interface that is responsible for the actual text generation for
* different screen elements; implementing your own makes it possible to
@@ -365,7 +365,7 @@
}
}
}
-
+
if (transactionTimeout < 0 && !transactionTimeoutExdr.isEmpty()) {
// no TRANSACTION_TIMEOUT parameter, check screen attribute
String transactionTimeoutStr = transactionTimeoutExdr.expandString(context);
@@ -377,7 +377,7 @@
}
}
}
-
+
try {
// If transaction timeout is not present (i.e. is equal to -1), the default transaction timeout is used
// If transaction timeout is present, use it to start the transaction
@@ -413,9 +413,9 @@
} catch (GenericEntityException e2) {
Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), module);
}
-
+
// throw nested exception, don't need to log details here: Debug.logError(e, errMsg, module);
-
+
// after rolling back, rethrow the exception
throw new ScreenRenderException(errMsg, e);
} finally {