You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2014/11/03 07:54:24 UTC

svn commit: r1636282 [15/20] - in /ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23: ./ applications/content/config/ applications/content/data/ applications/humanres/src/org/ofbiz/humanres/ applications/humanres/webapp/humanres/WEB-INF/ applica...

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java Mon Nov  3 06:54:16 2014
@@ -23,6 +23,7 @@ import java.math.BigDecimal;
 import java.sql.Timestamp;
 import java.text.DateFormat;
 import java.text.NumberFormat;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.LinkedList;
@@ -32,9 +33,6 @@ import java.util.Map;
 import java.util.StringTokenizer;
 import java.util.TimeZone;
 
-import javolution.util.FastList;
-import javolution.util.FastMap;
-
 import org.ofbiz.base.conversion.ConversionException;
 import org.ofbiz.base.conversion.DateTimeConverters;
 import org.ofbiz.base.conversion.DateTimeConverters.StringToTimestamp;
@@ -67,6 +65,7 @@ import org.ofbiz.service.DispatchContext
 import org.ofbiz.service.GenericServiceException;
 import org.ofbiz.service.ModelParam;
 import org.ofbiz.service.ModelService;
+import org.ofbiz.widget.ModelFieldVisitor;
 import org.ofbiz.widget.WidgetWorker;
 import org.ofbiz.widget.form.ModelForm.UpdateArea;
 import org.w3c.dom.Element;
@@ -130,7 +129,7 @@ public class ModelFormField {
     }
 
     /** XML Constructor */
