You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by mp...@apache.org on 2005/09/02 00:28:54 UTC

svn commit: r265796 - in /cocoon/gsoc/mpfingsthorn/forms: WEB-INF/xconf/ java/org/apache/cocoon/forms/binding/ java/org/apache/cocoon/forms/util/ samples/library/forms/ samples/library/libraries/

Author: mpfingsthorn
Date: Thu Sep  1 15:27:56 2005
New Revision: 265796

URL: http://svn.apache.org/viewcvs?rev=265796&view=rev
Log:
Finished inheritance for the binding. A simple sample exist for testing.

Added:
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/ExpandJXPathBindingBuilder.java
Modified:
    cocoon/gsoc/mpfingsthorn/forms/WEB-INF/xconf/cocoon-forms.xconf
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/AggregateJXPathBinding.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/AggregateJXPathBindingBuilder.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/CaseJXPathBinding.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/CaseJXPathBindingBuilder.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/ClassJXPathBindingBuilder.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/ComposedJXPathBindingBase.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/ContextJXPathBinding.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/ContextJXPathBindingBuilder.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/CustomJXPathBinding.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/CustomJXPathBindingBuilder.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/DeleteNodeJXPathBindingBuilder.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/GroupJXPathBinding.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/GroupJXPathBindingBuilder.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/InsertBeanJXPathBinding.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/InsertBeanJXPathBindingBuilder.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/InsertNodeJXPathBinding.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/InsertNodeJXPathBindingBuilder.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/JXPathBindingBuilderBase.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/JavaScriptJXPathBinding.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/JavaScriptJXPathBindingBuilder.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/MultiValueJXPathBinding.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/MultiValueJXPathBindingBuilder.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/NewJXPathBinding.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/NewJXPathBindingBuilder.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/RepeaterJXPathBinding.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/RepeaterJXPathBindingBuilder.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/SetAttributeJXPathBinding.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/SetAttributeJXPathBindingBuilder.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/SimpleRepeaterJXPathBinding.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/SimpleRepeaterJXPathBindingBuilder.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/StructJXPathBinding.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/StructJXPathBindingBuilder.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/TempRepeaterJXPathBinding.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/TempRepeaterJXPathBindingBuilder.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/UnionJXPathBinding.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/UnionJXPathBindingBuilder.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/ValueJXPathBinding.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/ValueJXPathBindingBuilder.java
    cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/util/DomHelper.java
    cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/form1_binding.xml
    cocoon/gsoc/mpfingsthorn/forms/samples/library/libraries/library_form1_binding.xml

Modified: cocoon/gsoc/mpfingsthorn/forms/WEB-INF/xconf/cocoon-forms.xconf
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/WEB-INF/xconf/cocoon-forms.xconf?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/WEB-INF/xconf/cocoon-forms.xconf (original)
+++ cocoon/gsoc/mpfingsthorn/forms/WEB-INF/xconf/cocoon-forms.xconf Thu Sep  1 15:27:56 2005
@@ -25,6 +25,7 @@
 
   <forms-binding logger="forms.binding">
     <bindings>
+      <binding name="expand" src="org.apache.cocoon.forms.binding.ExpandJXPathBindingBuilder"/>
       <binding name="import" src="org.apache.cocoon.forms.binding.ImportJXPathBindingBuilder"/>
       <binding name="group" src="org.apache.cocoon.forms.binding.GroupJXPathBindingBuilder"/>
       <binding name="value" src="org.apache.cocoon.forms.binding.ValueJXPathBindingBuilder"/>

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/AggregateJXPathBinding.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/AggregateJXPathBinding.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/AggregateJXPathBinding.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/AggregateJXPathBinding.java Thu Sep  1 15:27:56 2005
@@ -35,7 +35,8 @@
     private final String xpath;
 
     private final String widgetId;
-
+    
+    
     /**
      * Constructs AggregateJXPathBinding
      * @param widgetId
@@ -49,6 +50,12 @@
         this.widgetId = widgetId;
         this.xpath = xpath;
     }
+    
+    /**
+     * need accessors!
+     */
+    public String getXPath() { return xpath; }
+    public String getId() { return widgetId; }
 
     /**
      * Narrows the scope on the form-model to the member widget-field, and

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/AggregateJXPathBindingBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/AggregateJXPathBindingBuilder.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/AggregateJXPathBindingBuilder.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/AggregateJXPathBindingBuilder.java Thu Sep  1 15:27:56 2005
@@ -38,10 +38,25 @@
             throws BindingException {
         try {
             CommonAttributes commonAtts = JXPathBindingBuilderBase.getCommonAttributes(bindingElm);
-            String xpath = DomHelper.getAttribute(bindingElm, "path");
-            String widgetId = DomHelper.getAttribute(bindingElm, "id");
-
-            JXPathBindingBase[] childBindings = assistant.makeChildBindings(bindingElm);
+            String xpath = bindingElm.getAttribute("path");
+            String widgetId = bindingElm.getAttribute("id");
+            
+            JXPathBindingBase[] childBindings = new JXPathBindingBase[0];
+            
+//          do inheritance
+            AggregateJXPathBinding otherBinding = (AggregateJXPathBinding)assistant.getContext().getSuperBinding();
+            if(otherBinding!=null) {
+            	childBindings = otherBinding.getChildBindings();
+            	commonAtts = JXPathBindingBuilderBase.mergeCommonAttributes(otherBinding.getCommonAtts(),commonAtts);
+            	
+            	if(xpath==null)
+            		xpath = otherBinding.getXPath();
+            	if(widgetId==null)
+            		widgetId = otherBinding.getId();
+            }
+            
+            childBindings = assistant.makeChildBindings(bindingElm,childBindings);
+            
 
             AggregateJXPathBinding aggregateBinding = new AggregateJXPathBinding(commonAtts, widgetId, xpath, childBindings);
             return aggregateBinding;

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/CaseJXPathBinding.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/CaseJXPathBinding.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/CaseJXPathBinding.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/CaseJXPathBinding.java Thu Sep  1 15:27:56 2005
@@ -48,6 +48,12 @@
         this.widgetId = widgetId;
         this.xpath = xpath;
     }
+    
+    /**
+     * need accessors!
+     */
+    public String getXPath() { return xpath; }
+    public String getId() { return widgetId; }
 
     /**
      * Narrows the scope on the form-model to the member widget-field, and

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/CaseJXPathBindingBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/CaseJXPathBindingBuilder.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/CaseJXPathBindingBuilder.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/CaseJXPathBindingBuilder.java Thu Sep  1 15:27:56 2005
@@ -37,11 +37,25 @@
     public JXPathBindingBase buildBinding(Element bindingElm, JXPathBindingManager.Assistant assistant)
             throws BindingException {
         try {
-            String widgetId = DomHelper.getAttribute(bindingElm, "id");
+            String widgetId = bindingElm.getAttribute("id");
             CommonAttributes commonAtts = JXPathBindingBuilderBase.getCommonAttributes(bindingElm);
-            String xpath = DomHelper.getAttribute(bindingElm, "path");
+            String xpath = bindingElm.getAttribute("path");
 
-            JXPathBindingBase[] childBindings = assistant.makeChildBindings(bindingElm);
+            JXPathBindingBase[] childBindings = new JXPathBindingBase[0];
+            
+//          do inheritance
+            CaseJXPathBinding otherBinding = (CaseJXPathBinding)assistant.getContext().getSuperBinding();
+            if(otherBinding!=null) {
+            	childBindings = otherBinding.getChildBindings();
+            	commonAtts = JXPathBindingBuilderBase.mergeCommonAttributes(otherBinding.getCommonAtts(),commonAtts);
+            	
+            	if(xpath==null)
+            		xpath = otherBinding.getXPath();
+            	if(widgetId==null)
+            		widgetId = otherBinding.getId();
+            }
+            
+            childBindings = assistant.makeChildBindings(bindingElm,childBindings);
 
             CaseJXPathBinding caseBinding = new CaseJXPathBinding(commonAtts, widgetId, xpath, childBindings);
             return caseBinding;

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/ClassJXPathBindingBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/ClassJXPathBindingBuilder.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/ClassJXPathBindingBuilder.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/ClassJXPathBindingBuilder.java Thu Sep  1 15:27:56 2005
@@ -38,11 +38,24 @@
     public JXPathBindingBase buildBinding(Element bindingElm, JXPathBindingManager.Assistant assistant)
             throws BindingException {
         try {
-            String widgetId = DomHelper.getAttribute(bindingElm, "id");
+            String widgetId = bindingElm.getAttribute("id");
             CommonAttributes commonAtts = JXPathBindingBuilderBase.getCommonAttributes(bindingElm);
 
-            JXPathBindingBase[] childBindings = assistant.makeChildBindings(bindingElm);
+            JXPathBindingBase[] childBindings = new JXPathBindingBase[0]; 
+            
+//          do inheritance
+            ClassJXPathBinding otherBinding = (ClassJXPathBinding)assistant.getContext().getSuperBinding();
+            if(otherBinding!=null) {
+            	childBindings = otherBinding.getChildBindings();
+            	commonAtts = JXPathBindingBuilderBase.mergeCommonAttributes(otherBinding.getCommonAtts(),commonAtts);
+            	
+            	if(widgetId==null)
+            		widgetId = otherBinding.getId();
+            }
+            
+            childBindings = assistant.makeChildBindings(bindingElm,childBindings);
 
+            
             ClassJXPathBinding classBinding =
                 new ClassJXPathBinding(commonAtts, widgetId, childBindings);
             return classBinding;

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/ComposedJXPathBindingBase.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/ComposedJXPathBindingBase.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/ComposedJXPathBindingBase.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/ComposedJXPathBindingBase.java Thu Sep  1 15:27:56 2005
@@ -15,6 +15,7 @@
  */
 package org.apache.cocoon.forms.binding;
 
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
 
