svn commit: r557859 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r557859 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java

hansbak-2
Author: hansbak
Date: Thu Jul 19 20:30:39 2007
New Revision: 557859

URL: http://svn.apache.org/viewvc?view=rev&rev=557859
Log:
ofbiz-1155: problem with 2 <content tags in a screen definition: solved now

Modified:
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java?view=diff&rev=557859&r1=557858&r2=557859
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java Thu Jul 19 20:30:39 2007
@@ -77,7 +77,6 @@
     
     public static List readSubWidgets(ModelScreen modelScreen, List subElementList) {
         List subWidgets = new LinkedList();
-        
         Iterator subElementIter = subElementList.iterator();
         while (subElementIter.hasNext()) {
             Element subElement = (Element) subElementIter.next();
@@ -127,7 +126,7 @@
         Iterator subWidgetIter = subWidgets.iterator();
         while (subWidgetIter.hasNext()) {
             ModelScreenWidget subWidget = (ModelScreenWidget) subWidgetIter.next();
-            if (Debug.verboseOn()) Debug.logVerbose("Rendering screen " + subWidget.modelScreen.name + " widget " + subWidget.getClass().getName(), module);
+            Debug.logInfo("Rendering screen " + subWidget.modelScreen.name + " widget " + subWidget.getClass().getName(), module);
 
             Map parameters = (Map) context.get("parameters");
             boolean insertWidgetBoundaryComments = "true".equals(parameters==null?null:parameters.get("widgetVerbose"));
@@ -850,18 +849,18 @@
                 GenericDelegator delegator = (GenericDelegator) context.get("delegator");
                 GenericValue content = null;
                 String expandedDataResourceId = getDataResourceId(context);
+                String expandedContentId = getContentId(context);
+                if (!(context instanceof MapStack)) {
+                    context = MapStack.create(context);
+                }
+
+                // This is an important step to make sure that the current contentId is in the context
+                // as templates that contain "subcontent" elements will expect to find the master
+                // contentId in the context as "contentId".
+                ((MapStack) context).push();
+                context.put("contentId", expandedContentId);
+
                 if (UtilValidate.isEmpty(expandedDataResourceId)) {
-                    String expandedContentId = getContentId(context);
-                    if (!(context instanceof MapStack)) {
-                        context = MapStack.create(context);
-                    }
-                    
-                    // This is an important step to make sure that the current contentId is in the context
-                    // as templates that contain "subcontent" elements will expect to find the master
-                    // contentId in the context as "contentId".
-                    ((MapStack) context).push();
-                    context.put("contentId", expandedContentId);
-                    
                     if (UtilValidate.isNotEmpty(expandedContentId)) {
                      content = delegator.findByPrimaryKeyCache("Content", UtilMisc.toMap("contentId", expandedContentId));
                     } else {
@@ -871,16 +870,17 @@
                     }
                     if (content != null) {
                         expandedDataResourceId = content.getString("dataResourceId");
-                        this.dataResourceId = new FlexibleStringExpander(expandedDataResourceId);
                     } else {
                         String errMsg = "Could not find content with contentId [" + expandedContentId + "] ";
                         Debug.logError(errMsg, module);
                         throw new RuntimeException(errMsg);
                     }
                 }
+
                 GenericValue dataResource = null;
                 if (UtilValidate.isNotEmpty(expandedDataResourceId)) {
                  dataResource = delegator.findByPrimaryKeyCache("DataResource", UtilMisc.toMap("dataResourceId", expandedDataResourceId));
+                    this.dataResourceId = new FlexibleStringExpander(expandedDataResourceId);
                 }
                 
                 String mimeTypeId = null;