-    public ModelFormField(Element fieldElement, ModelForm modelForm) {
+    public ModelFormField(Element fieldElement, ModelForm modelForm, ModelReader entityModelReader, DispatchContext dispatchContext) {
         this.modelForm = modelForm;
         this.name = fieldElement.getAttribute("name");
         this.setMapName(fieldElement.getAttribute("map-name"));
@@ -183,7 +182,7 @@ public class ModelFormField {
 
             if (UtilValidate.isEmpty(subElementName)) {
                 this.fieldInfo = null;
-                this.induceFieldInfo(null); //no defaultFieldType specified here, will default to edit
+                this.induceFieldInfo(null, entityModelReader, dispatchContext); //no defaultFieldType specified here, will default to edit
             } else if ("display".equals(subElementName)) this.fieldInfo = new DisplayField(subElement, this);
             else if ("display-entity".equals(subElementName)) this.fieldInfo = new DisplayEntityField(subElement, this);
             else if ("hyperlink".equals(subElementName)) this.fieldInfo = new HyperlinkField(subElement, this);
@@ -210,21 +209,21 @@ public class ModelFormField {
         }
     }
 
-    public void addOnEventUpdateArea(UpdateArea updateArea) {
+    private void addOnEventUpdateArea(UpdateArea updateArea) {
         // Event types are sorted as a convenience for the rendering classes
         Debug.logInfo(this.modelForm.getName() + ":" + this.name + " adding UpdateArea type " + updateArea.getEventType(), module);
         if ("change".equals(updateArea.getEventType()))  addOnChangeUpdateArea(updateArea);
         else if ("click".equals(updateArea.getEventType())) addOnClickUpdateArea(updateArea);
     }
 
-    protected void addOnChangeUpdateArea(UpdateArea updateArea) {
-        if (onChangeUpdateAreas == null) onChangeUpdateAreas = FastList.newInstance();
+    private void addOnChangeUpdateArea(UpdateArea updateArea) {
+        if (onChangeUpdateAreas == null) onChangeUpdateAreas = new ArrayList<UpdateArea>();
         onChangeUpdateAreas.add(updateArea);
         Debug.logInfo(this.modelForm.getName() + ":" + this.name + " onChangeUpdateAreas size = " + onChangeUpdateAreas.size(), module);
     }
 
-    protected void addOnClickUpdateArea(UpdateArea updateArea) {
-        if (onClickUpdateAreas == null) onClickUpdateAreas = FastList.newInstance();
+    private void addOnClickUpdateArea(UpdateArea updateArea) {
+        if (onClickUpdateAreas == null) onClickUpdateAreas = new ArrayList<UpdateArea>();
         onClickUpdateAreas.add(updateArea);
     }
 
@@ -262,16 +261,14 @@ public class ModelFormField {
         this.encodeOutput = overrideFormField.encodeOutput;
     }
 
-    public boolean induceFieldInfo(String defaultFieldType) {
-        if (this.induceFieldInfoFromEntityField(defaultFieldType)) return true;
-        if (this.induceFieldInfoFromServiceParam(defaultFieldType)) return true;
+    private boolean induceFieldInfo(String defaultFieldType, ModelReader entityModelReader, DispatchContext dispatchContext) {
+        if (this.induceFieldInfoFromEntityField(defaultFieldType, entityModelReader)) return true;
+        if (this.induceFieldInfoFromServiceParam(defaultFieldType, entityModelReader, dispatchContext)) return true;
         return false;
     }
 
-    public boolean induceFieldInfoFromServiceParam(String defaultFieldType) {
+    private boolean induceFieldInfoFromServiceParam(String defaultFieldType, ModelReader entityModelReader, DispatchContext dispatchContext) {
         if (UtilValidate.isEmpty(this.getServiceName()) || UtilValidate.isEmpty(this.getAttributeName()))  return false;
-
-        DispatchContext dispatchContext = this.getModelForm().dispatchContext;
         try {
             ModelService modelService = dispatchContext.getModelService(this.getServiceName());
             if (modelService != null) {
@@ -280,7 +277,7 @@ public class ModelFormField {
                     if (UtilValidate.isNotEmpty(modelParam.entityName) && UtilValidate.isNotEmpty(modelParam.fieldName)) {
                         this.entityName = modelParam.entityName;
                         this.fieldName = modelParam.fieldName;
-                        if (this.induceFieldInfoFromEntityField(defaultFieldType)) {
+                        if (this.induceFieldInfoFromEntityField(defaultFieldType, entityModelReader)) {
                             return true;
                         }
                     }
@@ -358,10 +355,8 @@ public class ModelFormField {
         return true;
     }
 
-    public boolean induceFieldInfoFromEntityField(String defaultFieldType) {
+    private boolean induceFieldInfoFromEntityField(String defaultFieldType, ModelReader entityModelReader) {
         if (UtilValidate.isEmpty(this.getEntityName()) || UtilValidate.isEmpty(this.getFieldName())) return false;
-        
-        ModelReader entityModelReader = this.getModelForm().entityModelReader;
         try {
             ModelEntity modelEntity = entityModelReader.getModelEntity(this.getEntityName());
             if (modelEntity != null) {
@@ -1347,6 +1342,8 @@ public class ModelFormField {
             this.modelFormField = modelFormField;
         }
 
+        public abstract void accept(ModelFieldVisitor visitor);
+
         public ModelFormField getModelFormField() {
             return modelFormField;
         }
@@ -1406,6 +1403,10 @@ public class ModelFormField {
             }
         }
 
+        public List<OptionSource> getOptionSources() {
+            return optionSources;
+        }
+
         public List<OptionValue> getAllOptionValues(Map<String, Object> context, Delegator delegator) {
             List<OptionValue> optionValues = new LinkedList<OptionValue>();
             for (OptionSource optionSource: this.optionSources) {
@@ -1519,7 +1520,7 @@ public class ModelFormField {
             List<? extends Object> dataList = UtilGenerics.checkList(this.listAcsr.get(context));
             if (dataList != null && dataList.size() != 0) {
                 for (Object data: dataList) {
-                    Map<String, Object> localContext = FastMap.newInstance();
+                    Map<String, Object> localContext = new HashMap<String, Object>();
                     localContext.putAll(context);
                     if (UtilValidate.isNotEmpty(this.listEntryName)) {
                         localContext.put(this.listEntryName, data);
@@ -1585,6 +1586,10 @@ public class ModelFormField {
             this.fieldInfo = fieldInfo;
         }
 
+        public String getEntityName() {
+            return entityName;
+        }
+
         public String getKeyFieldName() {
             if (UtilValidate.isNotEmpty(this.keyFieldName)) return this.keyFieldName;
             return this.fieldInfo.getModelFormField().getFieldName(); // get the modelFormField fieldName
@@ -2128,6 +2133,11 @@ public class ModelFormField {
                 return "";
             }
         }
+
+        @Override
+        public void accept(ModelFieldVisitor visitor) {
+            visitor.visit(this);
+        }
     }
 
     public static class DisplayEntityField extends DisplayField {
@@ -2167,6 +2177,11 @@ public class ModelFormField {
         }
 
         @Override
+        public void accept(ModelFieldVisitor visitor) {
+            visitor.visit(this);
+        }
+
+        @Override
         public String getDescription(Map<String, Object> context) {
             Locale locale = UtilMisc.ensureLocale(context.get("locale"));
 
@@ -2203,6 +2218,10 @@ public class ModelFormField {
             return retVal;
         }
 
+        public String getEntityName() {
+            return entityName;
+        }
+
         public SubHyperlink getSubHyperlink() {
             return this.subHyperlink;
         }
@@ -2225,7 +2244,7 @@ public class ModelFormField {
         protected FlexibleStringExpander imageTitle;
         protected FlexibleStringExpander targetWindowExdr;
         protected FlexibleMapAccessor<Map<String, String>> parametersMapAcsr;
-        protected List<WidgetWorker.Parameter> parameterList = FastList.newInstance();
+        protected List<WidgetWorker.Parameter> parameterList = new ArrayList<WidgetWorker.Parameter>();
         protected WidgetWorker.AutoServiceParameters autoServiceParameters;
         protected WidgetWorker.AutoEntityParameters autoEntityParameters;
 
@@ -2274,6 +2293,11 @@ public class ModelFormField {
         }
 
         @Override
+        public void accept(ModelFieldVisitor visitor) {
+            visitor.visit(this);
+        }
+
+        @Override
         public void renderFieldString(Appendable writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
             formStringRenderer.renderHyperlinkField(writer, context, this);
         }
@@ -2337,7 +2361,7 @@ public class ModelFormField {
         }
 
         public Map<String, String> getParameterMap(Map<String, Object> context) {
-            Map<String, String> fullParameterMap = FastMap.newInstance();
+            Map<String, String> fullParameterMap = new HashMap<String, String>();
             
             Map<String, String> addlParamMap = this.parametersMapAcsr.get(context);
             if (addlParamMap != null) {
@@ -2433,7 +2457,7 @@ public class ModelFormField {
         protected FlexibleStringExpander target;
         protected FlexibleStringExpander description;
         protected FlexibleStringExpander targetWindowExdr;
-        protected List<WidgetWorker.Parameter> parameterList = FastList.newInstance();
+        protected List<WidgetWorker.Parameter> parameterList = new ArrayList<WidgetWorker.Parameter>();
         protected boolean requestConfirmation = false;
         protected FlexibleStringExpander confirmationMsgExdr;
         protected ModelFormField modelFormField;
@@ -2500,7 +2524,7 @@ public class ModelFormField {
         }
 
         public Map<String, String> getParameterMap(Map<String, Object> context) {
-            Map<String, String> fullParameterMap = FastMap.newInstance();
+            Map<String, String> fullParameterMap = new HashMap<String, String>();
 
             /* leaving this here... may want to add it at some point like the hyperlink element:
             Map<String, String> addlParamMap = this.parametersMapAcsr.get(context);
@@ -2774,6 +2798,11 @@ public class ModelFormField {
         }
 
         @Override
+        public void accept(ModelFieldVisitor visitor) {
+            visitor.visit(this);
+        }
+
+        @Override
         public void renderFieldString(Appendable writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
             formStringRenderer.renderTextField(writer, context, this);
         }
@@ -2903,6 +2932,11 @@ public class ModelFormField {
         }
 
         @Override
+        public void accept(ModelFieldVisitor visitor) {
+            visitor.visit(this);
+        }
+
+        @Override
         public void renderFieldString(Appendable writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
             formStringRenderer.renderTextareaField(writer, context, this);
         }
@@ -3010,6 +3044,11 @@ public class ModelFormField {
         }
 
         @Override
+        public void accept(ModelFieldVisitor visitor) {
+            visitor.visit(this);
+        }
+
+        @Override
         public void renderFieldString(Appendable writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
             formStringRenderer.renderDateTimeField(writer, context, this);
         }
@@ -3144,6 +3183,11 @@ public class ModelFormField {
         }
 
         @Override
+        public void accept(ModelFieldVisitor visitor) {
+            visitor.visit(this);
+        }
+
+        @Override
         public void renderFieldString(Appendable writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
             formStringRenderer.renderDropDownField(writer, context, this);
         }
@@ -3245,6 +3289,11 @@ public class ModelFormField {
         }
 
         @Override
+        public void accept(ModelFieldVisitor visitor) {
+            visitor.visit(this);
+        }
+
+        @Override
         public void renderFieldString(Appendable writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
             formStringRenderer.renderRadioField(writer, context, this);
         }
@@ -3272,6 +3321,11 @@ public class ModelFormField {
         }
 
         @Override
+        public void accept(ModelFieldVisitor visitor) {
+            visitor.visit(this);
+        }
+
+        @Override
         public void renderFieldString(Appendable writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
             formStringRenderer.renderCheckField(writer, context, this);
         }
@@ -3312,6 +3366,11 @@ public class ModelFormField {
         }
 
         @Override
+        public void accept(ModelFieldVisitor visitor) {
+            visitor.visit(this);
+        }
+
+        @Override
         public void renderFieldString(Appendable writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
             formStringRenderer.renderSubmitField(writer, context, this);
         }
@@ -3389,6 +3448,11 @@ public class ModelFormField {
         }
 
         @Override
+        public void accept(ModelFieldVisitor visitor) {
+            visitor.visit(this);
+        }
+
+        @Override
         public void renderFieldString(Appendable writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
             formStringRenderer.renderResetField(writer, context, this);
         }
@@ -3415,6 +3479,11 @@ public class ModelFormField {
         }
 
         @Override
+        public void accept(ModelFieldVisitor visitor) {
+            visitor.visit(this);
+        }
+
+        @Override
         public void renderFieldString(Appendable writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
             formStringRenderer.renderHiddenField(writer, context, this);
         }
@@ -3455,6 +3524,11 @@ public class ModelFormField {
         }
 
         @Override
+        public void accept(ModelFieldVisitor visitor) {
+            visitor.visit(this);
+        }
+
+        @Override
         public void renderFieldString(Appendable writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
             formStringRenderer.renderIgnoredField(writer, context, this);
         }
@@ -3501,6 +3575,11 @@ public class ModelFormField {
         }
 
         @Override
+        public void accept(ModelFieldVisitor visitor) {
+            visitor.visit(this);
+        }
+
+        @Override
         public void renderFieldString(Appendable writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
             formStringRenderer.renderTextFindField(writer, context, this);
         }
@@ -3521,6 +3600,11 @@ public class ModelFormField {
         }
 
         @Override
+        public void accept(ModelFieldVisitor visitor) {
+            visitor.visit(this);
+        }
+
+        @Override
         public void renderFieldString(Appendable writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
             formStringRenderer.renderDateFindField(writer, context, this);
         }
@@ -3549,6 +3633,11 @@ public class ModelFormField {
         }
 
         @Override
+        public void accept(ModelFieldVisitor visitor) {
+            visitor.visit(this);
+        }
+
+        @Override
         public void renderFieldString(Appendable writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
             formStringRenderer.renderRangeFindField(writer, context, this);
         }
@@ -3598,6 +3687,11 @@ public class ModelFormField {
         }
 
         @Override
+        public void accept(ModelFieldVisitor visitor) {
+            visitor.visit(this);
+        }
+
+        @Override
         public void renderFieldString(Appendable writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
             formStringRenderer.renderLookupField(writer, context, this);
         }
@@ -3607,7 +3701,7 @@ public class ModelFormField {
         }
 
         public List<String> getTargetParameterList() {
-            List<String> paramList = FastList.newInstance();
+            List<String> paramList = new LinkedList<String>();
             if (UtilValidate.isNotEmpty(this.targetParameter)) {
                 StringTokenizer stk = new StringTokenizer(this.targetParameter, ", ");
                 while (stk.hasMoreTokens()) {
@@ -3699,6 +3793,11 @@ public class ModelFormField {
         }
 
         @Override
+        public void accept(ModelFieldVisitor visitor) {
+            visitor.visit(this);
+        }
+
+        @Override
         public void renderFieldString(Appendable writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
             formStringRenderer.renderFileField(writer, context, this);
         }
@@ -3715,6 +3814,11 @@ public class ModelFormField {
         }
 
         @Override
+        public void accept(ModelFieldVisitor visitor) {
+            visitor.visit(this);
+        }
+
+        @Override
         public void renderFieldString(Appendable writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
             formStringRenderer.renderPasswordField(writer, context, this);
         }
@@ -3754,6 +3858,11 @@ public class ModelFormField {
         }
 
         @Override
+        public void accept(ModelFieldVisitor visitor) {
+            visitor.visit(this);
+        }
+
+        @Override
         public void renderFieldString(Appendable writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
             formStringRenderer.renderImageField(writer, context, this);
         }
@@ -3835,6 +3944,11 @@ public class ModelFormField {
         }
 
         @Override
+        public void accept(ModelFieldVisitor visitor) {
+            visitor.visit(this);
+        }
+
+        @Override
         public void renderFieldString(Appendable writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
             formStringRenderer.renderContainerFindField(writer, context, this);
         }

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Mon Nov  3 06:54:16 2014
@@ -20,6 +20,7 @@ package org.ofbiz.widget.html;
 
 import java.io.IOException;
 import java.util.HashSet;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
@@ -29,8 +30,6 @@ import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import javolution.util.FastList;
-
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.StringUtil;
 import org.ofbiz.base.util.StringUtil.SimpleEncoder;
@@ -958,7 +957,7 @@ public class HtmlFormRenderer extends Ht
             String backgroundSubmitRefreshTarget = submitField.getBackgroundSubmitRefreshTarget(context);
             if (UtilValidate.isNotEmpty(backgroundSubmitRefreshTarget)) {
                 if (updateAreas == null) {
-                    updateAreas = FastList.newInstance();
+                    updateAreas = new LinkedList<ModelForm.UpdateArea>();
                 }
                 updateAreas.add(new ModelForm.UpdateArea("submit", formId, backgroundSubmitRefreshTarget));
             }

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/html/HtmlMenuWrapperImage.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/html/HtmlMenuWrapperImage.java?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/html/HtmlMenuWrapperImage.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/html/HtmlMenuWrapperImage.java Mon Nov  3 06:54:16 2014
@@ -30,6 +30,7 @@ import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.widget.menu.MenuStringRenderer;
 import org.ofbiz.widget.menu.ModelMenuItem;
 import org.xml.sax.SAXException;
@@ -67,7 +68,7 @@ public class HtmlMenuWrapperImage extend
             for (ModelMenuItem menuItem : modelMenu.getMenuItemList()) {
                String contentId = menuItem.getAssociatedContentId(dummyMap);
                //if (Debug.infoOn()) Debug.logInfo("in init, contentId:" + contentId, module);
-               GenericValue webSitePublishPoint = delegator.findOne("WebSitePublishPoint", UtilMisc.toMap("contentId", contentId), true);
+               GenericValue webSitePublishPoint = EntityQuery.use(delegator).from("WebSitePublishPoint").where("contentId", contentId).cache().queryOne();
                String menuItemName = menuItem.getName();
                //if (Debug.infoOn()) Debug.logInfo("in init, menuItemName:" + menuItemName, module);
                //if (Debug.infoOn()) Debug.logInfo("in init, webSitePublishPoint:" + webSitePublishPoint, module);

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java Mon Nov  3 06:54:16 2014
@@ -29,8 +29,6 @@ import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import javolution.util.FastMap;
-
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.GeneralException;
 import org.ofbiz.base.util.UtilFormatOut;
@@ -52,8 +50,8 @@ import org.ofbiz.widget.form.ModelForm;
 import org.ofbiz.widget.menu.MenuStringRenderer;
 import org.ofbiz.widget.menu.ModelMenu;
 import org.ofbiz.widget.screen.ModelScreenWidget;
-import org.ofbiz.widget.screen.ScreenStringRenderer;
 import org.ofbiz.widget.screen.ModelScreenWidget.ColumnContainer;
+import org.ofbiz.widget.screen.ScreenStringRenderer;
 
 /**
  * Widget Library - HTML Form Renderer implementation
@@ -84,14 +82,14 @@ public class HtmlScreenRenderer extends 
     }
 
     public void renderSectionBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.Section section) throws IOException {
-        if (section.isMainSection) {
+        if (section.isMainSection()) {
             this.widgetCommentsEnabled = ModelWidget.widgetBoundaryCommentsEnabled(context);
         }
-        renderBeginningBoundaryComment(writer, section.isMainSection?"Screen":"Section Widget", section);
+        renderBeginningBoundaryComment(writer, section.isMainSection()?"Screen":"Section Widget", section);
     }
 
     public void renderSectionEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.Section section) throws IOException {
-        renderEndingBoundaryComment(writer, section.isMainSection?"Screen":"Section Widget", section);
+        renderEndingBoundaryComment(writer, section.isMainSection()?"Screen":"Section Widget", section);
     }
 
     public void renderContainerBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.Container container) throws IOException {
@@ -667,7 +665,7 @@ public class HtmlScreenRenderer extends 
         Delegator delegator = (Delegator) context.get("delegator");
 
         // make a new map for content rendering; so our current map does not get clobbered
-        Map<String, Object> contentContext = FastMap.newInstance();
+        Map<String, Object> contentContext = new HashMap<String, Object>();
         contentContext.putAll(context);
         String dataResourceId = (String)contentContext.get("dataResourceId");
         if (Debug.verboseOn()) Debug.logVerbose("expandedContentId:" + expandedContentId, module);
@@ -800,7 +798,7 @@ public class HtmlScreenRenderer extends 
             Delegator delegator = (Delegator) context.get("delegator");
 
             // create a new map for the content rendering; so our current context does not get overwritten!
-            Map<String, Object> contentContext = FastMap.newInstance();
+            Map<String, Object> contentContext = new HashMap<String, Object>();
             contentContext.putAll(context);
 
             try {

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java Mon Nov  3 06:54:16 2014
@@ -30,6 +30,8 @@ import org.ofbiz.base.util.UtilXml;
 import org.ofbiz.base.util.collections.FlexibleMapAccessor;
 import org.ofbiz.base.util.string.FlexibleStringExpander;
 import org.ofbiz.widget.ModelWidget;
+import org.ofbiz.widget.ModelWidgetAction;
+import org.ofbiz.widget.ModelWidgetVisitor;
 import org.w3c.dom.Element;
 
 /**
@@ -40,35 +42,27 @@ public class ModelMenu extends ModelWidg
 
     public static final String module = ModelMenu.class.getName();
 
-    protected String menuLocation;
-    protected String type;
-    protected String target;
-    protected String id;
-    protected FlexibleStringExpander title;
-    protected String tooltip;
+    protected List<ModelWidgetAction> actions;
+    protected String defaultAlign;
+    protected String defaultAlignStyle;
+    protected FlexibleStringExpander defaultAssociatedContentId;
+    protected String defaultCellWidth;
+    protected String defaultDisabledTitleStyle;
     protected String defaultEntityName;
-    protected String defaultTitleStyle;
-    protected String defaultWidgetStyle;
-    protected String defaultTooltipStyle;
-    protected String defaultSelectedStyle;
+    protected Boolean defaultHideIfSelected;
     protected String defaultMenuItemName;
-    protected String defaultPermissionOperation;
     protected String defaultPermissionEntityAction;
-    protected FlexibleStringExpander defaultAssociatedContentId;
+    protected String defaultPermissionOperation;
     protected String defaultPermissionStatusId;
     protected String defaultPrivilegeEnumId;
-    protected String orientation = "horizontal";
-    protected String menuWidth;
-    protected String defaultCellWidth;
-    protected Boolean defaultHideIfSelected;
-    protected String defaultDisabledTitleStyle;
-    protected FlexibleMapAccessor<String> selectedMenuItemContextFieldName;
-    protected FlexibleStringExpander menuContainerStyleExdr;
-    protected String defaultAlign;
-    protected String defaultAlignStyle;
-    protected String fillStyle;
+    protected String defaultSelectedStyle;
+    protected String defaultTitleStyle;
+    protected String defaultTooltipStyle;
+    protected String defaultWidgetStyle;
     protected FlexibleStringExpander extraIndex;
-
+    protected String fillStyle;
+    protected String id;
+    protected FlexibleStringExpander menuContainerStyleExdr;
     /** This List will contain one copy of each item for each item name in the order
      * they were encountered in the service, entity, or menu definition; item definitions
      * with constraints will also be in this list but may appear multiple times for the same
@@ -79,19 +73,22 @@ public class ModelMenu extends ModelWidg
      * list clean and implement the override features for item definitions.
      */
     protected List<ModelMenuItem> menuItemList = new ArrayList<ModelMenuItem>();
-
     /** This Map is keyed with the item name and has a ModelMenuItem for the value; items
      * with conditions will not be put in this Map so item definition overrides for items
      * with conditions is not possible.
      */
     protected Map<String, ModelMenuItem> menuItemMap = new HashMap<String, ModelMenuItem>();
-
-    protected List<ModelMenuAction> actions;
+    protected String menuLocation;
+    protected String menuWidth;
+    protected String orientation = "horizontal";
+    protected FlexibleMapAccessor<String> selectedMenuItemContextFieldName;
+    protected String target;
+    protected FlexibleStringExpander title;
+    protected String tooltip;
+    protected String type;
 
 
    // ===== CONSTRUCTORS =====
-    /** Default Constructor */
-    public ModelMenu() {}
 
     /** XML Constructor */
     public ModelMenu(Element menuElement) {
@@ -157,7 +154,7 @@ public class ModelMenu extends ModelWidg
                 this.selectedMenuItemContextFieldName = parent.selectedMenuItemContextFieldName;
                 this.menuContainerStyleExdr = parent.menuContainerStyleExdr;
                 if (parent.actions != null) {
-                    this.actions = new ArrayList<ModelMenuAction>();
+                    this.actions = new ArrayList<ModelWidgetAction>();
                     this.actions.addAll(parent.actions);
                 }
             }
@@ -230,7 +227,7 @@ public class ModelMenu extends ModelWidg
                 this.actions = ModelMenuAction.readSubActions(this, actionsElement);
             } else {
                 this.actions.addAll(ModelMenuAction.readSubActions(this, actionsElement));
-                ArrayList<ModelMenuAction> actionsList = (ArrayList<ModelMenuAction>)this.actions;
+                ArrayList<ModelWidgetAction> actionsList = (ArrayList<ModelWidgetAction>)this.actions;
                 actionsList.trimToSize();
             }
         }
@@ -283,7 +280,7 @@ public class ModelMenu extends ModelWidg
      *   use the same menu definitions for many types of menu UIs
      */
     public void renderMenuString(Appendable writer, Map<String, Object> context, MenuStringRenderer menuStringRenderer) throws IOException {
-        ModelMenuAction.runSubActions(this.actions, context);
+        ModelWidgetAction.runSubActions(this.actions, context);
         if ("simple".equals(this.type)) {
             this.renderSimpleMenuString(writer, context, menuStringRenderer);
         } else {
@@ -368,7 +365,7 @@ public class ModelMenu extends ModelWidg
     }
 
     public String getCurrentMenuName(Map<String, Object> context) {
-        return this.name;
+        return getName();
     }
 
     public String getId() {
@@ -389,7 +386,7 @@ public class ModelMenu extends ModelWidg
 
     @Override
     public String getBoundaryCommentName() {
-        return menuLocation + "#" + name;
+        return menuLocation + "#" + getName();
     }
 
     /**
@@ -445,13 +442,6 @@ public class ModelMenu extends ModelWidg
     /**
      * @param string
      */
-    public void setName(String string) {
-        this.name = string;
-    }
-
-    /**
-     * @param string
-     */
     public void setTarget(String string) {
         this.target = string;
     }
@@ -607,4 +597,9 @@ public class ModelMenu extends ModelWidg
     public void setExtraIndex(String extraIndex) {
         this.extraIndex = FlexibleStringExpander.getInstance(extraIndex);
     }
+
+    @Override
+    public void accept(ModelWidgetVisitor visitor) {
+        visitor.visit(this);
+    }
 }

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/menu/ModelMenuAction.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/menu/ModelMenuAction.java?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/menu/ModelMenuAction.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/menu/ModelMenuAction.java Mon Nov  3 06:54:16 2014
@@ -18,8 +18,10 @@
  *******************************************************************************/
 package org.ofbiz.widget.menu;
 
-import java.text.MessageFormat;
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
@@ -28,94 +30,40 @@ import java.util.TimeZone;
 import javax.servlet.ServletContext;
 import javax.servlet.http.HttpSession;
 
-import javolution.util.FastList;
-import javolution.util.FastMap;
-
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.GeneralException;
 import org.ofbiz.base.util.ObjectType;
-import org.ofbiz.base.util.ScriptUtil;
-import org.ofbiz.base.util.UtilFormatOut;
 import org.ofbiz.base.util.UtilGenerics;
-import org.ofbiz.base.util.UtilProperties;
 import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.base.util.UtilXml;
 import org.ofbiz.base.util.collections.FlexibleMapAccessor;
-import org.ofbiz.base.util.collections.ResourceBundleMapWrapper;
 import org.ofbiz.base.util.string.FlexibleStringExpander;
-import org.ofbiz.entity.finder.ByAndFinder;
-import org.ofbiz.entity.finder.ByConditionFinder;
-import org.ofbiz.entity.finder.PrimaryKeyFinder;
-import org.ofbiz.entity.util.EntityUtilProperties;
-import org.ofbiz.service.GenericServiceException;
-import org.ofbiz.service.ModelService;
-import org.ofbiz.widget.WidgetWorker;
+import org.ofbiz.widget.ModelActionVisitor;
+import org.ofbiz.widget.ModelWidgetAction;
 import org.w3c.dom.Element;
 
-
 /**
  * Widget Library - Screen model class
  */
 public abstract class ModelMenuAction {
-    public static final String module = ModelMenuAction.class.getName();
-
-    protected ModelMenu modelMenu;
-    protected ModelMenuItem modelMenuItem;
-
-    public ModelMenuAction(ModelMenu modelMenu, Element actionElement) {
-        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 final String module = ModelMenuAction.class.getName();
 
-    public static List<ModelMenuAction> readSubActions(ModelMenu modelMenu, Element parentElement) {
+    public static List<ModelWidgetAction> readSubActions(ModelMenu modelMenu, Element parentElement) {
         List<? extends Element> actionElementList = UtilXml.childElementList(parentElement);
-        ArrayList<ModelMenuAction> actions = new ArrayList<ModelMenuAction>(actionElementList.size());
+        List<ModelWidgetAction> actions = new ArrayList<ModelWidgetAction>(actionElementList.size());
         for (Element actionElement : actionElementList) {
             if ("set".equals(actionElement.getNodeName())) {
                 actions.add(new SetField(modelMenu, actionElement));
-            } else if ("property-map".equals(actionElement.getNodeName())) {
-                actions.add(new PropertyMap(modelMenu, actionElement));
-            } else if ("property-to-field".equals(actionElement.getNodeName())) {
-                actions.add(new PropertyToField(modelMenu, actionElement));
-            } else if ("script".equals(actionElement.getNodeName())) {
-                actions.add(new Script(modelMenu, actionElement));
-            } else if ("service".equals(actionElement.getNodeName())) {
-                actions.add(new Service(modelMenu, actionElement));
-            } else if ("entity-one".equals(actionElement.getNodeName())) {
-                actions.add(new EntityOne(modelMenu, actionElement));
-            } else if ("entity-and".equals(actionElement.getNodeName())) {
-                actions.add(new EntityAnd(modelMenu, actionElement));
-            } else if ("entity-condition".equals(actionElement.getNodeName())) {
-                actions.add(new EntityCondition(modelMenu, actionElement));
             } else {
-                throw new IllegalArgumentException("Action element not supported with name: " + actionElement.getNodeName());
+                actions.add(ModelWidgetAction.toModelWidgetAction(modelMenu, actionElement));
             }
         }
-        actions.trimToSize();
-        return actions;
+        return Collections.unmodifiableList(actions);
     }
 
-    public static void runSubActions(List<ModelMenuAction> actions, Map<String, Object> context) {
-        if (actions == null) return;
-        for (ModelMenuAction action : actions) {
-            if (Debug.verboseOn()) Debug.logVerbose("Running screen action " + action.getClass().getName(), module);
-            action.runAction(context);
-        }
-    }
-
-    public static class SetField extends ModelMenuAction {
+    @SuppressWarnings("serial")
+    public static class SetField extends ModelWidgetAction {
         protected FlexibleMapAccessor<Object> field;
         protected FlexibleMapAccessor<Object> fromField;
         protected FlexibleStringExpander valueExdr;
@@ -140,6 +88,7 @@ public abstract class ModelMenuAction {
             }
         }
 
+        @SuppressWarnings("rawtypes")
         @Override
         public void runAction(Map<String, Object> context) {
             String globalStr = this.globalExdr.expandString(context);
@@ -189,9 +138,9 @@ public abstract class ModelMenuAction {
 
             if (UtilValidate.isNotEmpty(this.type)) {
                 if ("NewMap".equals(this.type)) {
-                    newValue = FastMap.newInstance();
+                    newValue = new HashMap();
                 } else if ("NewList".equals(this.type)) {
-                    newValue = FastList.newInstance();
+                    newValue = new LinkedList();
                 } else {
                     try {
                         newValue = ObjectType.simpleTypeConvert(newValue, this.type, null, (TimeZone) context.get("timeZone"), (Locale) context.get("locale"), true);
@@ -236,257 +185,10 @@ public abstract class ModelMenuAction {
                 this.field.put(page, newValue);
             }
         }
-    }
-
-    public static class PropertyMap extends ModelMenuAction {
-        protected FlexibleStringExpander resourceExdr;
-        protected FlexibleMapAccessor<ResourceBundleMapWrapper> 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"));
-        }
-
-        @Override
-        public void runAction(Map<String, Object> context) {
-            String globalStr = this.globalExdr.expandString(context);
-            // default to false
-            boolean global = "true".equals(globalStr);
-
-            Locale locale = (Locale) context.get("locale");
-            String resource = this.resourceExdr.expandString(context, locale);
-
-            ResourceBundleMapWrapper existingPropMap = this.mapNameAcsr.get(context);
-            if (existingPropMap == null) {
-                this.mapNameAcsr.put(context, UtilProperties.getResourceBundleMap(resource, locale, context));
-            } else {
-                try {
-                    existingPropMap.addBottomResourceBundle(resource);
-                } catch (IllegalArgumentException e) {
-                    // log the error, but don't let it kill everything just for a typo or bad char in an l10n file
-                    Debug.logError(e, "Error adding resource bundle [" + resource + "]: " + e.toString(), module);
-                }
-            }
-
-            if (global) {
-                Map<String, Object> globalCtx = UtilGenerics.checkMap(context.get("globalContext"));
-                if (globalCtx != null) {
-                    ResourceBundleMapWrapper globalExistingPropMap = this.mapNameAcsr.get(globalCtx);
-                    if (globalExistingPropMap == null) {
-                        this.mapNameAcsr.put(globalCtx, UtilProperties.getResourceBundleMap(resource, locale, context));
-                    } else {
-                        // is it the same object? if not add it in here too...
-                        if (existingPropMap != globalExistingPropMap) {
-                            try {
-                                globalExistingPropMap.addBottomResourceBundle(resource);
-                            } catch (IllegalArgumentException e) {
-                                // log the error, but don't let it kill everything just for a typo or bad char in an l10n file
-                                Debug.logError(e, "Error adding resource bundle [" + resource + "]: " + e.toString(), module);
-                            }
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    public static class PropertyToField extends ModelMenuAction {
-
-        protected FlexibleStringExpander resourceExdr;
-        protected FlexibleStringExpander propertyExdr;
-        protected FlexibleMapAccessor<Object> fieldAcsr;
-        protected FlexibleStringExpander defaultExdr;
-        protected boolean noLocale;
-        protected FlexibleMapAccessor<List<? extends Object>> argListAcsr;
-        protected FlexibleStringExpander globalExdr;
-
-        public PropertyToField(ModelMenu modelMenu, Element setElement) {
-            super (modelMenu, setElement);
-            this.resourceExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("resource"));
-            this.propertyExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("property"));
-            this.fieldAcsr = FlexibleMapAccessor.getInstance(setElement.getAttribute("field"));
-            this.defaultExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("default"));
-            noLocale = "true".equals(setElement.getAttribute("no-locale"));
-            this.argListAcsr = FlexibleMapAccessor.getInstance(setElement.getAttribute("arg-list-name"));
-            this.globalExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("global"));
-        }
 
         @Override
-        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 = EntityUtilProperties.getPropertyValue(resource, property, WidgetWorker.getDelegator(context));
-            } else {
-                value = EntityUtilProperties.getMessage(resource, property, locale, WidgetWorker.getDelegator(context));
-            }
-            if (UtilValidate.isEmpty(value)) {
-                value = this.defaultExdr.expandString(context);
-            }
-
-            // 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);
-
-            if (!argListAcsr.isEmpty()) {
-                List<? extends Object> argList = argListAcsr.get(context);
-                if (UtilValidate.isNotEmpty(argList)) {
-                    value = MessageFormat.format(value, argList.toArray());
-                }
-            }
-
-            fieldAcsr.put(context, value);
-        }
-    }
-
-    public static class Script extends ModelMenuAction {
-        protected String location;
-        protected String method;
-
-        public Script(ModelMenu modelMenu, Element scriptElement) {
-            super (modelMenu, scriptElement);
-            String scriptLocation = scriptElement.getAttribute("location");
-            this.location = WidgetWorker.getScriptLocation(scriptLocation);
-            this.method = WidgetWorker.getScriptMethodName(scriptLocation);
-        }
-
-        @Override
-        public void runAction(Map<String, Object> context) {
-            ScriptUtil.executeScript(this.location, this.method, context);
-        }
-    }
-
-    public static class Service extends ModelMenuAction {
-        protected FlexibleStringExpander serviceNameExdr;
-        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(fieldMapElement.getAttribute("env-name")));
-                }
-            }
-        }
-
-        @Override
-        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) {
-                    serviceContext = WidgetWorker.getDispatcher(context).getDispatchContext().makeValidContext(serviceNameExpanded, ModelService.IN_PARAM, context);
-                } else {
-                    serviceContext = FastMap.newInstance();
-                }
-
-                if (this.fieldMap != null) {
-                    for (Map.Entry<FlexibleMapAccessor<Object>, FlexibleMapAccessor<Object>> entry: this.fieldMap.entrySet()) {
-                        FlexibleMapAccessor<Object> serviceContextFieldAcsr = entry.getKey();
-                        FlexibleMapAccessor<Object> contextEnvAcsr = entry.getValue();
-                        serviceContextFieldAcsr.put(serviceContext, contextEnvAcsr.get(context));
-                    }
-                }
-
-                Map<String, Object> result = WidgetWorker.getDispatcher(context).runSync(serviceNameExpanded, serviceContext);
-
-                if (!this.resultMapNameAcsr.isEmpty()) {
-                    this.resultMapNameAcsr.put(context, result);
-                } else {
-                    context.putAll(result);
-                }
-            } catch (GenericServiceException e) {
-                String errMsg = "Error calling service with name " + serviceNameExpanded + ": " + e.toString();
-                Debug.logError(e, errMsg, module);
-                throw new IllegalArgumentException(errMsg);
-            }
-        }
-    }
-
-    public static class EntityOne extends ModelMenuAction {
-        protected PrimaryKeyFinder finder;
-
-        public EntityOne(ModelMenu modelMenu, Element entityOneElement) {
-            super (modelMenu, entityOneElement);
-            finder = new PrimaryKeyFinder(entityOneElement);
-        }
-
-        @Override
-        public void runAction(Map<String, Object> context) {
-            try {
-                finder.runFind(context, WidgetWorker.getDelegator(context));
-            } catch (GeneralException e) {
-                String errMsg = "Error doing entity query by condition: " + e.toString();
-                Debug.logError(e, errMsg, module);
-                throw new IllegalArgumentException(errMsg);
-            }
-        }
-    }
-
-    public static class EntityAnd extends ModelMenuAction {
-        protected ByAndFinder finder;
-
-        public EntityAnd(ModelMenu modelMenu, Element entityAndElement) {
-            super (modelMenu, entityAndElement);
-            finder = new ByAndFinder(entityAndElement);
-        }
-
-        @Override
-        public void runAction(Map<String, Object> context) {
-            try {
-                finder.runFind(context, WidgetWorker.getDelegator(context));
-            } catch (GeneralException e) {
-                String errMsg = "Error doing entity query by condition: " + e.toString();
-                Debug.logError(e, errMsg, module);
-                throw new IllegalArgumentException(errMsg);
-            }
-        }
-    }
-
-    public static class EntityCondition extends ModelMenuAction {
-        ByConditionFinder finder;
-
-        public EntityCondition(ModelMenu modelMenu, Element entityConditionElement) {
-            super (modelMenu, entityConditionElement);
-            finder = new ByConditionFinder(entityConditionElement);
-        }
-
-        @Override
-        public void runAction(Map<String, Object> context) {
-            try {
-                finder.runFind(context, WidgetWorker.getDelegator(context));
-            } catch (GeneralException e) {
-                String errMsg = "Error doing entity query by condition: " + e.toString();
-                Debug.logError(e, errMsg, module);
-                throw new IllegalArgumentException(errMsg);
-            }
+        public void accept(ModelActionVisitor visitor) {
+            visitor.visit(this);
         }
     }
 }

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/menu/ModelMenuCondition.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/menu/ModelMenuCondition.java?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/menu/ModelMenuCondition.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/menu/ModelMenuCondition.java Mon Nov  3 06:54:16 2014
@@ -19,13 +19,12 @@
 package org.ofbiz.widget.menu;
 
 import java.lang.reflect.Method;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 import java.util.TimeZone;
 
-import javolution.util.FastList;
-
 import org.apache.oro.text.regex.MalformedPatternException;
 import org.apache.oro.text.regex.Pattern;
 import org.apache.oro.text.regex.PatternMatcher;
@@ -101,7 +100,7 @@ public class ModelMenuCondition {
     }
 
     public static List<MenuCondition> readSubConditions(ModelMenuItem modelMenuItem, Element conditionElement) {
-        List<MenuCondition> condList = FastList.newInstance();
+        List<MenuCondition> condList = new LinkedList<MenuCondition>();
         List<? extends Element> subElementList = UtilXml.childElementList(conditionElement);
         for (Element subElement: subElementList) {
             condList.add(readCondition(modelMenuItem, subElement));
@@ -422,7 +421,7 @@ public class ModelMenuCondition {
                 fieldVal = "";
             }
 
-            List<Object> messages = FastList.newInstance();
+            List<Object> messages = new LinkedList<Object>();
             Boolean resultBool = BaseCompare.doRealCompare(fieldVal, value, operator, type, format, messages, null, null, true);
             if (messages.size() > 0) {
                 messages.add(0, "Error with comparison in if-compare between field [" + fieldAcsr.toString() + "] with value [" + fieldVal + "] and value [" + value + "] with operator [" + operator + "] and type [" + type + "]: ");
@@ -473,7 +472,7 @@ public class ModelMenuCondition {
                 fieldVal = "";
             }
 
-            List<Object> messages = FastList.newInstance();
+            List<Object> messages = new LinkedList<Object>();
             Boolean resultBool = BaseCompare.doRealCompare(fieldVal, toFieldVal, operator, type, format, messages, null, null, false);
             if (messages.size() > 0) {
                 messages.add(0, "Error with comparison in if-compare-field between field [" + fieldAcsr.toString() + "] with value [" + fieldVal + "] and to-field [" + toFieldVal.toString() + "] with value [" + toFieldVal + "] with operator [" + operator + "] and type [" + type + "]: ");

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java Mon Nov  3 06:54:16 2014
@@ -19,6 +19,7 @@
 package org.ofbiz.widget.menu;
 
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
@@ -27,9 +28,6 @@ import java.util.Map;
 
 import javax.xml.parsers.ParserConfigurationException;
 
-import javolution.util.FastList;
-import javolution.util.FastMap;
-
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.StringUtil;
 import org.ofbiz.base.util.UtilFormatOut;
@@ -39,86 +37,105 @@ import org.ofbiz.base.util.UtilXml;
 import org.ofbiz.base.util.collections.FlexibleMapAccessor;
 import org.ofbiz.base.util.string.FlexibleStringExpander;
 import org.ofbiz.entity.GenericValue;
-import org.ofbiz.widget.WidgetWorker;
+import org.ofbiz.widget.ModelWidget;
+import org.ofbiz.widget.ModelWidgetAction;
+import org.ofbiz.widget.ModelWidgetVisitor;
 import org.ofbiz.widget.PortalPageWorker;
+import org.ofbiz.widget.WidgetWorker;
 import org.w3c.dom.Element;
 import org.xml.sax.SAXException;
 
 /**
  * Widget Library - Form model class
  */
-public class ModelMenuItem {
+@SuppressWarnings("serial")
+public class ModelMenuItem extends ModelWidget {
 
     public static final String module = ModelMenuItem.class.getName();
 
-    protected ModelMenu modelMenu;
-
-    protected Map<String, Object> dataMap = new HashMap<String, Object>();
-    protected String name;
-    protected String entityName;
-    protected FlexibleStringExpander title;
-    protected FlexibleStringExpander tooltip;
-    protected FlexibleStringExpander parentPortalPageId;
-    protected String titleStyle;
-    protected String disabledTitleStyle;
-    protected String widgetStyle;
-    protected String tooltipStyle;
-    protected String selectedStyle;
-    protected Integer position = null;
-
+    protected List<ModelWidgetAction> actions;
+    protected String align;
+    protected String alignStyle;
     protected FlexibleStringExpander associatedContentId;
     protected String cellWidth;
-    protected Boolean hideIfSelected;
-    protected Boolean hasPermission;
+    protected ModelMenuCondition condition;
+    protected Map<String, Object> dataMap = new HashMap<String, Object>();
+    protected boolean disabled = false;
+    protected String disabledTitleStyle;
     protected String disableIfEmpty;
-    protected ModelMenu subMenu;
+    protected String entityName;
+    protected Boolean hasPermission;
+    protected Boolean hideIfSelected;
     protected Link link;
-
+    /** This List will contain one copy of each item for each item name in the order
+     * they were encountered in the service, entity, or menu definition; item definitions
+     * with constraints will also be in this list but may appear multiple times for the same
+     * item name.
+     *
+     * When rendering the menu the order in this list should be following and it should not be
+     * necessary to use the Map. The Map is used when loading the menu definition to keep the
+     * list clean and implement the override features for item definitions.
+     */
     protected List<ModelMenuItem> menuItemList = new LinkedList<ModelMenuItem>();
+    /** This Map is keyed with the item name and has a ModelMenuItem for the value; items
+     * with conditions will not be put in this Map so item definition overrides for items
+     * with conditions is not possible.
+     */
     protected Map<String, ModelMenuItem> menuItemMap = new HashMap<String, ModelMenuItem>();
-
+    protected ModelMenu modelMenu;
+    protected String overrideName = null;
     protected ModelMenuItem parentMenuItem;
-    protected ModelMenuCondition condition;
-    protected boolean disabled = false;
-    protected List<ModelMenuAction> actions;
-    protected String align;
-    protected String alignStyle;
+    protected FlexibleStringExpander parentPortalPageId;
+    protected Integer position = null;
+    protected String selectedStyle;
+    protected ModelMenu subMenu;
+    protected FlexibleStringExpander title;
+    protected String titleStyle;
+    protected FlexibleStringExpander tooltip;
+    protected String tooltipStyle;
+    protected String widgetStyle;
 
     // ===== CONSTRUCTORS =====
-    /** Default Constructor */
-    public ModelMenuItem(ModelMenu modelMenu) {
-        this.modelMenu = modelMenu;
+    public ModelMenuItem(String name) {
+        super(name);
     }
 
-    /** XML Constructor */
-    public ModelMenuItem(Element fieldElement, ModelMenuItem modelMenuItem) {
-        parentMenuItem = modelMenuItem;
-        loadMenuItem(fieldElement, modelMenuItem.getModelMenu());
+    public ModelMenuItem(Element menuItemElement) {
+        super(menuItemElement);
+        loadMenuItem(menuItemElement);
     }
 
+    public ModelMenuItem(Element menuItemElement, ModelMenu modelMenu) {
+        super(menuItemElement);
+        loadMenuItem(menuItemElement, modelMenu);
+    }
 
-    public ModelMenuItem(Element fieldElement, ModelMenu modelMenu) {
-        loadMenuItem(fieldElement, modelMenu);
+    public ModelMenuItem(Element menuItemElement, ModelMenuItem modelMenuItem) {
+        super(menuItemElement);
+        parentMenuItem = modelMenuItem;
+        loadMenuItem(menuItemElement, modelMenuItem.getModelMenu());
     }
 
-    public void loadMenuItem(Element fieldElement, ModelMenu modelMenu) {
+    private void loadMenuItem(Element menuItemElement, ModelMenu modelMenu) {
         this.modelMenu = modelMenu;
-        this.name = fieldElement.getAttribute("name");
-        this.entityName = fieldElement.getAttribute("entity-name");
-        this.setTitle(fieldElement.getAttribute("title"));
-        this.setTooltip(fieldElement.getAttribute("tooltip"));
-        this.setParentPortalPageId(fieldElement.getAttribute("parent-portal-page-value"));
-        this.titleStyle = fieldElement.getAttribute("title-style");
-        this.disabledTitleStyle = fieldElement.getAttribute("disabled-title-style");
-        this.widgetStyle = fieldElement.getAttribute("widget-style");
-        this.tooltipStyle = fieldElement.getAttribute("tooltip-style");
-        this.selectedStyle = fieldElement.getAttribute("selected-style");
-        this.setHideIfSelected(fieldElement.getAttribute("hide-if-selected"));
-        this.disableIfEmpty = fieldElement.getAttribute("disable-if-empty");
-        this.align = fieldElement.getAttribute("align");
-        this.alignStyle = fieldElement.getAttribute("align-style");
+        loadMenuItem(menuItemElement);
+    }
 
-        String positionStr = fieldElement.getAttribute("position");
+    private void loadMenuItem(Element menuItemElement) {
+        this.entityName = menuItemElement.getAttribute("entity-name");
+        this.setTitle(menuItemElement.getAttribute("title"));
+        this.setTooltip(menuItemElement.getAttribute("tooltip"));
+        this.setParentPortalPageId(menuItemElement.getAttribute("parent-portal-page-value"));
+        this.titleStyle = menuItemElement.getAttribute("title-style");
+        this.disabledTitleStyle = menuItemElement.getAttribute("disabled-title-style");
+        this.widgetStyle = menuItemElement.getAttribute("widget-style");
+        this.tooltipStyle = menuItemElement.getAttribute("tooltip-style");
+        this.selectedStyle = menuItemElement.getAttribute("selected-style");
+        this.setHideIfSelected(menuItemElement.getAttribute("hide-if-selected"));
+        this.disableIfEmpty = menuItemElement.getAttribute("disable-if-empty");
+        this.align = menuItemElement.getAttribute("align");
+        this.alignStyle = menuItemElement.getAttribute("align-style");
+        String positionStr = menuItemElement.getAttribute("position");
         try {
             if (UtilValidate.isNotEmpty(positionStr)) {
                 position = Integer.valueOf(positionStr);
@@ -128,12 +145,12 @@ public class ModelMenuItem {
                     positionStr + "], using the default of the menu renderer", module);
         }
 
-        this.setAssociatedContentId(fieldElement.getAttribute("associated-content-id"));
-        this.cellWidth = fieldElement.getAttribute("cell-width");
+        this.setAssociatedContentId(menuItemElement.getAttribute("associated-content-id"));
+        this.cellWidth = menuItemElement.getAttribute("cell-width");
 
-        dataMap.put("name", this.name);
+        dataMap.put("name", getName());
 
-        Element subMenuElement = UtilXml.firstChildElement(fieldElement, "sub-menu");
+        Element subMenuElement = UtilXml.firstChildElement(menuItemElement, "sub-menu");
         if (subMenuElement != null) {
             String subMenuLocation = subMenuElement.getAttribute("location");
             String subMenuName = subMenuElement.getAttribute("name");
@@ -154,26 +171,26 @@ public class ModelMenuItem {
             }
         }
 
-        Element linkElement = UtilXml.firstChildElement(fieldElement, "link");
+        Element linkElement = UtilXml.firstChildElement(menuItemElement, "link");
         if (linkElement != null) {
             link = new Link(linkElement, this);
         }
 
         // read in add item defs, add/override one by one using the menuItemList and menuItemMap
-        List<? extends Element> itemElements = UtilXml.childElementList(fieldElement, "menu-item");
+        List<? extends Element> itemElements = UtilXml.childElementList(menuItemElement, "menu-item");
         for (Element itemElement: itemElements) {
             ModelMenuItem modelMenuItem = new ModelMenuItem(itemElement, this);
             modelMenuItem = this.addUpdateMenuItem(modelMenuItem);
         }
         // read condition under the "condition" element
-        Element conditionElement = UtilXml.firstChildElement(fieldElement, "condition");
+        Element conditionElement = UtilXml.firstChildElement(menuItemElement, "condition");
         if (conditionElement != null) {
             this.condition = new ModelMenuCondition(this, conditionElement);
         }
         // read all actions under the "actions" element
         Element actionsElement = UtilXml.firstChildElement(conditionElement, "actions");
         if (actionsElement != null) {
-            this.actions = ModelMenuAction.readSubActions(this, actionsElement);
+            this.actions = ModelWidgetAction.readSubActions(this, actionsElement);
         }
 
     }
@@ -217,13 +234,21 @@ public class ModelMenuItem {
          return this.disabled;
     }
 
+    @Override
+    public String getName() {
+        if (this.overrideName != null) {
+            return this.overrideName;
+        }
+        return super.getName();
+    }
+
     public void mergeOverrideModelMenuItem(ModelMenuItem overrideMenuItem) {
         if (overrideMenuItem == null)
             return;
 
         // incorporate updates for values that are not empty in the overrideMenuItem
-        if (UtilValidate.isNotEmpty(overrideMenuItem.name))
-            this.name = overrideMenuItem.name;
+        if (UtilValidate.isNotEmpty(overrideMenuItem.getName()))
+            this.overrideName = overrideMenuItem.getName();
         if (UtilValidate.isNotEmpty(overrideMenuItem.entityName))
             this.entityName = overrideMenuItem.entityName;
         if (UtilValidate.isNotEmpty(overrideMenuItem.parentPortalPageId))
@@ -264,15 +289,15 @@ public class ModelMenuItem {
         Locale locale = (Locale) context.get("locale");
            //Debug.logInfo("in ModelMenu, name:" + this.getName(), module);
         if (passed) {
-            ModelMenuAction.runSubActions(this.actions, context);
+            ModelWidgetAction.runSubActions(this.actions, context);
             String parentPortalPageId = this.getParentPortalPageId(context);
             if (UtilValidate.isNotEmpty(parentPortalPageId)) {
                 List<GenericValue> portalPages = PortalPageWorker.getPortalPages(parentPortalPageId, context);
                 if (UtilValidate.isNotEmpty(portalPages)) {
                     for (GenericValue portalPage : portalPages) {
                         if (UtilValidate.isNotEmpty(portalPage.getString("portalPageName"))) {
-                            ModelMenuItem localItem = new ModelMenuItem(this.getModelMenu());
-                            localItem.name =  portalPage.getString("portalPageId");
+                            String itemName =  portalPage.getString("portalPageId");
+                            ModelMenuItem localItem = new ModelMenuItem(itemName);
                             localItem.setTitle((String) portalPage.get("portalPageName", locale));
                             localItem.link = new Link(this);
                             List<WidgetWorker.Parameter> linkParams = localItem.link.getParameterList();
@@ -300,7 +325,7 @@ public class ModelMenuItem {
         return modelMenu;
     }
 
-    public List<ModelMenuAction> getActions() {
+    public List<ModelWidgetAction> getActions() {
         return actions;
     }
 
@@ -324,11 +349,6 @@ public class ModelMenuItem {
         }
     }
 
-
-    public String getName() {
-        return name;
-    }
-
     public int getPosition() {
         if (this.position == null) {
             return 1;
@@ -429,13 +449,6 @@ public class ModelMenuItem {
     }
 
     /**
-     * @param string
-     */
-    public void setName(String string) {
-        name = string;
-    }
-
-    /**
      * @param i
      */
     public void setPosition(int i) {
@@ -548,7 +561,7 @@ public class ModelMenuItem {
     }
 
     public boolean isSelected(Map<String, Object> context) {
-        return this.name.equals(modelMenu.getSelectedMenuItemContextFieldName(context));
+        return getName().equals(modelMenu.getSelectedMenuItemContextFieldName(context));
     }
 
     public static class Link {
@@ -569,7 +582,7 @@ public class ModelMenuItem {
         protected WidgetWorker.AutoServiceParameters autoServiceParameters;
         protected WidgetWorker.AutoEntityParameters autoEntityParameters;
         protected FlexibleMapAccessor<Map<String, String>> parametersMapAcsr;
-        protected List<WidgetWorker.Parameter> parameterList = FastList.newInstance();
+        protected List<WidgetWorker.Parameter> parameterList = new ArrayList<WidgetWorker.Parameter>();
         protected boolean requestConfirmation = false;
         protected FlexibleStringExpander confirmationMsgExdr;
 
@@ -702,7 +715,7 @@ public class ModelMenuItem {
             return this.parameterList;
         }
         public Map<String, String> getParameterMap(Map<String, Object> context) {
-            Map<String, String> fullParameterMap = FastMap.newInstance();
+            Map<String, String> fullParameterMap = new HashMap<String, String>();
 
             if (this.parametersMapAcsr != null) {
                 Map<String, String> addlParamMap = this.parametersMapAcsr.get(context);
@@ -907,4 +920,9 @@ public class ModelMenuItem {
         }
 
     }
+
+    @Override
+    public void accept(ModelWidgetVisitor visitor) {
+        visitor.visit(this);
+    }
 }

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java Mon Nov  3 06:54:16 2014
@@ -22,11 +22,10 @@ import java.io.IOException;
 import java.net.MalformedURLException;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import javolution.util.FastMap;
-
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.GeneralException;
 import org.ofbiz.base.util.StringUtil;
@@ -38,6 +37,7 @@ import org.ofbiz.base.util.collections.M
 import org.ofbiz.base.util.string.FlexibleStringExpander;
 import org.ofbiz.base.util.template.FreeMarkerWorker;
 import org.ofbiz.widget.ModelWidget;
+import org.ofbiz.widget.ModelWidgetVisitor;
 import org.ofbiz.widget.html.HtmlWidgetRenderer;
 import org.w3c.dom.Element;
 
@@ -131,16 +131,6 @@ public class HtmlWidget extends ModelScr
         }
     }
 
-    @Override
-    public String rawString() {
-        StringBuilder buffer = new StringBuilder("<html-widget>");
-        for (ModelScreenWidget subWidget : subWidgets) {
-            buffer.append(subWidget.rawString());
-        }
-        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);
@@ -213,14 +203,14 @@ public class HtmlWidget extends ModelScr
         }
 
         @Override
-        public String rawString() {
-            return "<html-template location=\"" + this.locationExdr.getOriginal() + "\"/>";
+        public void accept(ModelWidgetVisitor visitor) {
+            visitor.visit(this);
         }
     }
 
     public static class HtmlTemplateDecorator extends ModelScreenWidget {
         protected FlexibleStringExpander locationExdr;
-        protected Map<String, HtmlTemplateDecoratorSection> sectionMap = FastMap.newInstance();
+        protected Map<String, HtmlTemplateDecoratorSection> sectionMap = new HashMap<String, HtmlTemplateDecoratorSection>();
 
         public HtmlTemplateDecorator(ModelScreen modelScreen, Element htmlTemplateDecoratorElement) {
             super(modelScreen, htmlTemplateDecoratorElement);
@@ -258,8 +248,8 @@ public class HtmlWidget extends ModelScr
         }
 
         @Override
-        public String rawString() {
-            return "<html-template-decorator location=\"" + this.locationExdr.getOriginal() + "\"/>";
+        public void accept(ModelWidgetVisitor visitor) {
+            visitor.visit(this);
         }
     }
 
@@ -272,7 +262,7 @@ public class HtmlWidget extends ModelScr
             this.name = htmlTemplateDecoratorSectionElement.getAttribute("name");
             // read sub-widgets
             List<? extends Element> subElementList = UtilXml.childElementList(htmlTemplateDecoratorSectionElement);
-            this.subWidgets = ModelScreenWidget.readSubWidgets(this.modelScreen, subElementList);
+            this.subWidgets = ModelScreenWidget.readSubWidgets(getModelScreen(), subElementList);
         }
 
         @Override
@@ -282,8 +272,13 @@ public class HtmlWidget extends ModelScr
         }
 
         @Override
-        public String rawString() {
-            return "<html-template-decorator-section name=\"" + this.name + "\"/>";
+        public void accept(ModelWidgetVisitor visitor) {
+            visitor.visit(this);
         }
     }
+
+    @Override
+    public void accept(ModelWidgetVisitor visitor) {
+        visitor.visit(this);
+    }
 }