Author: adrianc
Date: Tue Sep 20 02:55:44 2011
New Revision: 1172954
URL: http://svn.apache.org/viewvc?rev=1172954&view=rev
Log:
Changed the screen widget boundary comment behavior per a discussion on the dev
mailing list. Setting the widget.properties file widget.verbose property to
false now acts like a "master switch" to turn off all widget boundary comments
- it ignores all other settings. If the property is set to true, then the
setting can be overridden in web.xml or in the screen context.
This commit also removes the demonstration widgetVerbose setting in the Example
component's web.xml file - which caused some confusion, and it comments out the
setting in the web.xml file that is used for creating new components.
Modified:
ofbiz/trunk/framework/example/webapp/example/WEB-INF/web.xml
ofbiz/trunk/framework/resources/templates/web.xml
ofbiz/trunk/framework/widget/config/widget.properties
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidget.java
Modified: ofbiz/trunk/framework/example/webapp/example/WEB-INF/web.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/webapp/example/WEB-INF/web.xml?rev=1172954&r1=1172953&r2=1172954&view=diff
==============================================================================
--- ofbiz/trunk/framework/example/webapp/example/WEB-INF/web.xml (original)
+++ ofbiz/trunk/framework/example/webapp/example/WEB-INF/web.xml Tue Sep 20
02:55:44 2011
@@ -41,11 +41,6 @@ under the License.
<param-value>component://example/widget/example/CommonScreens.xml</param-value>
<description>The location of the main-decorator screen to use for this
webapp; referred to as a context variable in screen def XML files.</description>
</context-param>
- <!-- context-param>
- <param-name>widgetVerbose</param-name>
- <param-value>false</param-value>
- <description>Enable/disable widget boundary comments. will override
widget.properties See
org.ofbiz.widget.ModelWidget.widgetBoundaryCommentsEnabled().</description>
- </context-param-->
<context-param>
<param-name>compressHTML</param-name>
<param-value>false</param-value>
Modified: ofbiz/trunk/framework/resources/templates/web.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/resources/templates/web.xml?rev=1172954&r1=1172953&r2=1172954&view=diff
==============================================================================
--- ofbiz/trunk/framework/resources/templates/web.xml (original)
+++ ofbiz/trunk/framework/resources/templates/web.xml Tue Sep 20 02:55:44 2011
@@ -21,11 +21,13 @@
<param-value>component://@component-name@/widget/CommonScreens.xml</param-value>
<description>The location of the main-decorator screen to use for this
webapp; referred to as a context variable in screen def XML files.</description>
</context-param>
+ <!--
<context-param>
<param-name>widgetVerbose</param-name>
<param-value>false</param-value>
<description>Enable widget boundary comments. See
org.ofbiz.widget.ModelWidget.widgetBoundaryCommentsEnabled().</description>
</context-param>
+ -->
<context-param>
<param-name>compressHTML</param-name>
<param-value>false</param-value>
Modified: ofbiz/trunk/framework/widget/config/widget.properties
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/config/widget.properties?rev=1172954&r1=1172953&r2=1172954&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/config/widget.properties (original)
+++ ofbiz/trunk/framework/widget/config/widget.properties Tue Sep 20 02:55:44
2011
@@ -20,8 +20,11 @@
# Enable HTML whitespace compression; deprecated: use output specific
"compress" setting instead; see for example screen.compress
#compress.HTML=true
-# Enable screen widget boundary comments
-# 'false' can be overwritten by a 'widgetVerbose' parameter in the web.xml
file see web.xml in the example component how to do this
+# Enable screen widget boundary comments.
+# A setting of true will enable widget boundary comments. The true setting can
be
+# overridden in an application's web.xml file or in the screen rendering
context.
+# A setting of false will override all other settings and disable all widget
+# boundary comments.
widget.verbose=true
# Default number of items to be displayed per page in a list form
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=1172954&r1=1172953&r2=1172954&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidget.java
(original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidget.java Tue Sep
20 02:55:44 2011
@@ -34,20 +34,7 @@ public class ModelWidget implements Seri
/**
* The parameter name used to control widget boundary comments. Currently
- * set to "widgetVerbose". Set the parameter to "true" to enable widget
- * boundary comments.<br/><br/>
- * <code>WEB-INF/web.xml</code> example:<br/><br/>
- * <code>
- * <context-param><br/>
- * <param-name>widgetVerbose</param-name><br/>
- * <param-value>true</param-value><br/>
- * </context-param>
- * </code><br/><br/>
- * Screen widget example:<br/><br/>
- * <code>
- * <actions><br/>
- * <set field="parameters.widgetVerbose" value="true"
global="true"/><br/>
- * </actions>
+ * set to "widgetVerbose".
* </code>
*/
public static final String enableBoundaryCommentsParam = "widgetVerbose";
@@ -139,14 +126,18 @@ public class ModelWidget implements Seri
}
/**
- * Returns true if widget boundary comments are enabled. Widget boundary
comments are
- * enabled by setting widgetVerbose true in the context Map, or by setting
- * widget.verbose=true in widget.properties.
+ * Returns <code>true</code> if widget boundary comments are enabled.
Widget boundary comments are
+ * enabled by setting <code>widget.verbose=true</code> in the
<code>widget.properties</code> file.
+ * The <code>true</code> setting can be overridden in <code>web.xml</code>
or in the screen
+ * rendering context. If <code>widget.verbose</code> is set to
<code>false</code> in the
+ * <code>widget.properties</code> file, then that setting will override
all other settings and
+ * disable all widget boundary comments.
+ *
* @param context Optional context Map
*/
public static boolean widgetBoundaryCommentsEnabled(Map<String, ? extends
Object> context) {
boolean result =
"true".equals(UtilProperties.getPropertyValue("widget", "widget.verbose"));
- if (result == false && context != null) {
+ if (result && context != null) {
String str = (String) context.get(enableBoundaryCommentsParam);
if (str != null) {
result = "true".equals(str);