cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject svn commit: r450255 [2/3] - in /cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding: ./ library/
Date Tue, 26 Sep 2006 23:48:46 GMT
Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/InsertNodeJXPathBindingBuilder.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/InsertNodeJXPathBindingBuilder.java?view=diff&rev=450255&r1=450254&r2=450255
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/InsertNodeJXPathBindingBuilder.java (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/InsertNodeJXPathBindingBuilder.java Tue Sep 26 16:48:43 2006
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You 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.
@@ -17,12 +17,14 @@
 package org.apache.cocoon.forms.binding;
 
 import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.cocoon.components.source.SourceUtil;
-import org.apache.cocoon.forms.util.DomHelper;
-import org.apache.cocoon.util.location.LocationAttributes;
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceResolver;
 import org.apache.excalibur.xml.xpath.XPathProcessor;
+
+import org.apache.cocoon.components.source.SourceUtil;
+import org.apache.cocoon.forms.util.DomHelper;
+import org.apache.cocoon.util.location.LocationAttributes;
+
 import org.w3c.dom.Document;
 import org.w3c.dom.DocumentFragment;
 import org.w3c.dom.Element;
@@ -43,16 +45,15 @@
  *
  * @version $Id$
  */
-public class InsertNodeJXPathBindingBuilder
-    extends JXPathBindingBuilderBase {
+public class InsertNodeJXPathBindingBuilder extends JXPathBindingBuilderBase {
 
     /**
      * Creates an instance of {@link InsertNodeJXPathBinding} configured
      * with the nested template of the bindingElm.
      */
-    public JXPathBindingBase buildBinding(
-        Element bindingElm,
-        JXPathBindingManager.Assistant assistant) throws BindingException {
+    public JXPathBindingBase buildBinding(Element bindingElm,
+                                          JXPathBindingManager.Assistant assistant)
+    throws BindingException {
 
         try {
             CommonAttributes commonAtts = JXPathBindingBuilderBase.getCommonAttributes(bindingElm);
@@ -105,14 +106,15 @@
                     domTemplate.appendChild(node);
                 }
             }
-            
-//          do inheritance
-            InsertNodeJXPathBinding otherBinding = (InsertNodeJXPathBinding)assistant.getContext().getSuperBinding();
-            if(otherBinding!=null) {
-            	commonAtts = JXPathBindingBuilderBase.mergeCommonAttributes(otherBinding.getCommonAtts(),commonAtts);
-            	
-            	if(domTemplate==null)
-            		domTemplate = otherBinding.getTemplate();
+
+            // 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/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/JXPathBindingBase.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/JXPathBindingBase.java?view=diff&rev=450255&r1=450254&r2=450255
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/JXPathBindingBase.java (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/JXPathBindingBase.java Tue Sep 26 16:48:43 2006
@@ -21,12 +21,14 @@
 import java.util.Map;
 
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
+
 import org.apache.cocoon.forms.binding.library.Library;
 import org.apache.cocoon.forms.formmodel.Widget;
 import org.apache.cocoon.util.jxpath.DOMFactory;
+
+import org.apache.commons.jxpath.AbstractFactory;
 import org.apache.commons.jxpath.JXPathContext;
 import org.apache.commons.jxpath.Pointer;
-import org.apache.commons.jxpath.AbstractFactory;
 import org.apache.commons.jxpath.ri.model.beans.BeanPropertyPointer;
 import org.apache.commons.jxpath.util.TypeUtils;
 import org.apache.commons.lang.exception.NestableRuntimeException;
@@ -38,15 +40,14 @@
  *
  * @version $Id$
  */
-public abstract class JXPathBindingBase
-    extends AbstractLogEnabled
-    implements Binding {
+public abstract class JXPathBindingBase extends AbstractLogEnabled
+                                        implements Binding {
 
     /**
      * the local library, if this is the top binding
      */
     private Library enclosingLibrary;
-    
+
     /**
      * Object holding the values of the common objects on all Bindings.
      */
@@ -62,45 +63,43 @@
      */
     protected Map classes;
 
-    private JXPathBindingBase() {
-        this(JXPathBindingBuilderBase.CommonAttributes.DEFAULT);
-    }
 
-    protected JXPathBindingBase(
-            JXPathBindingBuilderBase.CommonAttributes commonAtts) {
+    protected JXPathBindingBase(JXPathBindingBuilderBase.CommonAttributes commonAtts) {
         this.commonAtts = commonAtts;
     }
-    
+
     public Library getEnclosingLibrary() {
-    	if(parent != null) {
-    		return parent.getEnclosingLibrary();
-    	} else {
-    		return enclosingLibrary;
-    	}
+        if (parent != null) {
+            return parent.getEnclosingLibrary();
+        } else {
+            return enclosingLibrary;
+        }
     }
+
     public void setEnclosingLibrary(Library lib) {
     	this.enclosingLibrary = lib;
     }
-    
+
     public boolean isValid() {
-    	if(this.enclosingLibrary!=null) {
-    		if(parent!=null)
-    			return parent.isValid();
-    		return true; // no library used
-    	} else {
-    		try {
-    			return !this.enclosingLibrary.dependenciesHaveChanged();
-    		} catch(Exception e) {
-    			getLogger().error("Error checking dependencies!",e);
-    			throw new NestableRuntimeException("Error checking dependencies!",e);
-    		}
-    	}
+        if (this.enclosingLibrary != null) {
+            if (parent != null) {
+                return parent.isValid();
+            }
+            return true; // no library used
+        }
+
+        try {
+            return !this.enclosingLibrary.dependenciesHaveChanged();
+        } catch (Exception e) {
+            getLogger().error("Error checking dependencies!", e);
+            throw new NestableRuntimeException("Error checking dependencies!", e);
+        }
     }
-    
+
     public JXPathBindingBuilderBase.CommonAttributes getCommonAtts() {
     	return this.commonAtts;
     }
-    
+
     /**
      * Gets source location of this binding.
      */
@@ -123,18 +122,19 @@
     }
 
     public Binding getClass(String id) {
-        
+
         Binding classBinding = null;
-        
         try {
-            if(this.enclosingLibrary!=null && (classBinding = this.enclosingLibrary.getBinding(id))!=null)
+            if (this.enclosingLibrary != null && (classBinding = this.enclosingLibrary.getBinding(id)) != null) {
                 return classBinding;
-        } catch(Exception ignore) {}
-        
+            }
+        } catch (Exception e) { /* ignored */ }
+
         if (classes != null) {
             // Query cache for class
             classBinding = (Binding)classes.get(id);
         }
+
         if (classBinding == null) {
             // Query parent for class
             if (parent != null) {
@@ -151,29 +151,29 @@
                 throw new RuntimeException("Class \"" + id + "\" not found (" + getLocation() + ")");
             }
         }
+
         return classBinding;
     }
 
     /**
      * Helper method that selects a child-widget with a given id from a parent.
-     *  
-     * @param parent containing the child-widget to return. 
+     *
+     * @param parent containing the child-widget to return.
      * @param id of the childWidget to find, if this is <code>null</code> then the parent is returned.
      * @return the selected widget
-     * 
-     * @throws RuntimeException  if the id is not null and points to a 
-     *   child-widget that cannot be found. 
+     *
+     * @throws RuntimeException  if the id is not null and points to a
+     *   child-widget that cannot be found.
      */
     protected Widget selectWidget(Widget parent, String id) {
-        if (id == null) return parent;
-        
-        Widget childWidget = null;
-        
-        childWidget = parent.lookupWidget(id);
-            
+        if (id == null) {
+            return parent;
+        }
+
+        Widget childWidget = parent.lookupWidget(id);
         if (childWidget == null) {
             String containerId = parent.getRequestParameterName();
-            if(containerId == null || "".equals(containerId)) {
+            if (containerId == null || "".equals(containerId)) {
                 containerId = "top-level form-widget";
             } else {
                 containerId = "container \"" + containerId + "\"";
@@ -182,7 +182,7 @@
                     id + "\" does not exist in the " + containerId +
                     " (" + parent.getLocation() + ").");
         }
-        
+
         return childWidget;
     }
 
@@ -191,7 +191,7 @@
      * Abstract method that subclasses need to implement for specific activity.
      */
     public abstract void doLoad(Widget frmModel, JXPathContext jxpc)
-        throws BindingException;
+    throws BindingException;
 
     /**
      * Redefines the Binding action as working on a JXPathContext Type rather
@@ -233,7 +233,7 @@
      * Abstract method that subclasses need to implement for specific activity.
      */
     public abstract void doSave(Widget frmModel, JXPathContext jxpc)
-            throws BindingException;
+    throws BindingException;
 
     /**
      * Redefines the Binding action as working on a JXPathContext Type rather
@@ -242,7 +242,7 @@
      * depending on the configured value of the "direction" attribute.
      */
     public final void saveFormToModel(Widget frmModel, JXPathContext jxpc)
-            throws BindingException{
+    throws BindingException{
         boolean inheritedLeniency = jxpc.isLenient();
         applyLeniency(jxpc);
         applyNSDeclarations(jxpc);
@@ -260,10 +260,10 @@
      * @see org.apache.cocoon.forms.binding.Binding#saveFormToModel(org.apache.cocoon.forms.formmodel.Widget, java.lang.Object)
      */
     public void saveFormToModel(Widget frmModel, Object objModel)
-                throws BindingException {
+    throws BindingException {
         if (objModel != null) {
             JXPathContext jxpc = makeJXPathContext(objModel);
-            saveFormToModel(frmModel, jxpc);    
+            saveFormToModel(frmModel, jxpc);
         } else {
             throw new NullPointerException(
                     "null object passed to saveFormToModel() method");
@@ -276,13 +276,10 @@
         }
     }
 
-    private void applyNSDeclarations(JXPathContext jxpc)
-    {
-        if (this.commonAtts.nsDeclarations != null)
-        {
+    private void applyNSDeclarations(JXPathContext jxpc) {
+        if (this.commonAtts.nsDeclarations != null) {
             Iterator keysIter = this.commonAtts.nsDeclarations.keySet().iterator();
-            while (keysIter.hasNext())
-            {
+            while (keysIter.hasNext()) {
                 String nsuri = (String) keysIter.next();
                 String pfx = (String) this.commonAtts.nsDeclarations.get(nsuri);
                 jxpc.registerNamespace(pfx, nsuri);
@@ -312,25 +309,25 @@
      * JXPath factory that combines the DOMFactory and support for collections.
      */
     private static class BindingJXPathFactory extends DOMFactory {
-        
+
         public boolean createObject(JXPathContext context, Pointer pointer, Object parent, String name, int index) {
             if (createCollectionItem(context, pointer, parent, name, index)) {
                 return true;
-            // AG: If this is a bean, then the object is supposed to exists.  
+            // AG: If this is a bean, then the object is supposed to exists.
             } else if (pointer instanceof BeanPropertyPointer) {
                 return createBeanField(context, pointer, parent, name, index);
             } else {
                 return super.createObject(context, pointer, parent, name, index);
             }
         }
-        
+
         private boolean createCollectionItem(JXPathContext context, Pointer pointer, Object parent, String name, int index) {
             // FIXME: don't clearly understand how this works.
             // see http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=111148567029114&w=2
             final Object o = context.getValue(name);
             if (o == null) {
                 return false;
-            } 
+            }
             if (o instanceof Collection) {
                 ((Collection)o).add(null);
             } else if(o.getClass().isArray()) {

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/JXPathBindingBuilderBase.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/JXPathBindingBuilderBase.java?view=diff&rev=450255&r1=450254&r2=450255
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/JXPathBindingBuilderBase.java (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/JXPathBindingBuilderBase.java Tue Sep 26 16:48:43 2006
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You 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.
@@ -20,9 +20,11 @@
 
 import org.apache.avalon.framework.logger.LogEnabled;
 import org.apache.avalon.framework.logger.Logger;
+
 import org.apache.cocoon.forms.util.DomHelper;
-import org.apache.commons.lang.BooleanUtils;
+
 import org.apache.commons.jxpath.AbstractFactory;
+import org.apache.commons.lang.BooleanUtils;
 import org.w3c.dom.Element;
 
 /**
@@ -43,6 +45,7 @@
 
     private Logger logger;
 
+
     /**
      * Receives the Avalon logger to use.
      */
@@ -52,7 +55,7 @@
             logger.debug("JXPathBindingBuilderBase got logger...");
         }
     }
-    
+
 
     /**
      * Makes the logger available to the subclasses.
@@ -71,9 +74,9 @@
      * @param assistant
      * @return JXPathBindingBase
      */
-    public abstract JXPathBindingBase buildBinding(
-        Element bindingElm,
-        JXPathBindingManager.Assistant assistant) throws BindingException;
+    public abstract JXPathBindingBase buildBinding(Element bindingElm,
+                                                   JXPathBindingManager.Assistant assistant)
+    throws BindingException;
 
     /**
      * Helper method for interpreting the common attributes which are supported
@@ -116,13 +119,13 @@
 
             String leniency = DomHelper.getAttribute(bindingElm, "lenient", null);
 
-            //TODO: current jxpath is not inheriting registered namespaces over to 
-            // child-relative jxpath contexts --> because of that we can't just 
-            // remember the getLocalNSDeclarations but need the full set from 
+            //TODO: current jxpath is not inheriting registered namespaces over to
+            // child-relative jxpath contexts --> because of that we can't just
+            // remember the getLocalNSDeclarations but need the full set from
             // getInheritedNSDeclarations
             // IMPORTANT NOTE: if jxpath would change this behaviour we would however
-            // still need to be able to unregister namespace-declarations 
-            // (in a smart way: unhide what is possably available from your parent.   
+            // still need to be able to unregister namespace-declarations
+            // (in a smart way: unhide what is possably available from your parent.
             // So both changes to jxpath need to be available before changing the below.
             Map nsDeclarationMap = DomHelper.getInheritedNSDeclarations(bindingElm);
             // we (actually jxpath) doesn't support un-prefixed namespace-declarations:
@@ -141,7 +144,7 @@
                     throw new BindingException("Error with specified jxpath factory " + jxPathFactoryName, e);
                 }
             }
-            
+
             return new CommonAttributes(location, direction, leniency, nsDeclarationMap, jxPathFactory);
         } catch (BindingException e) {
             throw e;
@@ -149,45 +152,45 @@
             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;
+
+    	if (extra == null) {
+            return existing;
+        }
+
+        Boolean leniency;
+        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;
 
         AbstractFactory jxPathFactory = existing.jxPathFactory;
         if (extra.jxPathFactory != null)
             jxPathFactory = extra.jxPathFactory;
 
-
-        return new CommonAttributes(extra.location,direction,strLeniency,extra.nsDeclarations, jxPathFactory);
+        return new CommonAttributes(extra.location, direction, strLeniency, extra.nsDeclarations, jxPathFactory);
     }
 
-     /**
-      * CommonAttributes is a simple helper class for holding the distinct data
-      * member fields indicating the activity of the separate load and save
-      * actions of a given binding.
-      */
-     public static class CommonAttributes{
-
-    	/**
-    	 * store direction (load/save enabledness) too for easier merging
-    	 */
-    	String direction;
+    /**
+     * CommonAttributes is a simple helper class for holding the distinct data
+     * member fields indicating the activity of the separate load and save
+     * actions of a given binding.
+     */
+    public static class CommonAttributes{
+
+        /**
+         * store direction (load/save enabledness) too for easier merging
+         */
+        String direction;
         /**
          * Source location of this binding.
          */
@@ -201,29 +204,30 @@
          */
         final boolean saveEnabled;
         /**
-         * Flag which controls whether the jxpath context used by this binding 
-         * should be operating in lenient mode or not 
+         * Flag which controls whether the jxpath context used by this binding
+         * should be operating in lenient mode or not
          */
         final Boolean leniency;
         /**
-         * Array of namespace-declarations (prefix-uri pairs) that need to be set on the jxpath 
+         * Array of namespace-declarations (prefix-uri pairs) that need to be set on the jxpath
          */
         final Map nsDeclarations;
-         /**
-          * The factory to be set on the JXPath Context object
-          */
+        /**
+         * The factory to be set on the JXPath Context object
+         */
         final AbstractFactory jxPathFactory;
 
         final static CommonAttributes DEFAULT = new CommonAttributes("location unknown", true, true, null, null, null);
 
-        CommonAttributes(String location, String direction, String leniency, Map nsDeclarations, AbstractFactory jxPathFactory){
+        CommonAttributes(String location, String direction, String leniency,
+                         Map nsDeclarations, AbstractFactory jxPathFactory){
             this(location, isLoadEnabled(direction), isSaveEnabled(direction), decideLeniency(leniency), nsDeclarations, jxPathFactory);
             this.direction = direction;
         }
 
         CommonAttributes(String location, boolean loadEnabled, boolean saveEnabled, Boolean leniency,
-                Map nsDeclarations, AbstractFactory jxPathFactory){
-        	this.direction = null;
+                         Map nsDeclarations, AbstractFactory jxPathFactory){
+            this.direction = null;
             this.location = location;
             this.loadEnabled = loadEnabled;
             this.saveEnabled = saveEnabled;

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java?view=diff&rev=450255&r1=450254&r2=450255
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java Tue Sep 26 16:48:43 2006
@@ -32,6 +32,9 @@
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.Serviceable;
 import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.excalibur.source.Source;
+import org.apache.excalibur.source.SourceResolver;
+
 import org.apache.cocoon.components.LifecycleHelper;
 import org.apache.cocoon.forms.CacheManager;
 import org.apache.cocoon.forms.binding.library.Library;
@@ -42,9 +45,8 @@
 import org.apache.cocoon.forms.util.DomHelper;
 import org.apache.cocoon.forms.util.SimpleServiceSelector;
 import org.apache.cocoon.util.location.LocationAttributes;
+
 import org.apache.commons.lang.exception.NestableRuntimeException;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceResolver;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.xml.sax.InputSource;
@@ -56,9 +58,9 @@
  *
  * @version $Id$
  */
-public class JXPathBindingManager extends AbstractLogEnabled implements
-BindingManager, Contextualizable, Serviceable, Disposable, Initializable, Configurable,
-ThreadSafe {
+public class JXPathBindingManager extends AbstractLogEnabled
+                                  implements BindingManager, Contextualizable, Serviceable,
+                                             Configurable, Initializable, Disposable, ThreadSafe {
 
     private static final String PREFIX = "CocoonFormBinding:";
 
@@ -76,6 +78,7 @@
 
     protected LibraryManagerImpl libraryManager;
 
+
     public void contextualize(Context context) throws ContextException {
         this.avalonContext = context;
     }
@@ -92,8 +95,7 @@
     }
 
     public void initialize() throws Exception {
-        bindingBuilderSelector = new SimpleServiceSelector("binding",
-                JXPathBindingBuilderBase.class);
+        bindingBuilderSelector = new SimpleServiceSelector("binding", JXPathBindingBuilderBase.class);
         LifecycleHelper.setupComponent(bindingBuilderSelector,
                 getLogger(),
                 this.avalonContext,
@@ -202,7 +204,7 @@
 
         private BindingBuilderContext context = new BindingBuilderContext();
         private Stack contextStack = new Stack();
-        
+
         private JXPathBindingBuilderBase getBindingBuilder(String bindingType)
         throws BindingException {
             try {
@@ -219,8 +221,8 @@
          * Creates a {@link Binding} following the specification in the
          * provided config element.
          */
-        public JXPathBindingBase getBindingForConfigurationElement(
-                Element configElm) throws BindingException {
+        public JXPathBindingBase getBindingForConfigurationElement(Element configElm)
+        throws BindingException {
             String bindingType = configElm.getLocalName();
             JXPathBindingBuilderBase bindingBuilder = getBindingBuilder(bindingType);
 
@@ -289,13 +291,13 @@
                         list.add(extra[i]);
                     }
                 }
-            }	
+            }
             return (JXPathBindingBase[])list.toArray(new JXPathBindingBase[list.size()]);
         }
 
         /**
          * proxy for compatibility
-         * 
+         *
          */
         public JXPathBindingBase[] makeChildBindings(Element parentElement) throws BindingException {
             return makeChildBindings(parentElement,new JXPathBindingBase[0]);
@@ -377,8 +379,8 @@
         }
 
         private void popContext() {
-            if(!contextStack.empty()) {
-                context = (BindingBuilderContext)contextStack.pop();
+            if (!contextStack.empty()) {
+                context = (BindingBuilderContext) contextStack.pop();
             } else {
                 context = new BindingBuilderContext();
             }

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/JavaScriptJXPathBinding.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/JavaScriptJXPathBinding.java?view=diff&rev=450255&r1=450254&r2=450255
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/JavaScriptJXPathBinding.java (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/JavaScriptJXPathBinding.java Tue Sep 26 16:48:43 2006
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You 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.
@@ -21,10 +21,12 @@
 
 import org.apache.avalon.framework.CascadingRuntimeException;
 import org.apache.avalon.framework.context.Context;
+
 import org.apache.cocoon.components.ContextHelper;
 import org.apache.cocoon.components.flow.javascript.ScriptableMap;
 import org.apache.cocoon.forms.formmodel.Widget;
 import org.apache.cocoon.forms.util.JavaScriptHelper;
+
 import org.apache.commons.jxpath.JXPathContext;
 import org.apache.commons.jxpath.Pointer;
 import org.mozilla.javascript.Function;
@@ -36,6 +38,9 @@
  */
 public class JavaScriptJXPathBinding extends JXPathBindingBase {
 
+    final static String[] LOAD_PARAMS = { "widget", "jxpathPointer", "jxpathContext", "childBindings" };
+    final static String[] SAVE_PARAMS = { "widget", "jxpathPointer", "jxpathContext", "childBindings" };
+
     private final Context avalonContext;
     private final String id;
     private final String path;
@@ -43,29 +48,31 @@
     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" };
 
-    public JavaScriptJXPathBinding(
-    	    Context context, JXPathBindingBuilderBase.CommonAttributes commonAtts, String id,
-            String path, Function loadScript, Function saveScript, Map childBindings) {
+
+    public JavaScriptJXPathBinding(Context context,
+                                   JXPathBindingBuilderBase.CommonAttributes commonAtts,
+                                   String id,
+                                   String path,
+                                   Function loadScript,
+                                   Function saveScript,
+                                   Map childBindings) {
         super(commonAtts);
         this.id = id;
         this.path = path;
         this.loadScript = loadScript;
         this.saveScript = saveScript;
         this.avalonContext = context;
-        
+
         // Set parent on child bindings
-        for(Iterator iter = childBindings.values().iterator(); iter.hasNext(); ) {
-        	    ((Binding)iter.next()).setParent(this);
+        for (Iterator i = childBindings.values().iterator(); i.hasNext();) {
+            ((Binding) i.next()).setParent(this);
         }
-        
+
         this.childBindingsMap = childBindings;
         this.childBindings = new ScriptableMap(childBindings);
     }
-    
+
     public String getPath() { return path; }
     public String getId() { return id; }
     public Context getContext() { return avalonContext; }
@@ -75,36 +82,36 @@
 
     public void doLoad(Widget frmModel, JXPathContext jctx) {
         if (this.loadScript != null) {
-            Widget widget = selectWidget(frmModel,this.id);
-    
+            Widget widget = selectWidget(frmModel, this.id);
+
             // Move to widget context
             Pointer pointer = jctx.getPointer(this.path);
-    
+
             Map objectModel = ContextHelper.getObjectModel(this.avalonContext);
 
             try {
                 JXPathContext newCtx = pointer.getNode() == null ? null :
-                	    jctx.getRelativeContext(pointer);
+                        jctx.getRelativeContext(pointer);
 
                 JavaScriptHelper.callFunction(this.loadScript, widget,
-                		new Object[] {widget, pointer, newCtx, this.childBindings}, objectModel);
-    
-            } catch(RuntimeException re) {
+                        new Object[]{widget, pointer, newCtx, this.childBindings}, objectModel);
+
+            } catch (RuntimeException re) {
                 // rethrow
                 throw re;
-            } catch(Exception e) {
+            } catch (Exception e) {
                 throw new CascadingRuntimeException("Error invoking JavaScript event handler", e);
             }
         } else {
-            if (this.getLogger().isInfoEnabled()) {
-                this.getLogger().info("[Javascript Binding] - loadForm: No javascript code available. Widget id=" + this.getId());
+            if (getLogger().isInfoEnabled()) {
+                getLogger().info("[Javascript Binding] - loadForm: No javascript code available. Widget id=" + this.getId());
             }
         }
     }
 
     public void doSave(Widget frmModel, JXPathContext jctx) throws BindingException {
         if (this.saveScript != null) {
-            Widget widget = selectWidget(frmModel,this.id);
+            Widget widget = selectWidget(frmModel, this.id);
 
             // Move to widget context and create the path if needed
             Pointer pointer = jctx.createPath(this.path);
@@ -113,17 +120,17 @@
                 Map objectModel = ContextHelper.getObjectModel(this.avalonContext);
 
                 JavaScriptHelper.callFunction(this.saveScript, widget,
-                		new Object[] {widget, pointer, widgetCtx, this.childBindings}, objectModel);
+                        new Object[]{widget, pointer, widgetCtx, this.childBindings}, objectModel);
 
-            } catch(RuntimeException re) {
+            } catch (RuntimeException re) {
                 // rethrow
                 throw re;
-            } catch(Exception e) {
+            } catch (Exception e) {
                 throw new CascadingRuntimeException("Error invoking JavaScript event handler", e);
             }
         } else {
-            if (this.getLogger().isInfoEnabled()) {
-                this.getLogger().info("[Javascript Binding] - saveForm: No code available on the javascript binding with id \"" + this.getId() + "\"");
+            if (getLogger().isInfoEnabled()) {
+                getLogger().info("[Javascript Binding] - saveForm: No code available on the javascript binding with id \"" + this.getId() + "\"");
             }
         }
     }

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/JavaScriptJXPathBindingBuilder.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/JavaScriptJXPathBindingBuilder.java?view=diff&rev=450255&r1=450254&r2=450255
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/JavaScriptJXPathBindingBuilder.java (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/JavaScriptJXPathBindingBuilder.java Tue Sep 26 16:48:43 2006
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You 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.
@@ -24,9 +24,11 @@
 import org.apache.avalon.framework.context.Context;
 import org.apache.avalon.framework.context.ContextException;
 import org.apache.avalon.framework.context.Contextualizable;
+
 import org.apache.cocoon.forms.binding.JXPathBindingManager.Assistant;
 import org.apache.cocoon.forms.util.DomHelper;
 import org.apache.cocoon.forms.util.JavaScriptHelper;
+
 import org.mozilla.javascript.Function;
 import org.w3c.dom.Element;
 
@@ -68,15 +70,18 @@
  *
  * @version $Id$
  */
-public class JavaScriptJXPathBindingBuilder extends JXPathBindingBuilderBase implements Contextualizable {
+public class JavaScriptJXPathBindingBuilder extends JXPathBindingBuilderBase
+                                            implements Contextualizable {
 
     private Context avalonContext;
 
+
     public void contextualize(Context context) throws ContextException {
         this.avalonContext = context;
     }
 
-    public JXPathBindingBase buildBinding(Element element, Assistant assistant) throws BindingException {
+    public JXPathBindingBase buildBinding(Element element, Assistant assistant)
+    throws BindingException {
         try {
             CommonAttributes commonAtts = JXPathBindingBuilderBase.getCommonAttributes(element);
 
@@ -84,22 +89,25 @@
             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();
+
+            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();
-            	
+                if (otherBinding != null) {
+                    loadScript = otherBinding.getLoadScript();
+                }
+
                 Element loadElem = DomHelper.getChildElement(element, BindingManager.NAMESPACE, "load-form");
                 if (loadElem != null) {
                 	loadScript = JavaScriptHelper.buildFunction(loadElem, "loadForm", JavaScriptJXPathBinding.LOAD_PARAMS);
@@ -109,9 +117,10 @@
             // Build save script
             Function saveScript = null;
             if (commonAtts.saveEnabled) {
-            	if (otherBinding != null)
-            		saveScript = otherBinding.getSaveScript();
-            	
+            	if (otherBinding != null) {
+                    saveScript = otherBinding.getSaveScript();
+                }
+
                 Element saveElem = DomHelper.getChildElement(element, BindingManager.NAMESPACE, "save-form");
                 if (saveElem != null) {
                 	saveScript = JavaScriptHelper.buildFunction(saveElem, "saveForm", JavaScriptJXPathBinding.SAVE_PARAMS);
@@ -120,16 +129,16 @@
 
             // Build child bindings
             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());
-            	}
+                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) {
                 for (int i = 0; i < children.length; i++) {
@@ -137,13 +146,13 @@
 
                     // 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));
                     	otherBindings = ((ComposedJXPathBindingBase)childBindings.get(name)).getChildBindings();
                     }
-                    
+
                     // Build the child binding
                     JXPathBindingBase[] bindings = assistant.makeChildBindings(child,otherBindings);
                     if (bindings == null) {
@@ -157,7 +166,7 @@
             }
 
             JXPathBindingBase result = new JavaScriptJXPathBinding(this.avalonContext, commonAtts, id, path, loadScript, saveScript,
-                Collections.unmodifiableMap(childBindings));
+                    Collections.unmodifiableMap(childBindings));
             result.enableLogging(getLogger());
             return result;
 

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/MultiValueJXPathBinding.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/MultiValueJXPathBinding.java?view=diff&rev=450255&r1=450254&r2=450255
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/MultiValueJXPathBinding.java (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/MultiValueJXPathBinding.java Tue Sep 26 16:48:43 2006
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You 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.
@@ -21,9 +21,11 @@
 import java.util.Locale;
 
 import org.apache.avalon.framework.logger.Logger;
+
 import org.apache.cocoon.forms.datatype.convertor.ConversionResult;
 import org.apache.cocoon.forms.datatype.convertor.Convertor;
 import org.apache.cocoon.forms.formmodel.Widget;
+
 import org.apache.commons.jxpath.JXPathContext;
 import org.apache.commons.jxpath.Pointer;
 
@@ -42,10 +44,14 @@
     private final Convertor convertor;
     private final Locale convertorLocale;
 
-    public MultiValueJXPathBinding(
-        JXPathBindingBuilderBase.CommonAttributes commonAtts, String multiValueId,
-        String multiValuePath, String rowPath,
-        JXPathBindingBase[] updateBindings, Convertor convertor, Locale convertorLocale) {
+
+    public MultiValueJXPathBinding(JXPathBindingBuilderBase.CommonAttributes commonAtts,
+                                   String multiValueId,
+                                   String multiValuePath,
+                                   String rowPath,
+                                   JXPathBindingBase[] updateBindings,
+                                   Convertor convertor,
+                                   Locale convertorLocale) {
         super(commonAtts);
         this.multiValueId = multiValueId;
         this.multiValuePath = multiValuePath;
@@ -54,7 +60,12 @@
         this.convertor = convertor;
         this.convertorLocale = convertorLocale;
     }
-    
+
+    public void enableLogging(Logger logger) {
+        super.enableLogging(logger);
+        this.updateBinding.enableLogging(logger);
+    }
+
     public String getId() { return multiValueId; }
     public String getMultiValuePath() { return multiValuePath; }
     public String getRowPath() { return rowPath; }
@@ -112,11 +123,11 @@
         JXPathContext multiValueContext = jctx.getRelativeContext(jctx.createPath(this.multiValuePath));
 
         // Delete all that is already present
-        
-        // Unfortunately the following statement doesn't work (it doesn't removes all elements from the 
+
+        // Unfortunately the following statement doesn't work (it doesn't removes all elements from the
         // list because of a bug in JXPath I wasn't able to locate).
         //multiValueContext.removeAll(this.rowPath);
-        
+
         // TODO: This is a workaround until the bug in commons-jxpath is found, fixed and released
         Iterator rowPointers = multiValueContext.iteratePointers(this.rowPath);
         int cnt = 0;
@@ -167,8 +178,4 @@
         return "MultiValueJXPathBinding [widget=" + this.multiValueId + ", xpath=" + this.multiValuePath + "]";
     }
 
-    public void enableLogging(Logger logger) {
-        super.enableLogging(logger);
-        this.updateBinding.enableLogging(logger);
-    }
 }

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/MultiValueJXPathBindingBuilder.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/MultiValueJXPathBindingBuilder.java?view=diff&rev=450255&r1=450254&r2=450255
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/MultiValueJXPathBindingBuilder.java (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/MultiValueJXPathBindingBuilder.java Tue Sep 26 16:48:43 2006
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You 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.
@@ -22,6 +22,7 @@
 import org.apache.cocoon.forms.datatype.convertor.Convertor;
 import org.apache.cocoon.forms.util.DomHelper;
 import org.apache.cocoon.i18n.I18nUtils;
+
 import org.w3c.dom.Element;
 
 /**
@@ -40,12 +41,11 @@
  *
  * @version $Id$
  */
-public class MultiValueJXPathBindingBuilder
-    extends JXPathBindingBuilderBase {
+public class MultiValueJXPathBindingBuilder extends JXPathBindingBuilderBase {
 
-    public JXPathBindingBase buildBinding(
-        Element bindingElem,
-        JXPathBindingManager.Assistant assistant) throws BindingException {
+    public JXPathBindingBase buildBinding(Element bindingElem,
+                                          JXPathBindingManager.Assistant assistant)
+    throws BindingException {
 
         try {
             CommonAttributes commonAtts = JXPathBindingBuilderBase.getCommonAttributes(bindingElem);
@@ -54,7 +54,6 @@
             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, FormsConstants.DEFINITION_NS, "convertor");
@@ -67,26 +66,26 @@
 
                 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();
-            	}	
+
+            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);

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/NewJXPathBinding.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/NewJXPathBinding.java?view=diff&rev=450255&r1=450254&r2=450255
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/NewJXPathBinding.java (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/NewJXPathBinding.java Tue Sep 26 16:48:43 2006
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You 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.
@@ -17,6 +17,7 @@
 package org.apache.cocoon.forms.binding;
 
 import org.apache.cocoon.forms.formmodel.Widget;
+
 import org.apache.commons.jxpath.JXPathContext;
 
 /**
@@ -43,12 +44,12 @@
      * @param childBindings
      */
     public NewJXPathBinding(JXPathBindingBuilderBase.CommonAttributes commonAtts,
-            String widgetId, JXPathBindingBase[] childBindings) {
+                            String widgetId, JXPathBindingBase[] childBindings) {
         super(commonAtts, childBindings);
         this.widgetId = widgetId;
         this.classBinding = null;
     }
-    
+
     public String getId() { return widgetId; }
 
     /**
@@ -67,8 +68,9 @@
      * before continuing the binding over the child-bindings.
      */
     public void doLoad(Widget frmModel, JXPathContext jxpc) throws BindingException {
-        if (classBinding == null)
+        if (classBinding == null) {
             resolve();
+        }
         Binding[] subBindings = ((ComposedJXPathBindingBase)classBinding).getChildBindings();
         if (subBindings != null) {
             int size = subBindings.length;
@@ -84,8 +86,9 @@
      * before continuing the binding over the child-bindings.
      */
     public void doSave(Widget frmModel, JXPathContext jxpc) throws BindingException {
-        if (classBinding == null)
+        if (classBinding == null) {
             resolve();
+        }
         Binding[] subBindings = ((ComposedJXPathBindingBase)classBinding).getChildBindings();
         if (subBindings != null) {
             int size = subBindings.length;

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/NewJXPathBindingBuilder.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/NewJXPathBindingBuilder.java?view=diff&rev=450255&r1=450254&r2=450255
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/NewJXPathBindingBuilder.java (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/NewJXPathBindingBuilder.java Tue Sep 26 16:48:43 2006
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You 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.
@@ -17,6 +17,7 @@
 package org.apache.cocoon.forms.binding;
 
 import org.apache.cocoon.forms.util.DomHelper;
+
 import org.w3c.dom.Element;
 
 /**
@@ -33,31 +34,30 @@
  *
  * @version $Id$
  */
-public class NewJXPathBindingBuilder
-    extends JXPathBindingBuilderBase {
+public class NewJXPathBindingBuilder extends JXPathBindingBuilderBase {
 
     public JXPathBindingBase buildBinding(Element bindingElm, JXPathBindingManager.Assistant assistant)
-            throws BindingException {
+    throws BindingException {
         try {
             String widgetId = DomHelper.getAttribute(bindingElm, "id", null);
             CommonAttributes commonAtts = JXPathBindingBuilderBase.getCommonAttributes(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();
+            // 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;
+
+            childBindings = assistant.makeChildBindings(bindingElm, childBindings);
+
+            return new NewJXPathBinding(commonAtts, widgetId, childBindings);
         } catch (BindingException e) {
             throw e;
         } catch (Exception e) {

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/RepeaterAdapter.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/RepeaterAdapter.java?view=diff&rev=450255&r1=450254&r2=450255
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/RepeaterAdapter.java (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/RepeaterAdapter.java Tue Sep 26 16:48:43 2006
@@ -1,22 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 java.util.Collection;
 
 import org.apache.cocoon.forms.formmodel.Repeater.RepeaterRow;
 
+/**
+ * @version $Id$
+ */
 public interface RepeaterAdapter {
 
 	public void setBinding(EnhancedRepeaterJXPathBinding binding);
 	public void setJXCollection(RepeaterJXPathCollection collection);
-	
+
 	public void setCollection(Collection c);
-	
+
 	// TODO expand with widget path
 	public RepeaterSorter sortBy(String path);
 	public RepeaterFilter getFilter();
-	
+
 	public RepeaterItem getItem(int i);
 	public RepeaterItem generateItem(RepeaterRow row);
 	public void populateRow(RepeaterItem item) throws BindingException;
-	
 }

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/RepeaterFilter.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/RepeaterFilter.java?view=diff&rev=450255&r1=450254&r2=450255
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/RepeaterFilter.java (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/RepeaterFilter.java Tue Sep 26 16:48:43 2006
@@ -1,9 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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;
 
+/**
+ * @version $Id$
+ */
 public interface RepeaterFilter {
 
 	public void setFilter(String field, Object value);
-	
+
 	public boolean shouldDisplay(RepeaterItem item);
-	
 }

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/RepeaterItem.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/RepeaterItem.java?view=diff&rev=450255&r1=450254&r2=450255
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/RepeaterItem.java (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/RepeaterItem.java Tue Sep 26 16:48:43 2006
@@ -1,45 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.formmodel.Repeater.RepeaterRow;
+
 import org.apache.commons.jxpath.JXPathContext;
 
+/**
+ * @version $Id$
+ */
 public class RepeaterItem {
 
 	private Object handle;
-	
-	private JXPathContext context;
-	private RepeaterRow row;
-	
-	public RepeaterItem(Object handle) {
-		super();
-		this.handle = handle;
-	}
-	public JXPathContext getContext() {
-		return context;
-	}
-	public void setContext(JXPathContext context) {
-		this.context = context;
-	}
-	public Object getHandle() {
-		return handle;
-	}
-	public void setHandle(Object handle) {
-		this.handle = handle;
-	}
-	public RepeaterRow getRow() {
-		return row;
-	}
-	public void setRow(RepeaterRow attribute) {
-		this.row = attribute;
-	}
-	
-	public boolean equals(Object other) {
-		if (!(other instanceof RepeaterItem)) return false;
-		return this.handle.equals(((RepeaterItem)other).handle);
-	}
-	
-	public int hashCode() {
-		return this.handle.hashCode();
-	}
-	
+
+    private JXPathContext context;
+    private RepeaterRow row;
+
+
+    public RepeaterItem(Object handle) {
+        super();
+        this.handle = handle;
+    }
+
+    public JXPathContext getContext() {
+        return context;
+    }
+
+    public void setContext(JXPathContext context) {
+        this.context = context;
+    }
+
+    public Object getHandle() {
+        return handle;
+    }
+
+    public void setHandle(Object handle) {
+        this.handle = handle;
+    }
+
+    public RepeaterRow getRow() {
+        return row;
+    }
+
+    public void setRow(RepeaterRow attribute) {
+        this.row = attribute;
+    }
+
+    public boolean equals(Object other) {
+        if (!(other instanceof RepeaterItem)) return false;
+        return this.handle.equals(((RepeaterItem) other).handle);
+    }
+
+    public int hashCode() {
+        return this.handle.hashCode();
+    }
 }

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/RepeaterJXPathAdapter.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/RepeaterJXPathAdapter.java?view=diff&rev=450255&r1=450254&r2=450255
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/RepeaterJXPathAdapter.java (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/RepeaterJXPathAdapter.java Tue Sep 26 16:48:43 2006
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 java.util.ArrayList;
@@ -9,22 +25,26 @@
 import java.util.Map;
 
 import org.apache.cocoon.forms.formmodel.Repeater.RepeaterRow;
+
 import org.apache.commons.jxpath.JXPathContext;
 import org.apache.commons.jxpath.Pointer;
 
+/**
+ * @version $Id$
+ */
 public class RepeaterJXPathAdapter implements RepeaterAdapter {
 
 	private int progressive = 100000;
-	
+
 	private EnhancedRepeaterJXPathBinding binding;
 	private RepeaterJXPathCollection jxCollection;
-	private List sortedItems = null;
-	
+	private List sortedItems;
+
 
 	public RepeaterFilter getFilter() {
 		return new RepeaterJXPathFilter();
 	}
-	
+
 	private String findPathFor(String field) {
 		JXPathBindingBase[] childBindings = binding.getRowBinding().getChildBindings();
 		String path = null;
@@ -43,7 +63,7 @@
 	public RepeaterSorter sortBy(String field) {
 		if (field == null) {
 			sortedItems = null;
-			return new NormalOrderJXPathSorter();			
+			return new NormalOrderJXPathSorter();
 		}
 		String path = findPathFor(field);
 		if (path == null) throw new IllegalStateException("Cannot find a path for sorting on widget " + field);
@@ -57,7 +77,7 @@
 				i++;
 				item = getItem(i);
 			}
-			this.sortedItems = tsortedItems;			
+			this.sortedItems = tsortedItems;
 		}
 		Collections.sort(sortedItems, sort);
 		return sort;
@@ -73,7 +93,7 @@
 	public void setJXCollection(RepeaterJXPathCollection collection) {
 		this.jxCollection = collection;
 	}
-	
+
     public RepeaterItem getItem(int i) {
     	if (i < 0) return null;
 		if (i >= jxCollection.getOriginalCollectionSize()) return null;
@@ -88,21 +108,21 @@
     		return (RepeaterItem) sortedItems.get(i);
     	}
     }
-	
+
 
 	class RepeaterJXPathFilter implements RepeaterFilter {
 
 		private Map fieldsPaths = new HashMap();
 		private Map fieldsValues = new HashMap();
-		
+
 		public boolean shouldDisplay(RepeaterItem item) {
 			for (Iterator iter = fieldsValues.keySet().iterator(); iter.hasNext();) {
 				String field = (String) iter.next();
 				Object value = fieldsValues.get(field);
-				Object acvalue = null;				
+				Object acvalue = null;
 				if (item.getRow() == null) {
 					String path = (String) fieldsPaths.get(field);
-					acvalue = item.getContext().getValue(path);					
+					acvalue = item.getContext().getValue(path);
 				} else {
 					acvalue = item.getRow().getChild(field).getValue();
 				}
@@ -111,7 +131,7 @@
 					return ((String)acvalue).startsWith((String)value);
 				} else {
 					return acvalue.equals(value);
-				}				
+				}
 			}
 			return true;
 		}
@@ -127,9 +147,9 @@
 				fieldsValues.put(field, value);
 			}
 		}
-		
+
 	}
-	
+
 	class RepeaterJXPathSorter implements RepeaterSorter {
 
 		private String path;
@@ -139,7 +159,7 @@
 			this.path = path;
 			this.field = field;
 		}
-		
+
 		public void setCollection(Collection c) {
 		}
 
@@ -150,24 +170,24 @@
 			if (i1.getRow() != null) {
 				val1 = i1.getRow().getChild(field).getValue();
 			} else {
-				val1 = i1.getContext().getValue(path);				
+				val1 = i1.getContext().getValue(path);
 			}
 			Object val2 = null;
 			if (i2.getRow() != null) {
 				val2 = i2.getRow().getChild(field).getValue();
 			} else {
-				val2 = i2.getContext().getValue(path);				
+				val2 = i2.getContext().getValue(path);
 			}
 			if (val1 instanceof Comparable) {
 				return ((Comparable)val1).compareTo(val2);
 			}
 			return val1.toString().compareTo(val2.toString());
 		}
-		
+
 	}
 
 	class NormalOrderJXPathSorter implements RepeaterSorter {
-		
+
 		public void setCollection(Collection c) {
 		}
 
@@ -176,7 +196,6 @@
 			RepeaterItem i2 = (RepeaterItem) o2;
 			return ((Integer)i1.getHandle()).compareTo((Integer)i2.getHandle());
 		}
-		
 	}
 
 	public RepeaterItem generateItem(RepeaterRow row) {
@@ -186,9 +205,7 @@
 	}
 
 	public void populateRow(RepeaterItem item) throws BindingException {
-        binding.getRowBinding().loadFormFromModel(item.getRow(), item.getContext());            			
+        binding.getRowBinding().loadFormFromModel(item.getRow(), item.getContext());
 	}
-	
-}
-
 
+}

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/RepeaterJXPathBinding.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/RepeaterJXPathBinding.java?view=diff&rev=450255&r1=450254&r2=450255
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/RepeaterJXPathBinding.java (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/RepeaterJXPathBinding.java Tue Sep 26 16:48:43 2006
@@ -17,21 +17,18 @@
 package org.apache.cocoon.forms.binding;
 
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 import java.util.Set;
 
 import org.apache.avalon.framework.logger.Logger;
+
+import org.apache.cocoon.forms.datatype.convertor.ConversionResult;
 import org.apache.cocoon.forms.formmodel.Repeater;
-import org.apache.cocoon.forms.formmodel.RepeaterDefinition;
 import org.apache.cocoon.forms.formmodel.Widget;
-import org.apache.cocoon.forms.formmodel.Repeater.RepeaterRow;
-import org.apache.cocoon.forms.datatype.convertor.ConversionResult;
+
 import org.apache.commons.collections.ListUtils;
 import org.apache.commons.jxpath.JXPathContext;
 import org.apache.commons.jxpath.Pointer;
@@ -57,12 +54,15 @@
     /**
      * Constructs RepeaterJXPathBinding
      */
-    public RepeaterJXPathBinding(
-            JXPathBindingBuilderBase.CommonAttributes commonAtts,
-            String repeaterId, String repeaterPath, String rowPath,
-            String rowPathForInsert,
-            JXPathBindingBase[] childBindings, JXPathBindingBase insertBinding,
-            JXPathBindingBase[] deleteBindings, JXPathBindingBase[] identityBindings) {
+    public RepeaterJXPathBinding(JXPathBindingBuilderBase.CommonAttributes commonAtts,
+                                 String repeaterId,
+                                 String repeaterPath,
+                                 String rowPath,
+                                 String rowPathForInsert,
+                                 JXPathBindingBase[] childBindings,
+                                 JXPathBindingBase insertBinding,
+                                 JXPathBindingBase[] deleteBindings,
+                                 JXPathBindingBase[] identityBindings) {
         super(commonAtts);
         this.repeaterId = repeaterId;
         this.repeaterPath = repeaterPath;
@@ -100,6 +100,20 @@
             this.identityBinding = null;
     }
 
+    public void enableLogging(Logger logger) {
+        super.enableLogging(logger);
+        if (this.deleteRowBinding != null) {
+            this.deleteRowBinding.enableLogging(logger);
+        }
+        if (this.insertRowBinding != null) {
+            this.insertRowBinding.enableLogging(logger);
+        }
+        this.rowBinding.enableLogging(logger);
+        if (this.identityBinding != null) {
+            this.identityBinding.enableLogging(logger);
+        }
+    }
+
     public String getId() { return repeaterId; }
     public String getRepeaterPath() { return repeaterPath; }
     public String getRowPath() { return rowPath; }
@@ -382,19 +396,4 @@
         return "RepeaterJXPathBinding [widget=" + this.repeaterId +
                 ", xpath=" + this.repeaterPath + "]";
     }
-
-    public void enableLogging(Logger logger) {
-        super.enableLogging(logger);
-        if (this.deleteRowBinding != null) {
-            this.deleteRowBinding.enableLogging(logger);
-        }
-        if (this.insertRowBinding != null) {
-            this.insertRowBinding.enableLogging(logger);
-        }
-        this.rowBinding.enableLogging(logger);
-        if (this.identityBinding != null) {
-            this.identityBinding.enableLogging(logger);
-        }
-    }
-
 }

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/RepeaterJXPathBindingBuilder.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/RepeaterJXPathBindingBuilder.java?view=diff&rev=450255&r1=450254&r2=450255
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/RepeaterJXPathBindingBuilder.java (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/RepeaterJXPathBindingBuilder.java Tue Sep 26 16:48:43 2006
@@ -18,6 +18,7 @@
 
 import org.apache.cocoon.forms.util.DomHelper;
 import org.apache.cocoon.util.location.LocationAttributes;
+
 import org.w3c.dom.Element;
 
 /**
@@ -64,7 +65,8 @@
      * @return JXPathBindingBase
      */
     public JXPathBindingBase buildBinding(Element bindingElm,
-            JXPathBindingManager.Assistant assistant) throws BindingException {
+                                          JXPathBindingManager.Assistant assistant)
+    throws BindingException {
         if (bindingElm.hasAttribute("unique-row-id")) {
             throw new BindingException("Attribute 'unique-row-id' is no more supported, use <fb:identity> instead",
                                        LocationAttributes.getLocation(bindingElm));
@@ -87,9 +89,9 @@
                     DomHelper.getAttribute(bindingElm, "row-path", null);
             String rowPathForInsert =
                 DomHelper.getAttribute(bindingElm, "row-path-insert", rowPath);
-            String adapterClass = 
+            String adapterClass =
             	DomHelper.getAttribute(bindingElm, "adapter-class", null);
-            
+
 //          do inheritance
             RepeaterJXPathBinding otherBinding = (RepeaterJXPathBinding)assistant.getContext().getSuperBinding();
             JXPathBindingBase[] existingOnBind = null;
@@ -175,18 +177,15 @@
                 // Use the children of the current element
                 childBindings = assistant.makeChildBindings(bindingElm, existingOnBind);
             }
-            
-            RepeaterJXPathBinding repeaterBinding =
-                new EnhancedRepeaterJXPathBinding(commonAtts, repeaterId, parentPath,
-                        rowPath, rowPathForInsert,
-                        childBindings, insertBinding, deleteBindings, identityBinding, adapterClass);
-            return repeaterBinding;
+
+            return new EnhancedRepeaterJXPathBinding(commonAtts, repeaterId, parentPath,
+                    rowPath, rowPathForInsert,
+                    childBindings, insertBinding, deleteBindings, identityBinding, adapterClass);
         } catch (BindingException e) {
             throw e;
         } catch (Exception e) {
-            throw new BindingException(
-                    "Error building repeater binding defined at " +
-                    DomHelper.getLocation(bindingElm), e);
+            throw new BindingException("Error building repeater binding defined at " +
+                            DomHelper.getLocation(bindingElm), e);
         }
     }
 }

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/RepeaterJXPathCollection.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/RepeaterJXPathCollection.java?view=diff&rev=450255&r1=450254&r2=450255
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/RepeaterJXPathCollection.java (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/RepeaterJXPathCollection.java Tue Sep 26 16:48:43 2006
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 java.util.ArrayList;
@@ -11,28 +27,32 @@
 import java.util.Set;
 
 import org.apache.cocoon.forms.formmodel.Repeater.RepeaterRow;
+
 import org.apache.commons.jxpath.JXPathContext;
 
 /**
  * Implements a collection that takes care about removed, updated and inserted
  * elements, obtaining from a {@link RepeaterAdapter} all the needed objects.
+ *
+ * @version $Id$
  */
 public class RepeaterJXPathCollection {
 
     private JXPathContext storageContext;
-    
+
     private Map updatedRows;
     private Set deletedRows;
     private List insertedRows;
-    
+
 	private int collectionSize;
-	
+
 	private RepeaterSorter sorter = null;
 	private RepeaterFilter filter = null;
 	private RepeaterAdapter adapter = null;
-	
+
 	private List itemsCache = new ArrayList();
 
+
     public void init(JXPathContext storageContext, String rowpath, RepeaterAdapter adapter) {
         this.storageContext = storageContext;
         collectionSize = 0;
@@ -44,18 +64,18 @@
                 collectionSize = ((Double) storageContext.getValue("count("+rowpath+")")).intValue();
             }
         }
-        
+
         this.updatedRows = new HashMap();
         this.deletedRows = new HashSet();
         this.insertedRows = new ArrayList();
         this.adapter = adapter;
         this.sorter = adapter.sortBy(null);
     }
-    
+
     private int getStartIndex(int start) {
     	int i = start;
     	RepeaterItem item = adapter.getItem(i);
-    	// In case start is after the end of the collection try to go back 
+    	// In case start is after the end of the collection try to go back
     	// until a valid item is found
     	while (item == null && i > 0) {
     		i--;
@@ -88,7 +108,7 @@
     	int rstart = getStartIndex(start);;
     	RepeaterItem startItem = null;
     	if (rstart > 0) {
-    		// Try to fetch one element before, so that we can distinguish 
+    		// Try to fetch one element before, so that we can distinguish
     		// where we started after inferring added elements.
     		startItem = getItem(rstart - 1);
     	}
@@ -111,7 +131,7 @@
                 	i++;
                 	item = getItem(i);
                     if (item == null) break;
-                }            	
+                }
             }
             if (item == null) break;
         	ret.add(item);
@@ -140,20 +160,20 @@
 	    	}
     	}
     	while (ret.size() > rlength) ret.remove(ret.size() - 1);
-    	
+
         this.itemsCache.clear();
         this.itemsCache.addAll(ret);
         return ret;
     }
-    
+
     public List getCachedItems() {
     	return this.itemsCache;
     }
-    
+
     public void flushCachedItems() {
     	this.itemsCache.clear();
     }
-    
+
     private RepeaterItem getItem(int i) {
         // Take the element from the original collection and check if it was updated
         RepeaterItem item = this.adapter.getItem(i);
@@ -163,13 +183,13 @@
         }
         return item;
     }
-    
+
     public void updateRow(RepeaterItem item) {
     	if (!isInserted(item) && !isDeleted(item)) {
     		this.updatedRows.put(item.getHandle(), item);
     	}
     }
-    
+
     public void deleteRow(RepeaterItem item) {
     	if (isInserted(item)) {
     		this.insertedRows.remove(item);
@@ -177,33 +197,33 @@
     	} else if (isUpdated(item)) {
     		this.updatedRows.remove(item);
     	}
-    	this.deletedRows.add(item);  
+    	this.deletedRows.add(item);
     }
-    
+
     public void addRow(RepeaterItem item) {
     	this.insertedRows.add(item);
     }
-    
+
     public int getOriginalCollectionSize() {
         return collectionSize;
     }
-    
+
     public int getActualCollectionSize() {
-    	return getOriginalCollectionSize() - this.deletedRows.size() + this.insertedRows.size();    	
+    	return getOriginalCollectionSize() - this.deletedRows.size() + this.insertedRows.size();
     }
-        
+
     /*
      * convenience methods to search the cache
-     */ 
-    
+     */
+
     private boolean isUpdated(RepeaterItem item) {
         return this.updatedRows.containsKey(item.getHandle());
     }
-    
+
     private boolean isDeleted(RepeaterItem item) {
         return this.deletedRows.contains(item);
     }
-    
+
     private boolean isInserted(RepeaterItem item) {
         return this.insertedRows.contains(item);
     }
@@ -247,6 +267,4 @@
 		}
 		filter.setFilter(field, value);
 	}
-	
-            
 }

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/RepeaterSorter.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/RepeaterSorter.java?view=diff&rev=450255&r1=450254&r2=450255
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/RepeaterSorter.java (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/RepeaterSorter.java Tue Sep 26 16:48:43 2006
@@ -1,10 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 java.util.Collection;
 import java.util.Comparator;
 
+/**
+ * @version $Id$
+ */
 public interface RepeaterSorter extends Comparator {
 
 	public void setCollection(Collection c);
-	
 }

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/SetAttributeJXPathBinding.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/SetAttributeJXPathBinding.java?view=diff&rev=450255&r1=450254&r2=450255
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/SetAttributeJXPathBinding.java (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/SetAttributeJXPathBinding.java Tue Sep 26 16:48:43 2006
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You 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.
@@ -17,6 +17,7 @@
 package org.apache.cocoon.forms.binding;
 
 import org.apache.cocoon.forms.formmodel.Widget;
+
 import org.apache.commons.jxpath.JXPathContext;
 
 /**
@@ -34,15 +35,18 @@
     private final String name;
     private final String value;
 
+
     /**
      * Constructs SetAttributeJXPathBinding
      */
-    public SetAttributeJXPathBinding(JXPathBindingBuilderBase.CommonAttributes commonAtts, String attName, String attValue) {
+    public SetAttributeJXPathBinding(JXPathBindingBuilderBase.CommonAttributes commonAtts,
+                                     String attName,
+                                     String attValue) {
         super(commonAtts);
         this.name = attName;
         this.value = attValue;
     }
-    
+
     public String getId() { return name; }
     public String getValue() { return value; }
 
@@ -58,8 +62,9 @@
      */
     public void doSave(Widget frmModel, JXPathContext jxpc) {
         jxpc.setValue("@" + this.name, this.value);
-        if (getLogger().isDebugEnabled())
+        if (getLogger().isDebugEnabled()) {
             getLogger().debug("done saving " + toString());
+        }
     }
 
     public String toString() {



Mime
View raw message