@@ -33,30 +34,46 @@
     private final JXPathBindingBase[] subBindings;
     
     
-    public static JXPathBindingBase[] mergeBindings(JXPathBindingBase[] one, JXPathBindingBase[] two) throws Exception {
+    public static JXPathBindingBase[] mergeBindings(JXPathBindingBase[] existing, JXPathBindingBase[] extra) throws Exception {
     	
-    	if(one == null || one.length == 0)
-    		return two;
+    	if(existing == null || existing.length == 0)
+    		return extra;
     	
-    	if(two == null || two.length == 0)
-    		return one;
+    	if(extra == null || extra.length == 0)
+    		return existing;
     	
-    	HashSet ids = new HashSet();
-    	JXPathBindingBase[] merged = new JXPathBindingBase[one.length + two.length];
-    	for(int i=0; i<one.length; i++) {
-    		merged[i] = one[i];
-    		ids.add(one[i].getId());
-    	}
-    	for(int i=0; i<two.length; i++) {
-    		
-    		if(two[i].getId()!=null && ids.contains(two[i].getId()))
-    			throw new Exception("Duplicate ID's detected!");
-    			
-    		merged[one.length +i] = two[i];
-    	}
-    	return merged;
+    	// have to do it the stupid painter way..
+    	ArrayList list = new ArrayList(existing.length);
+    	for(int i=0; i<existing.length; i++)
+    		list.add(existing[i]);
+    	
+    	for(int i=0; i<extra.length; i++) {
+    		if(extra[i].getId()==null)
+    			list.add(extra[i]);
+    		else {
+    			// try to replace existing one
+    			boolean match = false;
+    			for(int j=0; j<list.size(); j++) {
+    				if(extra[i].getId().equals(((JXPathBindingBase)list.get(j)).getId())) {
+    					list.set(j,extra[i]);
+    					match = true;
+    					break; // stop searching
+    				}
+    			}
+    			// if no match, just add
+    			if(!match)
+    				list.add(extra[i]);
+    		}
+    	}	
+    	
+    	return (JXPathBindingBase[])list.toArray(new JXPathBindingBase[0]);
     }
 
+    /**
+     * need accessors!
+     */
+    public String getXPath() { return null; }
+    
     /**
      * Constructs ComposedJXPathBindingBase
      *

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/ContextJXPathBinding.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/ContextJXPathBinding.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/ContextJXPathBinding.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/ContextJXPathBinding.java Thu Sep  1 15:27:56 2005
@@ -40,6 +40,13 @@
         super(commonAtts, childBindings);
         this.xpath = contextPath;
     }
+    
+    /**
+     * distinguishing id
+     */
+    public String getId() {
+    	return "Context:"+xpath;
+    }
 
     /**
      * Actively performs the binding from the ObjectModel wrapped in a jxpath
@@ -78,7 +85,7 @@
     }
     
     /** To allow child classes to know which path they bind to */
-    protected String getXPath() {
+    public String getXPath() {
         return this.xpath;
     }
 

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/ContextJXPathBindingBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/ContextJXPathBindingBuilder.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/ContextJXPathBindingBuilder.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/ContextJXPathBindingBuilder.java Thu Sep  1 15:27:56 2005
@@ -42,10 +42,22 @@
 
         try {
             CommonAttributes commonAtts = JXPathBindingBuilderBase.getCommonAttributes(bindingElm);
-            String xpath = DomHelper.getAttribute(bindingElm, "path");
-
-            JXPathBindingBase[] childBindings = assistant.makeChildBindings(bindingElm);
+            String xpath = bindingElm.getAttribute("path");
 
+            JXPathBindingBase[] childBindings = new JXPathBindingBase[0]; 
+            
+            // do inheritance
+            ContextJXPathBinding otherBinding = (ContextJXPathBinding)assistant.getContext().getSuperBinding();
+            if(otherBinding!=null) {
+            	childBindings = otherBinding.getChildBindings();
+            	commonAtts = JXPathBindingBuilderBase.mergeCommonAttributes(otherBinding.getCommonAtts(),commonAtts);
+            	
+            	if(xpath==null)
+            		xpath = otherBinding.getXPath();
+            }
+            
+            childBindings = assistant.makeChildBindings(bindingElm,childBindings);
+            
             ContextJXPathBinding contextBinding = new ContextJXPathBinding(commonAtts, xpath, childBindings);
             return contextBinding;
         } catch (BindingException e) {

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/CustomJXPathBinding.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/CustomJXPathBinding.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/CustomJXPathBinding.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/CustomJXPathBinding.java Thu Sep  1 15:27:56 2005
@@ -56,6 +56,13 @@
     }
     
     /**
+     * need accessors!
+     */
+    public String getXPath() { return xpath; }
+    public String getId() { return widgetId; }
+    public AbstractCustomBinding getWrappedBinding() { return wrappedBinding; }
+    
+    /**
      * Delegates the actual loading operation to the provided Custom Binding Class
      * after narrowing down on the selected widget (@id) and context (@path)
      * 

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/CustomJXPathBindingBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/CustomJXPathBindingBuilder.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/CustomJXPathBindingBuilder.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/CustomJXPathBindingBuilder.java Thu Sep  1 15:27:56 2005
@@ -75,7 +75,7 @@
             String xpath = DomHelper.getAttribute(bindingElm, "path", ".");
             String widgetId = DomHelper.getAttribute(bindingElm, "id", null);
 
-            Object bindingInstance;
+            Object bindingInstance = null;
             
             String className = DomHelper.getAttribute(bindingElm, "class", null);
             if(className != null) {
@@ -90,24 +90,40 @@
                 Element configNode = 
                     DomHelper.getChildElement(bindingElm, BindingManager.NAMESPACE, "config");
                 
-                Class builderClass = Class.forName(builderClassName);
-                Method factoryMethod = null; 
-                Object[] args = null;
-                try {
-                    factoryMethod = builderClass.getMethod(factoryMethodName, DOMELEMENT_METHODARGS);
-                    args = new Object[1];
-                    args[0] = configNode; 
-                } catch (NoSuchMethodException e) {
-                    factoryMethod = null;
+                // only do it if attributes exist
+                if(! (builderClassName == null || factoryMethodName == null) ) {
+	                Class builderClass = Class.forName(builderClassName);
+	                Method factoryMethod = null; 
+	                Object[] args = null;
+	                try {
+	                    factoryMethod = builderClass.getMethod(factoryMethodName, DOMELEMENT_METHODARGS);
+	                    args = new Object[1];
+	                    args[0] = configNode; 
+	                } catch (NoSuchMethodException e) {
+	                    factoryMethod = null;
+	                }
+	                
+	                if (factoryMethod == null) {
+	                    factoryMethod = builderClass.getMethod(factoryMethodName, EMPTY_METHODARGS);
+	                    args = null;
+	                }
+	                  
+	                // we pass null to indicate that the method should be static
+	                bindingInstance = factoryMethod.invoke(null, args);
                 }
-                
-                if (factoryMethod == null) {
-                    factoryMethod = builderClass.getMethod(factoryMethodName, EMPTY_METHODARGS);
-                    args = null;
-                }
-                  
-                // we pass null to indicate that the method should be static
-                bindingInstance = factoryMethod.invoke(null, args);
+            }
+            
+//          do inheritance
+            CustomJXPathBinding otherBinding = (CustomJXPathBinding)assistant.getContext().getSuperBinding();
+            if(otherBinding!=null) {
+            	commonAtts = JXPathBindingBuilderBase.mergeCommonAttributes(otherBinding.getCommonAtts(),commonAtts);
+            	
+            	if(xpath==null)
+            		xpath = otherBinding.getXPath();
+            	if(widgetId==null)
+            		widgetId = otherBinding.getId();
+            	if(bindingInstance==null)
+            		bindingInstance = otherBinding.getWrappedBinding();
             }
 
             CustomJXPathBinding customBinding = 

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/DeleteNodeJXPathBindingBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/DeleteNodeJXPathBindingBuilder.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/DeleteNodeJXPathBindingBuilder.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/DeleteNodeJXPathBindingBuilder.java Thu Sep  1 15:27:56 2005
@@ -38,6 +38,12 @@
     public JXPathBindingBase buildBinding(Element bindingElm, Assistant assistant) throws BindingException {
         CommonAttributes commonAtts = JXPathBindingBuilderBase.getCommonAttributes(bindingElm);
 
+//      do inheritance
+        DeleteNodeJXPathBinding otherBinding = (DeleteNodeJXPathBinding)assistant.getContext().getSuperBinding();
+        if(otherBinding!=null) {
+        	commonAtts = JXPathBindingBuilderBase.mergeCommonAttributes(otherBinding.getCommonAtts(),commonAtts);
+        }
+        
         return new DeleteNodeJXPathBinding(commonAtts);
     }
 }

Added: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/ExpandJXPathBindingBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/ExpandJXPathBindingBuilder.java?rev=265796&view=auto
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/ExpandJXPathBindingBuilder.java (added)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/ExpandJXPathBindingBuilder.java Thu Sep  1 15:27:56 2005
@@ -0,0 +1,51 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.forms.binding;
+
+import org.apache.cocoon.forms.binding.JXPathBindingManager.Assistant;
+import org.apache.cocoon.forms.binding.library.Library;
+import org.apache.cocoon.forms.binding.library.LibraryException;
+import org.apache.cocoon.forms.util.DomHelper;
+import org.w3c.dom.Element;
+
+/**
+ * @author Max Pfingsthorn (mpfingsthorn@hippo.nl)
+ *
+ */
+public class ExpandJXPathBindingBuilder extends JXPathBindingBuilderBase {
+
+	/* (non-Javadoc)
+	 * @see org.apache.cocoon.forms.binding.JXPathBindingBuilderBase#buildBinding(org.w3c.dom.Element, org.apache.cocoon.forms.binding.JXPathBindingManager.Assistant)
+	 */
+	public JXPathBindingBase buildBinding(Element bindingElm,
+			Assistant assistant) throws BindingException {
+
+		Library lib = assistant.getContext().getLocalLibrary();
+		
+		String id = bindingElm.getAttribute("id");
+		
+		if(id == null)
+			throw new BindingException("Attribute id is required! (at "+DomHelper.getLocation(bindingElm)+")");
+		
+		try {
+			return (JXPathBindingBase)lib.getBinding(id);
+		} catch(LibraryException e) {
+			throw new BindingException("Could not expand binding from library! (at "+DomHelper.getLocation(bindingElm)+")",e);
+		}
+		
+	}
+
+}

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/GroupJXPathBinding.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/GroupJXPathBinding.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/GroupJXPathBinding.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/GroupJXPathBinding.java Thu Sep  1 15:27:56 2005
@@ -46,6 +46,11 @@
     }
 
     /**
+     * need accessors!
+     */
+    public String getId() { return widgetId; }
+    
+    /**
      * Narrows the scope on the form-model to the member widget-field, and
      * narrows the scope on the object-model to the member xpath-context
      * before continuing the binding over the child-bindings.

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/GroupJXPathBindingBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/GroupJXPathBindingBuilder.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/GroupJXPathBindingBuilder.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/GroupJXPathBindingBuilder.java Thu Sep  1 15:27:56 2005
@@ -38,12 +38,26 @@
     public JXPathBindingBase buildBinding(Element bindingElm, JXPathBindingManager.Assistant assistant)
             throws BindingException {
         try {
-            String widgetId = DomHelper.getAttribute(bindingElm, "id");
+            String widgetId = DomHelper.getAttribute(bindingElm, "id",null);
             CommonAttributes commonAtts = JXPathBindingBuilderBase.getCommonAttributes(bindingElm);
-            String xpath = DomHelper.getAttribute(bindingElm, "path");
+            String xpath = DomHelper.getAttribute(bindingElm, "path",null);
 
-            JXPathBindingBase[] childBindings = assistant.makeChildBindings(bindingElm);
+            JXPathBindingBase[] childBindings = new JXPathBindingBase[0];
 
+//          do inheritance
+            GroupJXPathBinding otherBinding = (GroupJXPathBinding)assistant.getContext().getSuperBinding();
+            if(otherBinding!=null) {
+            	childBindings = otherBinding.getChildBindings();
+            	commonAtts = JXPathBindingBuilderBase.mergeCommonAttributes(otherBinding.getCommonAtts(),commonAtts);
+            	
+            	if(xpath==null)
+            		xpath = otherBinding.getXPath();
+            	if(widgetId==null)
+            		widgetId = otherBinding.getId();
+            }
+            
+            childBindings = assistant.makeChildBindings(bindingElm, childBindings);
+            
             GroupJXPathBinding groupBinding =
                 new GroupJXPathBinding(commonAtts, widgetId, xpath, childBindings);
             return groupBinding;

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/InsertBeanJXPathBinding.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/InsertBeanJXPathBinding.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/InsertBeanJXPathBinding.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/InsertBeanJXPathBinding.java Thu Sep  1 15:27:56 2005
@@ -46,6 +46,12 @@
         this.className = className;
         this.addMethodName = addMethod;
     }
+    
+    /**
+     * need accessors!
+     */
+    public String getClassName() { return className; }
+    public String getAddMethodName() { return addMethodName; }
 
     /**
      * Do-nothing implementation of the interface.

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/InsertBeanJXPathBindingBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/InsertBeanJXPathBindingBuilder.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/InsertBeanJXPathBindingBuilder.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/InsertBeanJXPathBindingBuilder.java Thu Sep  1 15:27:56 2005
@@ -48,8 +48,19 @@
             String className =
                 DomHelper.getAttribute(bindingElm, "classname", null);
             String addMethod =
-                DomHelper.getAttribute(bindingElm, "addmethod");
+                DomHelper.getAttribute(bindingElm, "addmethod",null);
 
+//          do inheritance
+            InsertBeanJXPathBinding otherBinding = (InsertBeanJXPathBinding)assistant.getContext().getSuperBinding();
+            if(otherBinding!=null) {
+            	commonAtts = JXPathBindingBuilderBase.mergeCommonAttributes(otherBinding.getCommonAtts(),commonAtts);
+            	
+            	if(className==null)
+            		className = otherBinding.getClassName();
+            	if(addMethod==null)
+            		addMethod = otherBinding.getAddMethodName();
+            }
+            
             return new InsertBeanJXPathBinding(commonAtts, className, addMethod);
         } catch (BindingException e) {
             throw e;

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/InsertNodeJXPathBinding.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/InsertNodeJXPathBinding.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/InsertNodeJXPathBinding.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/InsertNodeJXPathBinding.java Thu Sep  1 15:27:56 2005
@@ -44,6 +44,11 @@
         super(commonAtts);
         this.template = domTemplate;
     }
+    
+    /**
+     * need accessors!
+     */
+    public DocumentFragment getTemplate() { return template; }
 
     /**
      * Do-nothing implementation of the interface.

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/InsertNodeJXPathBindingBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/InsertNodeJXPathBindingBuilder.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/InsertNodeJXPathBindingBuilder.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/InsertNodeJXPathBindingBuilder.java Thu Sep  1 15:27:56 2005
@@ -89,13 +89,22 @@
                     }
                     manager.release(sourceResolver);
                 }
-            } else {
+            } else if(bindingElm.hasChildNodes()) {
                 domTemplate = bindingElm.getOwnerDocument().createDocumentFragment();
                 NodeList nested = bindingElm.getChildNodes();
                 int size = nested.getLength();
                 for (int i = 0; i < size; i++) {
                     domTemplate.appendChild(nested.item(i).cloneNode(true));
                 }
+            }
+            
+//          do inheritance
+            InsertNodeJXPathBinding otherBinding = (InsertNodeJXPathBinding)assistant.getContext().getSuperBinding();
+            if(otherBinding!=null) {
+            	commonAtts = JXPathBindingBuilderBase.mergeCommonAttributes(otherBinding.getCommonAtts(),commonAtts);
+            	
+            	if(domTemplate==null)
+            		domTemplate = otherBinding.getTemplate();
             }
 
             return new InsertNodeJXPathBinding(commonAtts, domTemplate);

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/JXPathBindingBuilderBase.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/JXPathBindingBuilderBase.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/JXPathBindingBuilderBase.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/JXPathBindingBuilderBase.java Thu Sep  1 15:27:56 2005
@@ -141,6 +141,29 @@
             throw new BindingException("Error building binding defined at " + DomHelper.getLocation(bindingElm), e);
         }
      }
+    
+    public static CommonAttributes mergeCommonAttributes(CommonAttributes existing, CommonAttributes extra) {
+    	
+    	if (extra == null)
+    		return existing;
+    	
+    	Boolean leniency = null;
+    	if(existing.leniency==null)
+    		leniency = extra.leniency;
+    	else
+    		leniency = existing.leniency;
+    	
+    	String strLeniency = null;
+    	if(leniency != null)
+    		strLeniency = leniency.toString();
+    	
+    	String direction = existing.direction;
+    	if(extra.direction!=null) // was defined
+    		direction = extra.direction;
+    	
+    	
+    	return new CommonAttributes(extra.location,direction,strLeniency,extra.nsDeclarations);
+    }
 
      /**
       * CommonAttributes is a simple helper class for holding the distinct data
@@ -149,6 +172,10 @@
       */
      protected static class CommonAttributes{
 
+    	/**
+    	 * store direction (load/save enabledness) too for easier merging
+    	 */
+    	String direction;
         /**
          * Source location of this binding.
          */
@@ -175,9 +202,11 @@
 
         CommonAttributes(String location, String direction, String leniency, Map nsDeclarations){
             this(location, isLoadEnabled(direction), isSaveEnabled(direction), decideLeniency(leniency), nsDeclarations);
+            this.direction = direction;
         }
 
         CommonAttributes(String location, boolean loadEnabled, boolean saveEnabled, Boolean leniency, Map nsDeclarations){
+        	this.direction = null;
             this.location = location;
             this.loadEnabled = loadEnabled;
             this.saveEnabled = saveEnabled;

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java Thu Sep  1 15:27:56 2005
@@ -246,11 +246,22 @@
         }
 
         /**
+         * proxy for compatibility
+         * 
+         */
+        public JXPathBindingBase[] makeChildBindings(Element parentElement) throws BindingException {
+        	return makeChildBindings(parentElement,new JXPathBindingBase[0]);
+        }
+        
+        /**
          * Makes an array of childBindings for the child-elements of the
          * provided configuration element.
          */
-        public JXPathBindingBase[] makeChildBindings(Element parentElement)
+        public JXPathBindingBase[] makeChildBindings(Element parentElement, JXPathBindingBase[] existingBindings)
                 throws BindingException {
+        	if (existingBindings == null)
+        		existingBindings = new JXPathBindingBase[0];
+        	
             if (parentElement != null) {
                 Element[] childElements = DomHelper.getChildElements(
                         parentElement, BindingManager.NAMESPACE);
@@ -260,9 +271,15 @@
                     	
                     	pushContext();
                     	
+                    	String id = childElements[i].getAttribute("id");
+                    	String path = childElements[i].getAttribute("path");
                     	if(context.getLocalLibrary()!=null && childElements[i].getAttribute("extends")!=null) {
                     		try {
                     			context.setSuperBinding(context.getLocalLibrary().getBinding(childElements[i].getAttribute("extends")));
+                    			
+                    			if(context.getSuperBinding() == null) // not found in library
+                    				context.setSuperBinding(getBindingByIdOrPath(id,path,existingBindings));
+                    			
                     		} catch(LibraryException e) {
                     			throw new RuntimeException("Error extending binding! (at "+DomHelper.getLocation(childElements[i])+")",e);
                     		}
@@ -280,6 +297,19 @@
             return null;
         }
 
+        private JXPathBindingBase getBindingByIdOrPath(String id, String path, JXPathBindingBase[] bindings) {
+        	String name = id;
+        	if(name == null) {
+        		name = "Context:"+path;
+        	}
+        		
+        	for(int i=0; i<bindings.length; i++) {
+        		if(name.equals(bindings[i].getId()))
+        			return bindings[i];
+        	}
+        	return null;
+        }
+        
         public DatatypeManager getDatatypeManager() {
             return datatypeManager;
         }

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/JavaScriptJXPathBinding.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/JavaScriptJXPathBinding.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/JavaScriptJXPathBinding.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/JavaScriptJXPathBinding.java Thu Sep  1 15:27:56 2005
@@ -42,6 +42,7 @@
     private final Function loadScript;
     private final Function saveScript;
     private final Scriptable childBindings;
+    private final Map childBindingsMap;
     
     final static String[] LOAD_PARAMS = { "widget", "jxpathPointer", "jxpathContext", "childBindings" };
     final static String[] SAVE_PARAMS = { "widget", "jxpathPointer", "jxpathContext", "childBindings" };
@@ -60,9 +61,20 @@
         for(Iterator iter = childBindings.values().iterator(); iter.hasNext(); ) {
         	    ((Binding)iter.next()).setParent(this);
         }
-
+        
+        this.childBindingsMap = childBindings;
         this.childBindings = new ScriptableMap(childBindings);
     }
+    
+    /**
+     * need accessors!
+     */
+    public String getPath() { return path; }
+    public String getId() { return id; }
+    public Context getContext() { return avalonContext; }
+    public Function getLoadScript() { return loadScript; }
+    public Function getSaveScript() { return saveScript; }
+    public Map getChildBindingsMap() { return childBindingsMap; }
 
     public void doLoad(Widget frmModel, JXPathContext jctx) {
         if (this.loadScript != null) {

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/JavaScriptJXPathBindingBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/JavaScriptJXPathBindingBuilder.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/JavaScriptJXPathBindingBuilder.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/JavaScriptJXPathBindingBuilder.java Thu Sep  1 15:27:56 2005
@@ -17,6 +17,7 @@
 
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.Map;
 
 import org.apache.avalon.framework.context.Context;
@@ -79,49 +80,72 @@
         try {
             CommonAttributes commonAtts = JXPathBindingBuilderBase.getCommonAttributes(element);
 
-            String id = DomHelper.getAttribute(element, "id");
-            String path = DomHelper.getAttribute(element, "path");
+            String id = DomHelper.getAttribute(element, "id", null);
+            String path = DomHelper.getAttribute(element, "path", null);
 
+            JavaScriptJXPathBinding otherBinding = (JavaScriptJXPathBinding)assistant.getContext().getSuperBinding();
+            
+            if(otherBinding!=null) {
+            	commonAtts = JXPathBindingBuilderBase.mergeCommonAttributes(otherBinding.getCommonAtts(),commonAtts);
+            	
+            	if(id==null)
+            		id=otherBinding.getId();
+            	if(path==null)
+            		path=otherBinding.getPath();
+            }
+            
             // Build load script
             Function loadScript = null;
             if (commonAtts.loadEnabled) {
+                if (otherBinding != null)
+                	loadScript = otherBinding.getLoadScript();
+            	
                 Element loadElem = DomHelper.getChildElement(element, BindingManager.NAMESPACE, "load-form");
-                if (loadElem == null) {
-                    throw new BindingException("Element \"load-form\" is missing (" +
-                        DomHelper.getLocation(element) + ")");
+                if (loadElem != null) {
+                	loadScript = JavaScriptHelper.buildFunction(loadElem, "loadForm", JavaScriptJXPathBinding.LOAD_PARAMS);
                 }
-                loadScript = JavaScriptHelper.buildFunction(loadElem, "loadForm", JavaScriptJXPathBinding.LOAD_PARAMS);
             }
 
             // Build save script
             Function saveScript = null;
             if (commonAtts.saveEnabled) {
+            	if (otherBinding != null)
+            		saveScript = otherBinding.getSaveScript();
+            	
                 Element saveElem = DomHelper.getChildElement(element, BindingManager.NAMESPACE, "save-form");
-                if (saveElem == null) {
-                    throw new BindingException("Element \"save-form\" is missing (" +
-                        DomHelper.getLocation(element) + ")");
+                if (saveElem != null) {
+                	saveScript = JavaScriptHelper.buildFunction(saveElem, "saveForm", JavaScriptJXPathBinding.SAVE_PARAMS);
                 }
-                saveScript = JavaScriptHelper.buildFunction(saveElem, "saveForm", JavaScriptJXPathBinding.SAVE_PARAMS);
             }
 
             // Build child bindings
-            Map childBindings;
+            Map childBindings = new HashMap();
+            
+            if (otherBinding != null) {
+            	Map otherChildren = otherBinding.getChildBindingsMap();
+            	Iterator it = otherChildren.entrySet().iterator();
+            	while(it.hasNext()) {
+            		Map.Entry entry = (Map.Entry)it.next();
+            		childBindings.put(entry.getKey(),entry.getValue());
+            	}
+            }
+            
             Element[] children = DomHelper.getChildElements(element, BindingManager.NAMESPACE, "child-binding");
-            if (children.length == 0) {
-                childBindings = Collections.EMPTY_MAP;
-            } else {
-                childBindings = new HashMap();
+            if (children.length != 0) {
                 for (int i = 0; i < children.length; i++) {
                     Element child = children[i];
 
                     // Get the binding name and check its uniqueness
                     String name = DomHelper.getAttribute(child, "name");
+                    
+                    JXPathBindingBase[] otherBindings = null;
                     if (childBindings.containsKey(name)) {
-                        throw new BindingException("Duplicate name '" + name + "' at " + DomHelper.getLocation(child));
+                        //throw new BindingException("Duplicate name '" + name + "' at " + DomHelper.getLocation(child));
+                    	otherBindings = ((ComposedJXPathBindingBase)childBindings.get(name)).getChildBindings();
                     }
-
+                    
                     // Build the child binding
-                    JXPathBindingBase[] bindings = assistant.makeChildBindings(child);
+                    JXPathBindingBase[] bindings = assistant.makeChildBindings(child,otherBindings);
                     if (bindings == null) {
                         bindings = new JXPathBindingBase[0];
                     }

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/MultiValueJXPathBinding.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/MultiValueJXPathBinding.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/MultiValueJXPathBinding.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/MultiValueJXPathBinding.java Thu Sep  1 15:27:56 2005
@@ -53,6 +53,16 @@
         this.convertor = convertor;
         this.convertorLocale = convertorLocale;
     }
+    
+    /**
+     * accessors, maybe make them package private?
+     */
+    public String getId() { return multiValueId; }
+    public String getMultiValuePath() { return multiValuePath; }
+    public String getRowPath() { return rowPath; }
+    public ComposedJXPathBindingBase getUpdateBinding() { return (ComposedJXPathBindingBase)updateBinding; }
+    public Convertor getConvertor() { return convertor; }
+    public Locale getLocale() { return convertorLocale; }
 
     public void doLoad(Widget frmModel, JXPathContext jctx) throws BindingException {
         Widget widget = selectWidget(frmModel,this.multiValueId);

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/MultiValueJXPathBindingBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/MultiValueJXPathBindingBuilder.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/MultiValueJXPathBindingBuilder.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/MultiValueJXPathBindingBuilder.java Thu Sep  1 15:27:56 2005
@@ -49,19 +49,16 @@
         try {
             CommonAttributes commonAtts = JXPathBindingBuilderBase.getCommonAttributes(bindingElem);
 
-            String multiValueId = DomHelper.getAttribute(bindingElem, "id");
-            String parentPath = DomHelper.getAttribute(bindingElem, "parent-path");
-            String rowPath = DomHelper.getAttribute(bindingElem, "row-path");
-
-            Element updateWrapElement =
-                DomHelper.getChildElement(bindingElem, BindingManager.NAMESPACE, "on-update");
-            JXPathBindingBase[] updateBindings = assistant.makeChildBindings(updateWrapElement);
+            String multiValueId = DomHelper.getAttribute(bindingElem, "id", null);
+            String parentPath = DomHelper.getAttribute(bindingElem, "parent-path", null);
+            String rowPath = DomHelper.getAttribute(bindingElem, "row-path", null);
 
+            
             Convertor convertor = null;
             Locale convertorLocale = Locale.US;
             Element convertorEl = DomHelper.getChildElement(bindingElem, Constants.DEFINITION_NS, "convertor");
             if (convertorEl != null) {
-                String datatype = DomHelper.getAttribute(convertorEl, "datatype");
+                String datatype = DomHelper.getAttribute(convertorEl, "datatype", null);
                 String localeStr = convertorEl.getAttribute("locale");
                 if (localeStr != null && !localeStr.equals("")) {
                     convertorLocale = I18nUtils.parseLocale(localeStr);
@@ -69,6 +66,30 @@
 
                 convertor = assistant.getDatatypeManager().createConvertor(datatype, convertorEl);
             }
+            
+            MultiValueJXPathBinding existingBinding = (MultiValueJXPathBinding)assistant.getContext().getSuperBinding();
+            JXPathBindingBase[] existingBindings = new JXPathBindingBase[0]; 
+            if(existingBinding != null) {
+            	commonAtts = JXPathBindingBuilderBase.mergeCommonAttributes(existingBinding.getCommonAtts(),commonAtts);
+            	existingBindings = existingBinding.getUpdateBinding().getChildBindings();
+            	
+            	if(multiValueId == null)
+            		multiValueId = existingBinding.getId();
+            	if(parentPath == null)
+            		parentPath = existingBinding.getMultiValuePath();
+            	if(rowPath == null)
+            		rowPath = existingBinding.getRowPath();
+            	
+            	if(convertor == null) {
+            		convertor = existingBinding.getConvertor();
+            		convertorLocale = existingBinding.getLocale();
+            	}	
+            }
+            
+            Element updateWrapElement =
+                DomHelper.getChildElement(bindingElem, BindingManager.NAMESPACE, "on-update");
+            JXPathBindingBase[] updateBindings = assistant.makeChildBindings(updateWrapElement,existingBindings);
+
 
             return new MultiValueJXPathBinding( commonAtts, multiValueId, parentPath, rowPath,
                                                 updateBindings, convertor, convertorLocale);

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/NewJXPathBinding.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/NewJXPathBinding.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/NewJXPathBinding.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/NewJXPathBinding.java Thu Sep  1 15:27:56 2005
@@ -47,6 +47,11 @@
         this.widgetId = widgetId;
         this.classBinding = null;
     }
+    
+    /**
+     * need accessors!
+     */
+    public String getId() { return widgetId; }
 
     /**
      * Recursively resolves references.

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/NewJXPathBindingBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/NewJXPathBindingBuilder.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/NewJXPathBindingBuilder.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/NewJXPathBindingBuilder.java Thu Sep  1 15:27:56 2005
@@ -38,11 +38,23 @@
     public JXPathBindingBase buildBinding(Element bindingElm, JXPathBindingManager.Assistant assistant)
             throws BindingException {
         try {
-            String widgetId = DomHelper.getAttribute(bindingElm, "id");
+            String widgetId = DomHelper.getAttribute(bindingElm, "id", null);
             CommonAttributes commonAtts = JXPathBindingBuilderBase.getCommonAttributes(bindingElm);
 
-            JXPathBindingBase[] childBindings = assistant.makeChildBindings(bindingElm);
+            JXPathBindingBase[] childBindings = new JXPathBindingBase[0];
 
+//          do inheritance
+            NewJXPathBinding otherBinding = (NewJXPathBinding)assistant.getContext().getSuperBinding();
+            if(otherBinding!=null) {
+            	childBindings = otherBinding.getChildBindings();
+            	commonAtts = JXPathBindingBuilderBase.mergeCommonAttributes(otherBinding.getCommonAtts(),commonAtts);
+            	
+            	if(widgetId==null)
+            		widgetId = otherBinding.getId();
+            }
+            
+            childBindings = assistant.makeChildBindings(bindingElm,childBindings);
+            
             NewJXPathBinding newBinding = new NewJXPathBinding(commonAtts, widgetId, childBindings);
             return newBinding;
         } catch (BindingException e) {

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/RepeaterJXPathBinding.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/RepeaterJXPathBinding.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/RepeaterJXPathBinding.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/RepeaterJXPathBinding.java Thu Sep  1 15:27:56 2005
@@ -81,13 +81,29 @@
             this.deleteRowBinding = null;
         }
 
-        this.identityBinding = new ComposedJXPathBindingBase(
+        
+        if (identityBindings != null) {
+        	
+        	this.identityBinding = new ComposedJXPathBindingBase(
                                        JXPathBindingBuilderBase.CommonAttributes.DEFAULT,
                                        identityBindings);
-        if (this.identityBinding != null) {
-            this.identityBinding.setParent(this);
+        	this.identityBinding.setParent(this);
         }
+        else
+        	this.identityBinding = null;
     }
+    
+    /**
+     * accessors
+     */
+    public String getId() { return repeaterId; }
+    public String getRepeaterPath() { return repeaterPath; }
+    public String getRowPath() { return rowPath; }
+    public String getInsertRowPath() { return rowPathForInsert; }
+    public ComposedJXPathBindingBase getRowBinding() { return (ComposedJXPathBindingBase)rowBinding; }
+    public ComposedJXPathBindingBase getDeleteRowBinding() { return (ComposedJXPathBindingBase)deleteRowBinding; }
+    public ComposedJXPathBindingBase getIdentityBinding() { return (ComposedJXPathBindingBase)identityBinding; }
+    public JXPathBindingBase getInsertRowBinding() { return insertRowBinding; }
 
     /**
      * Binds the unique-id of the repeated rows, and narrows the context on

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/RepeaterJXPathBindingBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/RepeaterJXPathBindingBuilder.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/RepeaterJXPathBindingBuilder.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/RepeaterJXPathBindingBuilder.java Thu Sep  1 15:27:56 2005
@@ -68,29 +68,54 @@
             CommonAttributes commonAtts =
                 JXPathBindingBuilderBase.getCommonAttributes(bindingElm);
 
-            String repeaterId = DomHelper.getAttribute(bindingElm, "id");
+            String repeaterId = DomHelper.getAttribute(bindingElm, "id", null);
             String parentPath =
-                DomHelper.getAttribute(bindingElm, "parent-path");
-            String rowPath = DomHelper.getAttribute(bindingElm, "row-path");
+                DomHelper.getAttribute(bindingElm, "parent-path", null);
+            String rowPath = DomHelper.getAttribute(bindingElm, "row-path", null);
             String rowPathForInsert =
                 DomHelper.getAttribute(bindingElm, "row-path-insert", rowPath);
+            
+//          do inheritance
+            RepeaterJXPathBinding otherBinding = (RepeaterJXPathBinding)assistant.getContext().getSuperBinding();
+            JXPathBindingBase[] existingOnBind = null;
+            JXPathBindingBase[] existingOnDelete = null;
+            JXPathBindingBase[] existingOnInsert = null;
+            JXPathBindingBase[] existingIdentity = null;
+            if(otherBinding!=null) {
+            	commonAtts = JXPathBindingBuilderBase.mergeCommonAttributes(otherBinding.getCommonAtts(),commonAtts);
+            	
+            	if(repeaterId==null)
+            		repeaterId = otherBinding.getId();
+            	if(parentPath==null)
+            		parentPath = otherBinding.getRepeaterPath();
+            	if(rowPath==null)
+            		rowPath = otherBinding.getRowPath();
+            	if(rowPathForInsert==null)
+            		rowPathForInsert = otherBinding.getInsertRowPath();
+            	
+            	existingOnBind = otherBinding.getRowBinding().getChildBindings();
+            	existingOnDelete = otherBinding.getDeleteRowBinding().getChildBindings();
+            	existingIdentity = otherBinding.getIdentityBinding().getChildBindings();
+            	if(otherBinding.getInsertRowBinding() != null)
+            		existingOnInsert = new JXPathBindingBase[] { otherBinding.getInsertRowBinding() };
+            }
 
             Element childWrapElement =
                 DomHelper.getChildElement(bindingElm, BindingManager.NAMESPACE, "on-bind");
-            if (childWrapElement == null) {
-                throw new BindingException(
-                      "RepeaterBinding misses '<on-bind>' child definition. " +
-                      DomHelper.getLocation(bindingElm));
-            }
+            
             JXPathBindingBase[] childBindings =
-                assistant.makeChildBindings(childWrapElement);
+                assistant.makeChildBindings(childWrapElement,existingOnBind);
+            if(childBindings == null)
+            	childBindings = existingOnBind;
 
             Element deleteWrapElement = DomHelper.getChildElement(bindingElm,
                     BindingManager.NAMESPACE, "on-delete-row");
             JXPathBindingBase[] deleteBindings = null;
             if (deleteWrapElement != null) {
                 deleteBindings =
-                    assistant.makeChildBindings(deleteWrapElement);
+                    assistant.makeChildBindings(deleteWrapElement,existingOnDelete);
+                if(deleteBindings == null)
+                	deleteBindings = existingOnDelete;
             }
 
             Element insertWrapElement = DomHelper.getChildElement(bindingElm,
@@ -98,10 +123,12 @@
             JXPathBindingBase insertBinding = null;
             if (insertWrapElement != null) {
                 insertBinding =
-                    assistant.makeChildBindings(insertWrapElement)[0];
+                    assistant.makeChildBindings(insertWrapElement,existingOnInsert)[0];
                     // TODO: we now safely take only the first element here,
                     // but we should in fact send out a warning to the log 
                     // if more were available!
+                if(insertBinding == null && existingOnInsert != null)
+                	insertBinding = existingOnInsert[0];
             }
 
             Element identityWrapElement = DomHelper.getChildElement(bindingElm,
@@ -111,7 +138,7 @@
                 // TODO: we can only handle ValueJXPathBinding at the moment:
                 // http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=107906438632484&w=4
                 identityBinding =
-                    assistant.makeChildBindings(identityWrapElement);
+                    assistant.makeChildBindings(identityWrapElement,existingIdentity);
                 if (identityBinding != null) {
                     for (int i = 0; i < identityBinding.length;i++) {
                         if (!(identityBinding[i] instanceof ValueJXPathBinding)) {
@@ -122,6 +149,8 @@
                                     " if you want to know more on this.");
                         }
                     }
+                } else {
+                	identityBinding = existingIdentity;
                 }
             }
 

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/SetAttributeJXPathBinding.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/SetAttributeJXPathBinding.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/SetAttributeJXPathBinding.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/SetAttributeJXPathBinding.java Thu Sep  1 15:27:56 2005
@@ -41,6 +41,12 @@
         this.name = attName;
         this.value = attValue;
     }
+    
+    /**
+     * accessors
+     */
+    public String getId() { return name; }
+    public String getValue() { return value; }
 
     /**
      * Do-Nothing implementation.

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/SetAttributeJXPathBindingBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/SetAttributeJXPathBindingBuilder.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/SetAttributeJXPathBindingBuilder.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/SetAttributeJXPathBindingBuilder.java Thu Sep  1 15:27:56 2005
@@ -45,9 +45,20 @@
             CommonAttributes commonAtts =
                 JXPathBindingBuilderBase.getCommonAttributes(bindingElm);
 
-            String attName = DomHelper.getAttribute(bindingElm, "name");
-            String attValue = DomHelper.getAttribute(bindingElm, "value");
+            String attName = DomHelper.getAttribute(bindingElm, "name", null);
+            String attValue = DomHelper.getAttribute(bindingElm, "value", null);
 
+            // do inheritance
+            SetAttributeJXPathBinding otherBinding = (SetAttributeJXPathBinding)assistant.getContext().getSuperBinding();
+            if(otherBinding!=null) {
+            	commonAtts = JXPathBindingBuilderBase.mergeCommonAttributes(otherBinding.getCommonAtts(),commonAtts);
+            	
+            	if(attName==null)
+            		attName = otherBinding.getId();
+            	if(attValue==null)
+            		attValue = otherBinding.getValue();
+            }
+            
             SetAttributeJXPathBinding attBinding =
                 new SetAttributeJXPathBinding(commonAtts, attName, attValue);
             return attBinding;

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/SimpleRepeaterJXPathBinding.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/SimpleRepeaterJXPathBinding.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/SimpleRepeaterJXPathBinding.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/SimpleRepeaterJXPathBinding.java Thu Sep  1 15:27:56 2005
@@ -56,6 +56,16 @@
         this.clearOnLoad = clearOnLoad;
         this.deleteIfEmpty = deleteIfEmpty;
     }
+    
+    /**
+     * accessors
+     */
+    public String getId() { return repeaterId; }
+    public String getRepeaterPath() { return repeaterPath; }
+    public String getRowPath() { return rowPath; }
+    public boolean getClearOnLoad() { return clearOnLoad; }
+    public boolean getDeleteIfEmpty() { return deleteIfEmpty; }
+    public JXPathBindingBase[] getChildBindings() { return ((ComposedJXPathBindingBase)rowBinding).getChildBindings(); }
 
     public void doLoad(Widget frmModel, JXPathContext jctx)
             throws BindingException {

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/SimpleRepeaterJXPathBindingBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/SimpleRepeaterJXPathBindingBuilder.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/SimpleRepeaterJXPathBindingBuilder.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/SimpleRepeaterJXPathBindingBuilder.java Thu Sep  1 15:27:56 2005
@@ -41,17 +41,36 @@
             CommonAttributes commonAtts =
                 JXPathBindingBuilderBase.getCommonAttributes(bindingElem);
 
-            String repeaterId = DomHelper.getAttribute(bindingElem, "id");
+            String repeaterId = DomHelper.getAttribute(bindingElem, "id", null);
             String parentPath = DomHelper.getAttribute(
-                    bindingElem, "parent-path");
-            String rowPath = DomHelper.getAttribute(bindingElem, "row-path");
+                    bindingElem, "parent-path", null);
+            String rowPath = DomHelper.getAttribute(bindingElem, "row-path", null);
             boolean clearOnLoad = DomHelper.getAttributeAsBoolean(
                     bindingElem, "clear-before-load", true);
             boolean deleteIfEmpty = DomHelper.getAttributeAsBoolean(
                     bindingElem, "delete-parent-if-empty", false);
 
-            JXPathBindingBase[] childBindings =
-                assistant.makeChildBindings(bindingElem);
+            JXPathBindingBase[] childBindings = null;
+            
+            // do inheritance
+            SimpleRepeaterJXPathBinding otherBinding = (SimpleRepeaterJXPathBinding)assistant.getContext().getSuperBinding();
+            if(otherBinding!=null) {
+            	childBindings = otherBinding.getChildBindings();
+            	commonAtts = JXPathBindingBuilderBase.mergeCommonAttributes(otherBinding.getCommonAtts(),commonAtts);
+            	
+            	if(parentPath==null)
+            		parentPath = otherBinding.getRepeaterPath();
+            	if(repeaterId==null)
+            		repeaterId = otherBinding.getId();
+            	if(rowPath==null)
+            		rowPath = otherBinding.getRowPath();
+            	if(bindingElem.getAttribute("clear-before-load")==null)
+            		clearOnLoad = otherBinding.getClearOnLoad();
+            	if(bindingElem.getAttribute("delete-parent-if-empty")==null)
+            		deleteIfEmpty = otherBinding.getDeleteIfEmpty();
+            }
+            
+            childBindings = assistant.makeChildBindings(bindingElem, childBindings);
 
             return new SimpleRepeaterJXPathBinding(commonAtts, repeaterId,
                     parentPath, rowPath, clearOnLoad, deleteIfEmpty,

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/StructJXPathBinding.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/StructJXPathBinding.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/StructJXPathBinding.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/StructJXPathBinding.java Thu Sep  1 15:27:56 2005
@@ -44,6 +44,11 @@
         super(commonAtts, xpath, childBindings);
         this.widgetId = widgetId;
     }
+    
+    /**
+     * need accessors!
+     */
+    public String getId() { return widgetId; }
 
     /**
      * Narrows the scope on the form-model to the member widget-field, and

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/StructJXPathBindingBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/StructJXPathBindingBuilder.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/StructJXPathBindingBuilder.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/StructJXPathBindingBuilder.java Thu Sep  1 15:27:56 2005
@@ -44,8 +44,22 @@
             CommonAttributes commonAtts = JXPathBindingBuilderBase.getCommonAttributes(bindingElm);
             String xpath = DomHelper.getAttribute(bindingElm, "path");
 
-            JXPathBindingBase[] childBindings = assistant.makeChildBindings(bindingElm);
+            JXPathBindingBase[] childBindings = new JXPathBindingBase[0];
 
+//          do inheritance
+            StructJXPathBinding otherBinding = (StructJXPathBinding)assistant.getContext().getSuperBinding();
+            if(otherBinding!=null) {
+            	childBindings = otherBinding.getChildBindings();
+            	commonAtts = JXPathBindingBuilderBase.mergeCommonAttributes(otherBinding.getCommonAtts(),commonAtts);
+            	
+            	if(xpath==null)
+            		xpath = otherBinding.getXPath();
+            	if(widgetId==null)
+            		widgetId = otherBinding.getId();
+            }
+            
+            childBindings = assistant.makeChildBindings(bindingElm,childBindings);
+            
             StructJXPathBinding structBinding =
                 new StructJXPathBinding(commonAtts, widgetId, xpath, childBindings);
             return structBinding;

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/TempRepeaterJXPathBinding.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/TempRepeaterJXPathBinding.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/TempRepeaterJXPathBinding.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/TempRepeaterJXPathBinding.java Thu Sep  1 15:27:56 2005
@@ -67,6 +67,19 @@
         this.clearOnLoad = clearOnLoad;
         this.deleteIfEmpty = deleteIfEmpty;
     }
+    
+    /**
+     * accessors
+     */
+    public String getId() { return repeaterId; }
+    public String getRepeaterPath() { return repeaterPath; }
+    public String getRowPath() { return rowPath; }
+    public String getRowPathInsert() { return rowPathInsert; }
+    public boolean getVirtualRows() { return virtualRows; }
+    public boolean getClearOnLoad() { return clearOnLoad; }
+    public boolean getDeleteIfEmpty() { return deleteIfEmpty; }
+    public JXPathBindingBase[] getChildBindings() { return ((ComposedJXPathBindingBase)rowBinding).getChildBindings(); }
+    public JXPathBindingBase[] getInsertChildBindings() { return ((ComposedJXPathBindingBase)insertRowBinding).getChildBindings(); }
 
     public void doLoad(Widget frmModel, JXPathContext jctx) throws BindingException {
         // (There should be a general widget type checker for all the bindings to use,

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/TempRepeaterJXPathBindingBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/TempRepeaterJXPathBindingBuilder.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/TempRepeaterJXPathBindingBuilder.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/TempRepeaterJXPathBindingBuilder.java Thu Sep  1 15:27:56 2005
@@ -40,10 +40,10 @@
         try {
             CommonAttributes commonAtts = JXPathBindingBuilderBase.getCommonAttributes(bindingElem);
 
-            String repeaterId = DomHelper.getAttribute(bindingElem, "id");
+            String repeaterId = DomHelper.getAttribute(bindingElem, "id", null);
             String parentPath = DomHelper.getAttribute(bindingElem,
-                    "parent-path");
-            String rowPath = DomHelper.getAttribute(bindingElem, "row-path");
+                    "parent-path", null);
+            String rowPath = DomHelper.getAttribute(bindingElem, "row-path", null);
             String rowPathInsert = DomHelper.getAttribute(bindingElem,
                     "row-path-insert", rowPath);
             boolean virtualRows = DomHelper.getAttributeAsBoolean(
@@ -53,17 +53,42 @@
             boolean deleteIfEmpty = DomHelper.getAttributeAsBoolean(
                     bindingElem, "delete-parent-if-empty", false);
 
+            JXPathBindingBase[] insertBindings = null;
+            JXPathBindingBase[] childBindings = null;
+            
+            // do inheritance
+            TempRepeaterJXPathBinding otherBinding = (TempRepeaterJXPathBinding)assistant.getContext().getSuperBinding();
+            if(otherBinding!=null) {
+            	childBindings = otherBinding.getChildBindings();
+            	insertBindings = otherBinding.getInsertChildBindings();
+            	commonAtts = JXPathBindingBuilderBase.mergeCommonAttributes(otherBinding.getCommonAtts(),commonAtts);
+            	
+            	if(parentPath==null)
+            		parentPath = otherBinding.getRepeaterPath();
+            	if(repeaterId==null)
+            		repeaterId = otherBinding.getId();
+            	if(rowPath==null)
+            		rowPath = otherBinding.getRowPath();
+            	if(rowPathInsert==null)
+            		rowPathInsert = otherBinding.getRowPathInsert();
+            	if(bindingElem.getAttribute("virtual-rows")==null)
+            		clearOnLoad = otherBinding.getVirtualRows();
+            	if(bindingElem.getAttribute("clear-before-load")==null)
+            		clearOnLoad = otherBinding.getClearOnLoad();
+            	if(bindingElem.getAttribute("delete-parent-if-empty")==null)
+            		deleteIfEmpty = otherBinding.getDeleteIfEmpty();
+            }
+            
             Element childWrapElement = DomHelper.getChildElement(
                     bindingElem, BindingManager.NAMESPACE, "on-bind");
-            JXPathBindingBase[] childBindings =
-                    assistant.makeChildBindings(childWrapElement);
+            childBindings = assistant.makeChildBindings(childWrapElement,childBindings);
 
             Element insertWrapElement = DomHelper.getChildElement(bindingElem,
                     BindingManager.NAMESPACE, "on-insert-row");
-            JXPathBindingBase[] insertBindings = null;
+            
             if (insertWrapElement != null) {
                 insertBindings =
-                    assistant.makeChildBindings(insertWrapElement);
+                    assistant.makeChildBindings(insertWrapElement,insertBindings);
             }
             return new TempRepeaterJXPathBinding(commonAtts, repeaterId,
                     parentPath, rowPath, rowPathInsert, virtualRows,

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/UnionJXPathBinding.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/UnionJXPathBinding.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/UnionJXPathBinding.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/UnionJXPathBinding.java Thu Sep  1 15:27:56 2005
@@ -48,6 +48,12 @@
         this.widgetId = widgetId;
         this.xpath = xpath;
     }
+    
+    /**
+     * need accessors!
+     */
+    public String getXPath() { return xpath; }
+    public String getId() { return widgetId; }
 
     /**
      * Narrows the scope on the form-model to the member widget-field, and

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/UnionJXPathBindingBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/UnionJXPathBindingBuilder.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/UnionJXPathBindingBuilder.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/UnionJXPathBindingBuilder.java Thu Sep  1 15:27:56 2005
@@ -37,12 +37,26 @@
     public JXPathBindingBase buildBinding(Element bindingElm, JXPathBindingManager.Assistant assistant)
             throws BindingException {
         try {
-            String widgetId = DomHelper.getAttribute(bindingElm, "id");
+            String widgetId = DomHelper.getAttribute(bindingElm, "id", null);
             CommonAttributes commonAtts = JXPathBindingBuilderBase.getCommonAttributes(bindingElm);
-            String xpath = DomHelper.getAttribute(bindingElm, "path");
+            String xpath = DomHelper.getAttribute(bindingElm, "path", null);
 
-            JXPathBindingBase[] childBindings = assistant.makeChildBindings(bindingElm);
+            JXPathBindingBase[] childBindings = new JXPathBindingBase[0];
 
+//          do inheritance
+            UnionJXPathBinding otherBinding = (UnionJXPathBinding)assistant.getContext().getSuperBinding();
+            if(otherBinding!=null) {
+            	childBindings = otherBinding.getChildBindings();
+            	commonAtts = JXPathBindingBuilderBase.mergeCommonAttributes(otherBinding.getCommonAtts(),commonAtts);
+            	
+            	if(xpath==null)
+            		xpath = otherBinding.getXPath();
+            	if(widgetId==null)
+            		widgetId = otherBinding.getId();
+            }
+            
+            childBindings = assistant.makeChildBindings(bindingElm,childBindings);
+            
             UnionJXPathBinding unionBinding = new UnionJXPathBinding(commonAtts, widgetId, xpath, childBindings);
             return unionBinding;
         } catch (BindingException e) {

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/ValueJXPathBinding.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/ValueJXPathBinding.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/ValueJXPathBinding.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/ValueJXPathBinding.java Thu Sep  1 15:27:56 2005
@@ -75,6 +75,12 @@
         this.convertor = convertor;
         this.convertorLocale = convertorLocale;
     }
+    
+    /**
+     * accessors
+     */
+    public String getId() { return fieldId; }
+    public ComposedJXPathBindingBase getUpdateBinding() { return (ComposedJXPathBindingBase)updateBinding; }
 
     /**
      * Actively performs the binding from the ObjectModel wrapped in a jxpath

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/ValueJXPathBindingBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/ValueJXPathBindingBuilder.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/ValueJXPathBindingBuilder.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/binding/ValueJXPathBindingBuilder.java Thu Sep  1 15:27:56 2005
@@ -49,12 +49,8 @@
 
         try {
             CommonAttributes commonAtts = JXPathBindingBuilderBase.getCommonAttributes(bindingElm);
-            String xpath = DomHelper.getAttribute(bindingElm, "path");
-            String widgetId = DomHelper.getAttribute(bindingElm, "id");
-
-            Element updateWrapElement =
-                DomHelper.getChildElement(bindingElm, BindingManager.NAMESPACE, "on-update");
-            JXPathBindingBase[] updateBindings = assistant.makeChildBindings(updateWrapElement);
+            String xpath = DomHelper.getAttribute(bindingElm, "path", null);
+            String widgetId = DomHelper.getAttribute(bindingElm, "id", null);
 
             Convertor convertor = null;
             Locale convertorLocale = Locale.US;
@@ -68,6 +64,30 @@
 
                 convertor = assistant.getDatatypeManager().createConvertor(datatype, convertorEl);
             }
+            
+            // do inheritance
+            ValueJXPathBinding otherBinding = (ValueJXPathBinding)assistant.getContext().getSuperBinding();
+            JXPathBindingBase[] existingUpdateBindings = null;
+            if(otherBinding!=null) {
+            	commonAtts = JXPathBindingBuilderBase.mergeCommonAttributes(otherBinding.getCommonAtts(),commonAtts);
+            	
+            	if(xpath==null)
+            		xpath = otherBinding.getXPath();
+            	if(widgetId==null)
+            		widgetId = otherBinding.getId();
+            	if(convertor==null)
+            		convertor = otherBinding.getConvertor();
+            	if(convertorLocale==null)
+            		convertorLocale = otherBinding.getConvertorLocale();
+            	if(convertorLocale==null)
+            		convertorLocale = otherBinding.getConvertorLocale();
+            	
+            	existingUpdateBindings = otherBinding.getUpdateBinding().getChildBindings();
+            }
+            
+            Element updateWrapElement =
+                DomHelper.getChildElement(bindingElm, BindingManager.NAMESPACE, "on-update");
+            JXPathBindingBase[] updateBindings = assistant.makeChildBindings(updateWrapElement,existingUpdateBindings);
 
             ValueJXPathBinding fieldBinding =
                     new ValueJXPathBinding(commonAtts,

Modified: cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/util/DomHelper.java
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/util/DomHelper.java?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/util/DomHelper.java (original)
+++ cocoon/gsoc/mpfingsthorn/forms/java/org/apache/cocoon/forms/util/DomHelper.java Thu Sep  1 15:27:56 2005
@@ -181,7 +181,7 @@
     public static String getAttribute(Element element, String attributeName, 
             String defaultValue) throws Exception {
         String attrValue = element.getAttribute(attributeName);
-        if (attrValue.equals("")) {
+        if (attrValue == null || attrValue.equals("")) {
             return defaultValue;
         }
         return attrValue;

Modified: cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/form1_binding.xml
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/form1_binding.xml?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/form1_binding.xml (original)
+++ cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/form1_binding.xml Thu Sep  1 15:27:56 2005
@@ -23,7 +23,7 @@
   
   <fb:new id="lib:class1"/>
   
-  <fb:value id="field2" path="field2"/>
-  <fb:value id="field3" path="field3"/>
+  <fb:expand id="lib:field2"/>
+  <fb:value id="field3" path="field3" extends="lib:field2"/>
   
 </fb:context>

Modified: cocoon/gsoc/mpfingsthorn/forms/samples/library/libraries/library_form1_binding.xml
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/samples/library/libraries/library_form1_binding.xml?rev=265796&r1=265795&r2=265796&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/samples/library/libraries/library_form1_binding.xml (original)
+++ cocoon/gsoc/mpfingsthorn/forms/samples/library/libraries/library_form1_binding.xml Thu Sep  1 15:27:56 2005
@@ -8,4 +8,6 @@
     <fb:value id="field1" path="field1"/>
   </fb:class>
   
+  <fb:value id="field2" path="field2"/>
+  
 </fb:library>