Author: doogie
Date: Mon May 21 14:40:13 2012
New Revision: 1341055
URL:
http://svn.apache.org/viewvc?rev=1341055&view=revLog:
OPTIMIZE: Add a static method that configures a BeansWrapper instance
for ofbiz use.
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java
Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java?rev=1341055&r1=1341054&r2=1341055&view=diff==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java Mon May 21 14:40:13 2012
@@ -76,13 +76,17 @@ public class FreeMarkerWorker {
// use soft references for this so that things from Content records don't kill all of our memory, or maybe not for performance reasons... hmmm, leave to config file...
public static UtilCache<String, Template> cachedTemplates = UtilCache.createUtilCache("template.ftl.general", 0, 0, false);
- private static final BeansWrapper defaultOfbizWrapper = new BeansWrapper();
+ private static final BeansWrapper defaultOfbizWrapper = configureBeansWrapper(new BeansWrapper());
private static final Configuration defaultOfbizConfig = makeConfiguration(defaultOfbizWrapper);
public static BeansWrapper getDefaultOfbizWrapper() {
return defaultOfbizWrapper;
}
+ public static <T extends BeansWrapper> T configureBeansWrapper(T wrapper) {
+ return wrapper;
+ }
+
public static Configuration makeConfiguration(BeansWrapper wrapper) {
Configuration newConfig = new Configuration();
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=1341055&r1=1341054&r2=1341055&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 Mon May 21 14:40:13 2012
@@ -58,7 +58,7 @@ public class HtmlWidget extends ModelScr
public static final String module = HtmlWidget.class.getName();
public static UtilCache<String, Template> specialTemplateCache = UtilCache.createUtilCache("widget.screen.template.ftl.general", 0, 0, false);
- protected static Configuration specialConfig = FreeMarkerWorker.makeConfiguration((BeansWrapper)new ExtendedWrapper());
+ protected static Configuration specialConfig = FreeMarkerWorker.makeConfiguration(FreeMarkerWorker.configureBeansWrapper(new ExtendedWrapper()));
// not sure if this is the best way to get FTL to use my fancy MapModel derivative, but should work at least...
public static class ExtendedWrapper extends BeansWrapper {