svn commit: r446825 - /incubator/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java

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

svn commit: r446825 - /incubator/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java

jleroux@apache.org
Author: jleroux
Date: Sat Sep 16 00:46:14 2006
New Revision: 446825

URL: http://svn.apache.org/viewvc?view=rev&rev=446825
Log:
Allow extending a form widget from a different file with the same form name.
A patch from Marco Risaliti (https://issues.apache.org/jira/browse/OFBIZ-301)

Modified:
    incubator/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java

Modified: incubator/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java?view=diff&rev=446825&r1=446824&r2=446825
==============================================================================
--- incubator/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java (original)
+++ incubator/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java Sat Sep 16 00:46:14 2006
@@ -180,8 +180,7 @@
         // check if there is a parent form to inherit from
         String parentResource = formElement.getAttribute("extends-resource");
         String parentForm = formElement.getAttribute("extends");
-        //TODO: Modify this to allow for extending a form with the same name but different resource
-        if (parentForm.length() > 0 && !parentForm.equals(formElement.getAttribute("name"))) {
+        if (parentForm.length() > 0) {
             ModelForm parent = null;
             // check if we have a resource name (part of the string before the ?)
             if (parentResource.length() > 0) {
@@ -190,7 +189,7 @@
                 } catch (Exception e) {
                     Debug.logError(e, "Failed to load parent form definition '" + parentForm + "' at resource '" + parentResource + "'", module);
                 }
-            } else {
+            } else if (!parentForm.equals(formElement.getAttribute("name"))) {
                 // try to find a form definition in the same file
                 Element rootElement = formElement.getOwnerDocument().getDocumentElement();
                 List formElements = UtilXml.childElementList(rootElement, "form");
@@ -205,8 +204,10 @@
                     }
                 }
                 if (parent == null) {
-                    Debug.logError("Failed to find parent form defenition '" + parentForm + "' in same document.", module);
+                    Debug.logError("Failed to find parent form definition '" + parentForm + "' in same document.", module);
                 }
+            } else {
+                Debug.logError("Recursive form definition found for '" + formElement.getAttribute("name") + ".'", module);
             }
 
             if (parent != null) {