svn commit: r1742126 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/model/FormFactory.java

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

svn commit: r1742126 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/model/FormFactory.java

jleroux@apache.org
Author: jleroux
Date: Tue May  3 15:25:48 2016
New Revision: 1742126

URL: http://svn.apache.org/viewvc?rev=1742126&view=rev
Log:
Fixes "Bug when getting to webtools/control/FindUtilCache"  - https://issues.apache.org/jira/browse/OFBIZ-7033

With OFBIZ-7029 I replaced some widget list forms by grids. I don't know why yet but there are some cases, like at webtools/control/FindUtilCache, where it crashes.

I mean I know why, but I don't know why yet it's not in all places. For instance accounting/control/ListFixedAssets has not this problem.

I'll later check what is the difference between both cases

Modified:
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/model/FormFactory.java

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/model/FormFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/model/FormFactory.java?rev=1742126&r1=1742125&r2=1742126&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/model/FormFactory.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/model/FormFactory.java Tue May  3 15:25:48 2016
@@ -127,12 +127,16 @@ public class FormFactory {
             rootElement = UtilXml.firstChildElement(rootElement, "forms");
         }
         Element formElement = UtilXml.firstChildElement(rootElement, "form", "name", formName);
+        if (formElement == null) {
+            formElement = UtilXml.firstChildElement(rootElement, "grid", "name", formName);
+        }
         return createModelForm(formElement, entityModelReader, dispatchContext, formLocation, formName);
     }
 
     public static ModelForm createModelForm(Element formElement, ModelReader entityModelReader, DispatchContext dispatchContext, String formLocation, String formName) {
         String formType = formElement.getAttribute("type");
-        if (formType.isEmpty() || "single".equals(formType) || "upload".equals(formType)) {
+        if ((formType.isEmpty() || "single".equals(formType) || "upload".equals(formType))
+                && !formElement.getLocalName().equals("grid")) {
             return new ModelSingleForm(formElement, formLocation, entityModelReader, dispatchContext);
         } else {
             return new ModelGrid(formElement, formLocation, entityModelReader, dispatchContext);