You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2010/05/19 22:49:06 UTC

svn commit: r946384 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidget.java

Author: adrianc
Date: Wed May 19 20:49:06 2010
New Revision: 946384

URL: http://svn.apache.org/viewvc?rev=946384&view=rev
Log:
Small change to ModelWidget.widgetBoundaryCommentsEnabled method - added ability to pass the rendering context in addition to the request parameters, plus I fixed the logic so it works the way it was originally intended.

To summarize:

1. The widget.verbose property in widget.properties is the global default setting.
2. The setting can be changed at the application level by putting the widgetVerbose parameter in the web.xml file.
3. The setting can be changed at the widget level by putting the widgetVerbose variable in the rendering context.

Modified:
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidget.java

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidget.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidget.java?rev=946384&r1=946383&r2=946384&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidget.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidget.java Wed May 19 20:49:06 2010
@@ -99,20 +99,30 @@ public class ModelWidget implements Seri
      */
     @Deprecated
     public void setWidgetBoundaryComments(Map<String, ? extends Object> context) {
-        Map<String, ? extends Object> parameters = UtilGenerics.checkMap(context.get("parameters"));
-        enableWidgetBoundaryComments = widgetBoundaryCommentsEnabled(parameters);
+        enableWidgetBoundaryComments = widgetBoundaryCommentsEnabled(context);
     }
 
     /**
      * Returns true if widget boundary comments are enabled. Widget boundary comments are
-     * enabled by setting widgetVerbose true in the parameters Map, or by setting
+     * enabled by setting widgetVerbose true in the context Map, or by setting
      * widget.verbose=true in widget.properties.
-     * @param parameters Optional parameters Map
+     * @param context Optional context Map
      */
-    public static boolean widgetBoundaryCommentsEnabled(Map<String, ? extends Object> parameters) {
+    public static boolean widgetBoundaryCommentsEnabled(Map<String, ? extends Object> context) {
         boolean result = "true".equals(UtilProperties.getPropertyValue("widget", "widget.verbose"));
-        if (!result && parameters != null) {
-            result = "true".equals(parameters.get(enableBoundaryCommentsParam));
+        if (context != null) {
+            String str = (String) context.get(enableBoundaryCommentsParam);
+            if (str != null) {
+                result = "true".equals(str);
+            } else{
+                Map<String, ? extends Object> parameters = UtilGenerics.checkMap(context.get("parameters"));
+                if (parameters != null) {
+                    str = (String) parameters.get(enableBoundaryCommentsParam);
+                    if (str != null) {
+                        result = "true".equals(str);
+                    }
+                }
+            }
         }
         return result;
     }