cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject svn commit: r1573205 [2/5] - in /cocoon/branches/BRANCH_2_1_X-dojo1_1: ./ legal/ lib/ lib/core/ lib/endorsed/ lib/optional/ misc/notes/ src/blocks/auth/java/org/apache/cocoon/auth/ src/blocks/batik/java/org/apache/cocoon/serialization/ src/blocks/batik...
Date Sat, 01 Mar 2014 18:02:20 GMT
Modified: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/databases/samples/transform/sql-page3.xml
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/databases/samples/transform/sql-page3.xml?rev=1573205&r1=1573204&r2=1573205&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/databases/samples/transform/sql-page3.xml (original)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/databases/samples/transform/sql-page3.xml Sat Mar  1 18:02:14 2014
@@ -21,7 +21,7 @@
 
   <resources>
     <resource type="file" href="../schema.sql">Schema</resource>
-    <resource type="doc" href="userdocs/transformers/sql-transformer.html">SQL Transformer</resource>
+    <resource type="doc" href="http://cocoon.apache.org/2.1/userdocs/sql-transformer.html">SQL Transformer</resource>
   </resources>
 
   <content>

Modified: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/databases/samples/xsp/esql.xsp
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/databases/samples/xsp/esql.xsp?rev=1573205&r1=1573204&r2=1573205&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/databases/samples/xsp/esql.xsp (original)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/databases/samples/xsp/esql.xsp Sat Mar  1 18:02:14 2014
@@ -26,7 +26,7 @@
     <title>A Database Driven XSP Page</title>
     <resources>
       <resource type="file" href="../schema.sql">Schema</resource>
-      <resource type="doc" href="userdocs/xsp/esql">ESQL</resource>
+      <resource type="doc" href="http://cocoon.apache.org/2.1/userdocs/logicsheets/esql.html">ESQL</resource>
     </resources>
 
     <content>

Modified: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/fop/java/org/apache/cocoon/serialization/FOPSerializer.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/fop/java/org/apache/cocoon/serialization/FOPSerializer.java?rev=1573205&r1=1573204&r2=1573205&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/fop/java/org/apache/cocoon/serialization/FOPSerializer.java (original)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/fop/java/org/apache/cocoon/serialization/FOPSerializer.java Sat Mar  1 18:02:14 2014
@@ -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.
@@ -16,60 +16,53 @@
  */
 package org.apache.cocoon.serialization;
 
-import java.io.File;
-import java.io.OutputStream;
-import java.io.Serializable;
-import java.net.MalformedURLException;
-import java.util.Map;
-import java.util.HashMap;
-
-import org.apache.avalon.framework.CascadingRuntimeException;
+import org.apache.avalon.framework.activity.Disposable;
 import org.apache.avalon.framework.configuration.Configurable;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.logger.Logger;
+import org.apache.avalon.framework.configuration.SAXConfigurationHandler;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.Serviceable;
 import org.apache.cocoon.caching.CacheableProcessingComponent;
-import org.apache.cocoon.components.renderer.ExtendableRendererFactory;
-import org.apache.cocoon.components.renderer.RendererFactory;
 import org.apache.cocoon.components.source.SourceUtil;
-import org.apache.cocoon.util.ClassUtils;
 import org.apache.excalibur.source.Source;
+import org.apache.excalibur.source.SourceException;
 import org.apache.excalibur.source.SourceResolver;
 import org.apache.excalibur.source.SourceValidity;
 import org.apache.excalibur.source.impl.validity.NOPValidity;
-import org.apache.fop.apps.Driver;
-import org.apache.fop.apps.Options;
-import org.apache.fop.configuration.ConfigurationParser;
-import org.apache.fop.messaging.MessageHandler;
-import org.apache.fop.render.Renderer;
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.apps.Fop;
+import org.apache.fop.apps.FopFactory;
+
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.URIResolver;
+import javax.xml.transform.stream.StreamSource;
+import java.io.*;
+import java.util.HashMap;
+import java.util.Map;
 
 /**
- * @author ?
- * @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
- * @version CVS $Id$
+ * FOP 0.93 (and newer) based serializer.
+ *
+ * @version $Id$
  */
-public class FOPSerializer extends AbstractSerializer implements
-  Configurable, CacheableProcessingComponent, Serviceable/*, Disposable */{
-
-    //protected SourceResolver resolver;
+public class FOPSerializer extends AbstractSerializer
+                             implements Configurable, CacheableProcessingComponent,
+                                        Serviceable, URIResolver, Disposable {
 
-    /**
-     * The Renderer Factory to use
-     */
-    protected final static RendererFactory factory = ExtendableRendererFactory.getRendererFactoryImplementation();
+    protected SourceResolver resolver;
 
     /**
-     * The <code>Driver</code> which is FOP.
+     * Factory to create fop objects
      */
-    protected Driver driver;
+    protected FopFactory fopfactory = FopFactory.newInstance();
 
     /**
-     * The current <code>Renderer</code>.
+     * The FOP instance.
      */
-    protected Renderer renderer;
+    protected Fop fop;
 
     /**
      * The current <code>mime-type</code>.
@@ -77,85 +70,34 @@ public class FOPSerializer extends Abstr
     protected String mimetype;
 
     /**
-     * The renderer name if configured
-     */
-    protected String rendererName;
-
-    /**
      * Should we set the content length ?
      */
     protected boolean setContentLength = true;
 
     /**
-     * This logger is used for FOP
-     */
-    protected Logger logger;
-
-    /**
-     * It is used to make sure that default Options loaded only once.
-     */
-    private static boolean configured = false;
-
-    /**
      * Manager to get URLFactory from.
      */
     protected ServiceManager manager;
+    private Map rendererOptions;
+
 
     /**
      * Set the component manager for this serializer.
      */
     public void service(ServiceManager manager) throws ServiceException {
         this.manager = manager;
-        //this.resolver = (SourceResolver)this.manager.lookup(SourceResolver.ROLE);
+        this.resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
     }
-/*
-    public void dispose() {
-        this.manager.release(this.resolver);
-    }
-*/
+
     /**
      * Set the configurations for this serializer.
      */
     public void configure(Configuration conf) throws ConfigurationException {
-
-        this.logger = getLogger().getChildLogger("fop");
-        MessageHandler.setScreenLogger(this.logger);
-
-        // FIXME: VG: Initialize static FOP configuration with defaults, only once.
-        // FOP has static config, but that's going to change in the near future.
-        // Then this code should be reviewed.
-        synchronized (FOPSerializer.class) {
-            if (!configured) {
-                try {
-                    if (getLogger().isDebugEnabled()) {
-                        getLogger().debug("Loading default configuration");
-                    }
-                    new Options();
-                } catch (Exception e) {
-                    getLogger().error("Cannot load default configuration. Proceeding.", e);
-                }
-                configured = true;
-            }
-        }
-
+        //should the content length be set
         this.setContentLength = conf.getChild("set-content-length").getValueAsBoolean(true);
 
-        // Old syntax: Attribute src of element user-config contains file
-        String configUrl = conf.getChild("user-config").getAttribute("src", null);
-        if (configUrl != null) {
-            getLogger().warn("Attribute src of user-config element is deprecated. "
-                             + "Provide Cocoon URI as value of the element instead");
-            try {
-                // VG: Old version of serializer supported only files
-                configUrl = new File(configUrl).toURL().toExternalForm();
-            } catch (MalformedURLException e) {
-                getLogger().warn("Can not load config file " + configUrl, e);
-                configUrl = null;
-            }
-        } else {
-            // New syntax: Element user-config contains URL
-            configUrl = conf.getChild("user-config").getValue(null);
-        }
+        String configUrl = conf.getChild("user-config").getValue(null);
+
 
         if (configUrl != null) {
             Source configSource = null;
@@ -166,7 +108,9 @@ public class FOPSerializer extends Abstr
                 if (getLogger().isDebugEnabled()) {
                     getLogger().debug("Loading configuration from " + configSource.getURI());
                 }
-                SourceUtil.toSAX(configSource, new ConfigurationParser());
+                SAXConfigurationHandler configHandler = new SAXConfigurationHandler();
+                SourceUtil.toSAX(configSource, configHandler);
+                fopfactory.setUserConfig(configHandler.getConfiguration());
             } catch (Exception e) {
                 getLogger().warn("Cannot load configuration from " + configUrl);
                 throw new ConfigurationException("Cannot load configuration from " + configUrl, e);
@@ -178,57 +122,47 @@ public class FOPSerializer extends Abstr
             }
         }
 
+        fopfactory.setURIResolver(this);
+
         // Get the mime type.
         this.mimetype = conf.getAttribute("mime-type");
 
-        // Iterate through the parameters, looking for a renderer reference
-        Configuration[] parameters = conf.getChildren("parameter");
-        for (int i = 0; i < parameters.length; i++) {
-            String name = parameters[i].getAttribute("name");
-            if ("renderer".equals(name)) {
-                this.rendererName = parameters[i].getAttribute("value");
-                try {
-                    this.renderer = (Renderer)ClassUtils.newInstance(rendererName);
-                } catch (Exception ex) {
-                    getLogger().error("Cannot load  class " + rendererName, ex);
-                    throw new ConfigurationException("Cannot load class " + rendererName, ex);
-                }
-            }
-        }
-        if (this.renderer == null) {
-            // Using the Renderer Factory, get the default renderer
-            // for this MIME type.
-            this.renderer = factory.createRenderer(mimetype);
-        }
-
-        // Do we have a renderer yet?
-        if (this.renderer == null ) {
-            throw new ConfigurationException(
-                "Could not autodetect renderer for FOPSerializer and "
-                + "no renderer was specified in the sitemap configuration."
-            );
-        }
-
         Configuration confRenderer = conf.getChild("renderer-config");
         if (confRenderer != null) {
-            parameters = confRenderer.getChildren("parameter");
+            Configuration[] parameters = confRenderer.getChildren("parameter");
             if (parameters.length > 0) {
-                Map rendererOptions = new HashMap(); 
+                rendererOptions = new HashMap();
                 for (int i = 0; i < parameters.length; i++) {
                     String name = parameters[i].getAttribute("name");
                     String value = parameters[i].getAttribute("value");
-                
+
                     if (getLogger().isDebugEnabled()) {
-                    	getLogger().debug("renderer " + String.valueOf(name) + " = " + String.valueOf(value));
+                        getLogger().debug("renderer " + String.valueOf(name) + " = " + String.valueOf(value));
                     }
-                    rendererOptions.put(name,value);
                 }
-                this.renderer.setOptions(rendererOptions);
             }
         }
     }
 
     /**
+     * Recycle serializer by removing references
+     */
+    public void recycle() {
+        super.recycle();
+        this.fop = null;
+    }
+
+    public void dispose() {
+        if (this.resolver != null) {
+            this.manager.release(this.resolver);
+            this.resolver = null;
+        }
+        this.manager = null;
+    }
+
+    // -----------------------------------------------------------------
+
+    /**
      * Return the MIME type.
      */
     public String getMimeType() {
@@ -238,30 +172,24 @@ public class FOPSerializer extends Abstr
     /**
      * Create the FOP driver
      * Set the <code>OutputStream</code> where the XML should be serialized.
+     * @throws IOException
      */
-    public void setOutputStream(OutputStream out) {
-        
+    public void setOutputStream(OutputStream out) throws IOException {
+
         // Give the source resolver to Batik which is used by FOP
         //SourceProtocolHandler.setup(this.resolver);
 
-        // load the fop driver
-        this.driver = new Driver();
-        this.driver.setLogger(this.logger);
-        if (this.rendererName == null) {
-            this.renderer = factory.createRenderer(mimetype);
-        } else {
-            try {
-                this.renderer = (Renderer)ClassUtils.newInstance(this.rendererName);
-            } catch (Exception e) {
-                if (getLogger().isWarnEnabled()) {
-                    getLogger().warn("Cannot load class " + this.rendererName, e);
-                }
-                throw new CascadingRuntimeException("Cannot load class " + this.rendererName, e);
-            }
+        FOUserAgent userAgent = fopfactory.newFOUserAgent();
+        if (this.rendererOptions != null) {
+            userAgent.getRendererOptions().putAll(this.rendererOptions);
+        }
+        try {
+            this.fop = fopfactory.newFop(getMimeType(), userAgent, out);
+            setContentHandler(this.fop.getDefaultHandler());
+        } catch (FOPException e) {
+            getLogger().error("FOP setup failed", e);
+            throw new IOException("Unable to setup fop: " + e.getLocalizedMessage());
         }
-        this.driver.setRenderer(this.renderer);
-        this.driver.setOutputStream(out);
-        setContentHandler(this.driver.getContentHandler());
     }
 
     /**
@@ -289,19 +217,129 @@ public class FOPSerializer extends Abstr
     }
 
     /**
-     * Recycle serializer by removing references
-     */
-    public void recycle() {
-        super.recycle();
-        this.driver = null;
-        this.renderer = null;
-    }
-
-    /**
      * Test if the component wants to set the content length
      */
     public boolean shouldSetContentLength() {
         return this.setContentLength;
     }
 
+    //From URIResolver, copied from TraxProcessor
+    public javax.xml.transform.Source resolve(String href, String base) throws TransformerException {
+        if (getLogger().isDebugEnabled()) {
+            getLogger().debug("resolve(href = " + href + ", base = " + base + "); resolver = " + resolver);
+        }
+
+        StreamSource streamSource = null;
+        Source source = null;
+        try {
+            if (base == null || href.indexOf(":") > 1) {
+                // Null base - href must be an absolute URL
+                source = resolver.resolveURI(href);
+            } else if (href.length() == 0) {
+                // Empty href resolves to base
+                source = resolver.resolveURI(base);
+            } else {
+                // is the base a file or a real m_url
+                if (!base.startsWith("file:")) {
+                    int lastPathElementPos = base.lastIndexOf('/');
+                    if (lastPathElementPos == -1) {
+                        // this should never occur as the base should
+                        // always be protocol:/....
+                        return null; // we can't resolve this
+                    } else {
+                        source = resolver.resolveURI(base.substring(0, lastPathElementPos) + "/" + href);
+                    }
+                } else {
+                    File parent = new File(base.substring(5));
+                    File parent2 = new File(parent.getParentFile(), href);
+                    source = resolver.resolveURI(parent2.toURI().toURL().toExternalForm());
+                }
+            }
+
+            if (getLogger().isDebugEnabled()) {
+                getLogger().debug("source = " + source + ", system id = " + source.getURI());
+            }
+
+            streamSource = new StreamSource(new ReleaseSourceInputStream(source.getInputStream(), source, resolver), source.getURI());
+        } catch (SourceException e) {
+            if (getLogger().isDebugEnabled()) {
+                getLogger().debug("Failed to resolve " + href + "(base = " + base + "), return null", e);
+            }
+
+            // CZ: To obtain the same behaviour as when the resource is
+            // transformed by the XSLT Transformer we should return null here.
+            return null;
+        } catch (java.net.MalformedURLException mue) {
+            if (getLogger().isDebugEnabled()) {
+                getLogger().debug("Failed to resolve " + href + "(base = " + base + "), return null", mue);
+            }
+
+            return null;
+        } catch (IOException ioe) {
+            if (getLogger().isDebugEnabled()) {
+                getLogger().debug("Failed to resolve " + href + "(base = " + base + "), return null", ioe);
+            }
+
+            return null;
+        } finally {
+            // If streamSource is not null, the source should only be released when the input stream
+            // is not needed anymore.
+            if (streamSource == null)
+                resolver.release(source);
+        }
+        return streamSource;
+    }
+
+    /**
+     * An InputStream which releases the Cocoon/Avalon source from which the InputStream
+     * has been retrieved when the stream is closed.
+     */
+    public static class ReleaseSourceInputStream extends InputStream {
+        private InputStream delegate;
+        private Source source;
+        private SourceResolver sourceResolver;
+
+        private ReleaseSourceInputStream(InputStream delegate, Source source, SourceResolver sourceResolver) {
+            this.delegate = delegate;
+            this.source = source;
+            this.sourceResolver = sourceResolver;
+        }
+
+        public void close() throws IOException {
+            delegate.close();
+            sourceResolver.release(source);
+        }
+
+        public int read() throws IOException {
+            return delegate.read();
+        }
+
+        public int read(byte b[]) throws IOException {
+            return delegate.read(b);
+        }
+
+        public int read(byte b[], int off, int len) throws IOException {
+            return delegate.read(b, off, len);
+        }
+
+        public long skip(long n) throws IOException {
+            return delegate.skip(n);
+        }
+
+        public int available() throws IOException {
+            return delegate.available();
+        }
+
+        public synchronized void mark(int readlimit) {
+            delegate.mark(readlimit);
+        }
+
+        public synchronized void reset() throws IOException {
+            delegate.reset();
+        }
+
+        public boolean markSupported() {
+            return delegate.markSupported();
+        }
+    }
 }

Modified: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/fop/samples/misc/samples.xml
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/fop/samples/misc/samples.xml?rev=1573205&r1=1573204&r2=1573205&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/fop/samples/misc/samples.xml (original)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/fop/samples/misc/samples.xml Sat Mar  1 18:02:14 2014
@@ -58,7 +58,7 @@
     </group>
 
     <group name="Resources">
-        <sample name="FOP web site" href="http://xml.apache.org/fop">
+        <sample name="Apache FOP web site" href="http://xmlgraphics.apache.org/fop/">
             FOP reference information
         </sample>
     </group>

Modified: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/java/org/apache/cocoon/forms/binding/RepeaterAdapter.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/java/org/apache/cocoon/forms/binding/RepeaterAdapter.java?rev=1573205&r1=1573204&r2=1573205&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/java/org/apache/cocoon/forms/binding/RepeaterAdapter.java (original)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/java/org/apache/cocoon/forms/binding/RepeaterAdapter.java Sat Mar  1 18:02:14 2014
@@ -25,16 +25,17 @@ import org.apache.cocoon.forms.formmodel
  */
 public interface RepeaterAdapter {
 
-	public void setBinding(EnhancedRepeaterJXPathBinding binding);
-	public void setJXCollection(RepeaterJXPathCollection collection);
+    public void setBinding(EnhancedRepeaterJXPathBinding binding);
+    public void setJXCollection(RepeaterJXPathCollection collection);
 
-	public void setCollection(Collection c);
+    public void setCollection(Collection c);
 
-	// TODO expand with widget path
-	public RepeaterSorter sortBy(String path);
-	public RepeaterFilter getFilter();
+    // 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;
 
-	public RepeaterItem getItem(int i);
-	public RepeaterItem generateItem(RepeaterRow row);
-	public void populateRow(RepeaterItem item) throws BindingException;
 }

Modified: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/java/org/apache/cocoon/forms/binding/RepeaterJXPathAdapter.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/java/org/apache/cocoon/forms/binding/RepeaterJXPathAdapter.java?rev=1573205&r1=1573204&r2=1573205&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/java/org/apache/cocoon/forms/binding/RepeaterJXPathAdapter.java (original)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/java/org/apache/cocoon/forms/binding/RepeaterJXPathAdapter.java Sat Mar  1 18:02:14 2014
@@ -30,185 +30,194 @@ import org.apache.commons.jxpath.JXPathC
 import org.apache.commons.jxpath.Pointer;
 
 /**
- * @version $Id$
+ * @version $Id: RepeaterJXPathAdapter.java 517733 2007-03-13 15:37:22Z
+ *          vgritsenko $
  */
 public class RepeaterJXPathAdapter implements RepeaterAdapter {
 
-	private int progressive = 100000;
+    private int progressive = 100000;
 
-	private EnhancedRepeaterJXPathBinding binding;
-	private RepeaterJXPathCollection jxCollection;
-	private List sortedItems;
-
-
-	public RepeaterFilter getFilter() {
-		return new RepeaterJXPathFilter();
-	}
-
-	private String findPathFor(String field) {
-		JXPathBindingBase[] childBindings = binding.getRowBinding().getChildBindings();
-		String path = null;
-		for (int i = 0; i < childBindings.length; i++) {
-			if (childBindings[i] instanceof ValueJXPathBinding) {
-				ValueJXPathBinding bnd = (ValueJXPathBinding) childBindings[i];
-				if (bnd.getFieldId().equals(field)) {
-					path = bnd.getXPath();
-					break;
-				}
-			}
-		}
-		return path;
-	}
-
-	public RepeaterSorter sortBy(String field) {
-		if (field == null) {
-			sortedItems = null;
-			return new NormalOrderJXPathSorter();
-		}
-		String path = findPathFor(field);
-		if (path == null) throw new IllegalStateException("Cannot find a path for sorting on widget " + field);
-		RepeaterSorter sort = new RepeaterJXPathSorter(path, field);
-		if (sortedItems == null) {
-			List tsortedItems = new ArrayList();
-			int i = 0;
-			RepeaterItem item = getItem(i);
-			while (item != null) {
-				tsortedItems.add(item);
-				i++;
-				item = getItem(i);
-			}
-			this.sortedItems = tsortedItems;
-		}
-		Collections.sort(sortedItems, sort);
-		return sort;
-	}
-
-	public void setBinding(EnhancedRepeaterJXPathBinding binding) {
-		this.binding = binding;
-	}
-
-	public void setCollection(Collection c) {
-	}
-
-	public void setJXCollection(RepeaterJXPathCollection collection) {
-		this.jxCollection = collection;
-	}
+    private EnhancedRepeaterJXPathBinding binding;
+    private RepeaterJXPathCollection jxCollection;
+    private List sortedItems;
+
+    public RepeaterFilter getFilter() {
+        return new RepeaterJXPathFilter();
+    }
+
+    private String findPathFor(String field) {
+        JXPathBindingBase[] childBindings = binding.getRowBinding().getChildBindings();
+        String path = null;
+        for (int i = 0; i < childBindings.length; i++) {
+            if (childBindings[i] instanceof ValueJXPathBinding) {
+                ValueJXPathBinding bnd = (ValueJXPathBinding) childBindings[i];
+                if (bnd.getFieldId().equals(field)) {
+                    path = bnd.getXPath();
+                    break;
+                }
+            }
+        }
+        return path;
+    }
+
+    public RepeaterSorter sortBy(String field) {
+        if (field == null) {
+            sortedItems = null;
+            return new NormalOrderJXPathSorter();
+        }
+        String path = findPathFor(field);
+        if (path == null) {
+            throw new IllegalStateException("Cannot find a path for sorting on widget " + field);
+        }
+        RepeaterSorter sort = new RepeaterJXPathSorter(path, field);
+        if (sortedItems == null) {
+            List tsortedItems = new ArrayList();
+            int i = 0;
+            RepeaterItem item = getItem(i);
+            while (item != null) {
+                tsortedItems.add(item);
+                i++;
+                item = getItem(i);
+            }
+            this.sortedItems = tsortedItems;
+        }
+        Collections.sort(sortedItems, sort);
+        return sort;
+    }
+
+    public void setBinding(EnhancedRepeaterJXPathBinding binding) {
+        this.binding = binding;
+    }
+
+    public void setCollection(Collection c) {
+    }
+
+    public void setJXCollection(RepeaterJXPathCollection collection) {
+        this.jxCollection = collection;
+    }
 
     public RepeaterItem getItem(int i) {
-    	if (i < 0) return null;
-		if (i >= jxCollection.getOriginalCollectionSize()) return null;
-    	if (this.sortedItems == null) {
-	    	JXPathContext storageContext = this.jxCollection.getStorageContext();
-	        Pointer pointer = storageContext.getPointer(binding.getRowPath() + "[" + (i+1) + "]");
-	        JXPathContext rowContext = storageContext.getRelativeContext(pointer);
-	        RepeaterItem item = new RepeaterItem(new Integer(i + 1));
-	        item.setContext(rowContext);
-	        return item;
-    	} else {
-    		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;
-				if (item.getRow() == null) {
-					String path = (String) fieldsPaths.get(field);
-					acvalue = item.getContext().getValue(path);
-				} else {
-					acvalue = item.getRow().getChild(field).getValue();
-				}
-				if (acvalue == null) return false;
-				if (acvalue instanceof String && value instanceof String) {
-					return ((String)acvalue).startsWith((String)value);
-				} else {
-					return acvalue.equals(value);
-				}
-			}
-			return true;
-		}
-
-		public void setFilter(String field, Object value) {
-			if (value == null || ((value instanceof String) && ((String)value).length() == 0)) {
-				fieldsPaths.remove(field);
-				fieldsValues.remove(field);
-			} else {
-				String path = findPathFor(field);
-				if (path == null) throw new IllegalStateException("Cannot find a path for filtering on widget " + field);
-				fieldsPaths.put(field, path);
-				fieldsValues.put(field, value);
-			}
-		}
-
-	}
-
-	static class RepeaterJXPathSorter implements RepeaterSorter {
-
-		private String path;
-		private String field;
-
-		public RepeaterJXPathSorter(String path, String field) {
-			this.path = path;
-			this.field = field;
-		}
-
-		public void setCollection(Collection c) {
-		}
-
-		public int compare(Object o1, Object o2) {
-			RepeaterItem i1 = (RepeaterItem) o1;
-			RepeaterItem i2 = (RepeaterItem) o2;
+        if (i < 0) {
+            return null;
+        }
+        if (i >= jxCollection.getOriginalCollectionSize()) {
+            return null;
+        }
+        if (this.sortedItems == null) {
+            JXPathContext storageContext = this.jxCollection.getStorageContext();
+            Pointer pointer = storageContext.getPointer(binding.getRowPath() + "[" + (i + 1) + "]");
+            JXPathContext rowContext = storageContext.getRelativeContext(pointer);
+            RepeaterItem item = new RepeaterItem(new Integer(i + 1));
+            item.setContext(rowContext);
+            return item;
+        } else {
+            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;
+                if (item.getRow() == null) {
+                    String path = (String) fieldsPaths.get(field);
+                    acvalue = item.getContext().getValue(path);
+                } else {
+                    acvalue = item.getRow().getChild(field).getValue();
+                }
+                if (acvalue == null) {
+                    return false;
+                }
+                if (acvalue instanceof String && value instanceof String) {
+                    return ((String) acvalue).startsWith((String) value);
+                } else {
+                    return acvalue.equals(value);
+                }
+            }
+            return true;
+        }
+
+        public void setFilter(String field, Object value) {
+            if (value == null || ((value instanceof String) && ((String)value).length() == 0)) {
+                fieldsPaths.remove(field);
+                fieldsValues.remove(field);
+            } else {
+                String path = findPathFor(field);
+                if (path == null) {
+                    throw new IllegalStateException("Cannot find a path for filtering on widget " + field);
+                }
+                fieldsPaths.put(field, path);
+                fieldsValues.put(field, value);
+            }
+        }
+
+    }
+
+    static class RepeaterJXPathSorter implements RepeaterSorter {
+
+        private String path;
+        private String field;
+
+        public RepeaterJXPathSorter(String path, String field) {
+            this.path = path;
+            this.field = field;
+        }
+
+        public void setCollection(Collection c) {
+        }
+
+        public int compare(Object o1, Object o2) {
+            RepeaterItem i1 = (RepeaterItem) o1;
+            RepeaterItem i2 = (RepeaterItem) o2;
 
             Object val1;
-			if (i1.getRow() != null) {
-				val1 = i1.getRow().getChild(field).getValue();
-			} else {
-				val1 = i1.getContext().getValue(path);
-			}
+            if (i1.getRow() != null) {
+                val1 = i1.getRow().getChild(field).getValue();
+            } else {
+                val1 = i1.getContext().getValue(path);
+            }
 
             Object val2;
-			if (i2.getRow() != null) {
-				val2 = i2.getRow().getChild(field).getValue();
-			} else {
-				val2 = i2.getContext().getValue(path);
-			}
+            if (i2.getRow() != null) {
+                val2 = i2.getRow().getChild(field).getValue();
+            } else {
+                val2 = i2.getContext().getValue(path);
+            }
 
             if (val1 instanceof Comparable) {
                 return ((Comparable) val1).compareTo(val2);
             }
             return val1.toString().compareTo(val2.toString());
-		}
+        }
 
-	}
+    }
 
-	static class NormalOrderJXPathSorter implements RepeaterSorter {
+    static class NormalOrderJXPathSorter implements RepeaterSorter {
 
-		public void setCollection(Collection c) {
-		}
+        public void setCollection(Collection c) {
+        }
 
-		public int compare(Object o1, Object o2) {
-			RepeaterItem i1 = (RepeaterItem) o1;
-			RepeaterItem i2 = (RepeaterItem) o2;
+        public int compare(Object o1, Object o2) {
+            RepeaterItem i1 = (RepeaterItem) o1;
+            RepeaterItem i2 = (RepeaterItem) o2;
             return ((Integer) i1.getHandle()).compareTo((Integer) i2.getHandle());
         }
-	}
+    }
 
-	public RepeaterItem generateItem(RepeaterRow row) {
-		RepeaterItem item = new RepeaterItem(new Integer(progressive++));
-		item.setRow(row);
-		return item;
-	}
+    public RepeaterItem generateItem(RepeaterRow row) {
+        RepeaterItem item = new RepeaterItem(new Integer(progressive++));
+        item.setRow(row);
+        return item;
+    }
 
-	public void populateRow(RepeaterItem item) throws BindingException {
+    public void populateRow(RepeaterItem item) throws BindingException {
         binding.getRowBinding().loadFormFromModel(item.getRow(), item.getContext());
-	}
+    }
 
 }

Modified: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/java/org/apache/cocoon/forms/binding/RepeaterJXPathCollection.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/java/org/apache/cocoon/forms/binding/RepeaterJXPathCollection.java?rev=1573205&r1=1573204&r2=1573205&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/java/org/apache/cocoon/forms/binding/RepeaterJXPathCollection.java (original)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/java/org/apache/cocoon/forms/binding/RepeaterJXPathCollection.java Sat Mar  1 18:02:14 2014
@@ -33,7 +33,7 @@ import org.apache.commons.jxpath.JXPathC
 /**
  * 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 {
@@ -44,14 +44,13 @@ public class RepeaterJXPathCollection {
     private Set deletedRows;
     private List insertedRows;
 
-	private int collectionSize;
+    private int collectionSize;
 
-	private RepeaterSorter sorter = null;
-	private RepeaterFilter filter = null;
-	private RepeaterAdapter adapter = null;
-
-	private List itemsCache = new ArrayList();
+    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;
@@ -59,9 +58,9 @@ public class RepeaterJXPathCollection {
         Object value = storageContext.getValue(rowpath);
         if (value != null) {
             if (value instanceof Collection) {
-                collectionSize = ((Collection)value).size();
+                collectionSize = ((Collection) value).size();
             } else {
-                collectionSize = ((Double) storageContext.getValue("count("+rowpath+")")).intValue();
+                collectionSize = ((Double) storageContext.getValue("count(" + rowpath + ")")).intValue();
             }
         }
 
@@ -73,93 +72,107 @@ public class RepeaterJXPathCollection {
     }
 
     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
-    	// until a valid item is found
-    	while (item == null && i > 0) {
-    		i--;
-    		item = adapter.getItem(i);
-    	}
-    	if (item == null) return 0;
-    	// Now move the index ahead of one for each deleted item "before"
-    	// the desired one
+        int i = start;
+        RepeaterItem item = adapter.getItem(i);
+        // 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--;
+            item = adapter.getItem(i);
+        }
+        if (item == null) {
+            return 0;
+        }
+        // Now move the index ahead of one for each deleted item "before"
+        // the desired one
         for (Iterator iter = deletedRows.iterator(); iter.hasNext();) {
-			RepeaterItem delitem = (RepeaterItem) iter.next();
-			if (sorter.compare(delitem, item) < 0) {
-				i++;
-			}
-		}
+            RepeaterItem delitem = (RepeaterItem) iter.next();
+            if (sorter.compare(delitem, item) < 0) {
+                i++;
+            }
+        }
         // And move it backward for each inserted row before the actual index
         for (Iterator iter = insertedRows.iterator(); iter.hasNext();) {
-			RepeaterItem insitem = (RepeaterItem) iter.next();
-			if (sorter.compare(insitem, item) < 0) {
-				i--;
-			}
-		}
-        if (i < 0) return 0;
+            RepeaterItem insitem = (RepeaterItem) iter.next();
+            if (sorter.compare(insitem, item) < 0) {
+                i--;
+            }
+        }
+        if (i < 0) {
+            return 0;
+        }
         // Now we should have the correct start
         return i;
     }
 
     public List getItems(int start, int length) {
-    	List ret = new ArrayList();
-    	int rlength = length;
-    	int rstart = getStartIndex(start);
-    	RepeaterItem startItem = null;
-    	if (rstart > 0) {
-    		// Try to fetch one element before, so that we can distinguish
-    		// where we started after inferring added elements.
-    		startItem = getItem(rstart - 1);
-    	}
-    	if (startItem != null) {
-    		ret.add(startItem);
-    	}
-    	int i = rstart;
-    	RepeaterItem item;
+        List ret = new ArrayList();
+        int rlength = length;
+        int rstart = getStartIndex(start);
+        RepeaterItem startItem = null;
+        if (rstart > 0) {
+            // Try to fetch one element before, so that we can distinguish
+            // where we started after inferring added elements.
+            startItem = getItem(rstart - 1);
+        }
+        if (startItem != null) {
+            ret.add(startItem);
+        }
+        int i = rstart;
+        RepeaterItem item;
         while (length > 0) {
-        	item = getItem(i);
-        	if (item == null) break;
-        	// skip deleted items
+            item = getItem(i);
+            if (item == null) {
+                break;
+            }
+            // skip deleted items
             while (isDeleted(item)) {
-            	i++;
-            	item = getItem(i);
-                if (item == null) break;
+                i++;
+                item = getItem(i);
+                if (item == null) {
+                    break;
+                }
             }
             if (filter != null) {
                 while (!filter.shouldDisplay(item)) {
-                	i++;
-                	item = getItem(i);
-                    if (item == null) break;
+                    i++;
+                    item = getItem(i);
+                    if (item == null) {
+                        break;
+                    }
                 }
             }
-            if (item == null) break;
-        	ret.add(item);
-        	i++;
-        	length--;
+            if (item == null) {
+                break;
+            }
+            ret.add(item);
+            i++;
+            length--;
         }
         // Infer the inserted rows.
         if (this.insertedRows.size() > 0) {
             if (filter != null) {
-            	for (Iterator iter = this.insertedRows.iterator(); iter.hasNext();) {
-					RepeaterItem acitem = (RepeaterItem) iter.next();
-					if (filter.shouldDisplay(acitem)) {
-						ret.add(acitem);
-					}
-				}
+                for (Iterator iter = this.insertedRows.iterator(); iter.hasNext();) {
+                    RepeaterItem acitem = (RepeaterItem) iter.next();
+                    if (filter.shouldDisplay(acitem)) {
+                        ret.add(acitem);
+                    }
+                }
             } else {
-            	ret.addAll(this.insertedRows);
+                ret.addAll(this.insertedRows);
             }
-	    	Collections.sort(ret, this.sorter);
+            Collections.sort(ret, this.sorter);
+        }
+        if (startItem != null) {
+            // Now get from the element after our start element.
+            int pos = ret.indexOf(startItem);
+            for (int j = 0; j <= pos; j++) {
+                ret.remove(0);
+            }
+        }
+        while (ret.size() > rlength) {
+            ret.remove(ret.size() - 1);
         }
-    	if (startItem != null) {
-	    	// Now get from the element after our start element.
-	    	int pos = ret.indexOf(startItem);
-	    	for (int j = 0; j <= pos; j++) {
-	    		ret.remove(0);
-	    	}
-    	}
-    	while (ret.size() > rlength) ret.remove(ret.size() - 1);
 
         this.itemsCache.clear();
         this.itemsCache.addAll(ret);
@@ -167,41 +180,43 @@ public class RepeaterJXPathCollection {
     }
 
     public List getCachedItems() {
-    	return this.itemsCache;
+        return this.itemsCache;
     }
 
     public void flushCachedItems() {
-    	this.itemsCache.clear();
+        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);
-        if (item == null) return null;
+        if (item == null) {
+            return null;
+        }
         if (isUpdated(item)) {
-        	item = (RepeaterItem) this.updatedRows.get(item.getHandle());
+            item = (RepeaterItem) this.updatedRows.get(item.getHandle());
         }
         return item;
     }
 
     public void updateRow(RepeaterItem item) {
-    	if (!isInserted(item) && !isDeleted(item)) {
-    		this.updatedRows.put(item.getHandle(), item);
-    	}
+        if (!isInserted(item) && !isDeleted(item)) {
+            this.updatedRows.put(item.getHandle(), item);
+        }
     }
 
     public void deleteRow(RepeaterItem item) {
-    	if (isInserted(item)) {
-    		this.insertedRows.remove(item);
-    		return;
-    	} else if (isUpdated(item)) {
-    		this.updatedRows.remove(item);
-    	}
-    	this.deletedRows.add(item);
+        if (isInserted(item)) {
+            this.insertedRows.remove(item);
+            return;
+        } else if (isUpdated(item)) {
+            this.updatedRows.remove(item);
+        }
+        this.deletedRows.add(item);
     }
 
     public void addRow(RepeaterItem item) {
-    	this.insertedRows.add(item);
+        this.insertedRows.add(item);
     }
 
     public int getOriginalCollectionSize() {
@@ -209,7 +224,7 @@ public class RepeaterJXPathCollection {
     }
 
     public int getActualCollectionSize() {
-    	return getOriginalCollectionSize() - this.deletedRows.size() + this.insertedRows.size();
+        return getOriginalCollectionSize() - this.deletedRows.size() + this.insertedRows.size();
     }
 
     /*
@@ -228,43 +243,43 @@ public class RepeaterJXPathCollection {
         return this.insertedRows.contains(item);
     }
 
-	public JXPathContext getStorageContext() {
-		return storageContext;
-	}
-
-	public List getDeletedRows() {
-		// FIXME we should sort by natural order
-		List ret = new ArrayList(this.deletedRows);
-    	Collections.sort(ret, this.sorter);
-    	Collections.reverse(ret);
-		return ret;
-	}
-
-	public List getInsertedRows() {
-		return insertedRows;
-	}
-
-	public Collection getUpdatedRows() {
-		return updatedRows.values();
-	}
-
-	public RepeaterAdapter getAdapter() {
-		return this.adapter;
-	}
-
-	public void addRow(RepeaterRow row) {
-		RepeaterItem item = this.adapter.generateItem(row);
-		this.addRow(item);
-	}
-
-	public void sortBy(String field) {
-		this.sorter = this.adapter.sortBy(field);
-	}
-
-	public void filter(String field, Object value) {
-		if (filter == null) {
-			filter = this.adapter.getFilter();
-		}
-		filter.setFilter(field, value);
-	}
+    public JXPathContext getStorageContext() {
+        return storageContext;
+    }
+
+    public List getDeletedRows() {
+        // FIXME we should sort by natural order
+        List ret = new ArrayList(this.deletedRows);
+        Collections.sort(ret, this.sorter);
+        Collections.reverse(ret);
+        return ret;
+    }
+
+    public List getInsertedRows() {
+        return insertedRows;
+    }
+
+    public Collection getUpdatedRows() {
+        return updatedRows.values();
+    }
+
+    public RepeaterAdapter getAdapter() {
+        return this.adapter;
+    }
+
+    public void addRow(RepeaterRow row) {
+        RepeaterItem item = this.adapter.generateItem(row);
+        this.addRow(item);
+    }
+
+    public void sortBy(String field) {
+        this.sorter = this.adapter.sortBy(field);
+    }
+
+    public void filter(String field, Object value) {
+        if (filter == null) {
+            filter = this.adapter.getFilter();
+        }
+        filter.setFilter(field, value);
+    }
 }

Modified: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/java/org/apache/cocoon/forms/binding/TreeModelJXPath.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/java/org/apache/cocoon/forms/binding/TreeModelJXPath.java?rev=1573205&r1=1573204&r2=1573205&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/java/org/apache/cocoon/forms/binding/TreeModelJXPath.java (original)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/java/org/apache/cocoon/forms/binding/TreeModelJXPath.java Sat Mar  1 18:02:14 2014
@@ -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 org.apache.cocoon.forms.formmodel.Widget;

Propchange: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/java/org/apache/cocoon/forms/binding/TreeModelJXPath.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/java/org/apache/cocoon/forms/binding/TreeModelJXPathBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/EnhancedRepeater.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/EnhancedRepeater.java?rev=1573205&r1=1573204&r2=1573205&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/EnhancedRepeater.java (original)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/EnhancedRepeater.java Sat Mar  1 18:02:14 2014
@@ -1,19 +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.
-*/
+ * 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.formmodel;
 
 import java.util.ArrayList;
@@ -27,45 +27,47 @@ import org.apache.cocoon.forms.datatype.
 import org.apache.cocoon.xml.AttributesImpl;
 
 public class EnhancedRepeater extends Repeater {
+
     private RepeaterJXPathCollection collection;
     private String customPageFieldId;
     private Field customPageField;
-	
+
     // pagination
     private int currentPage;
     private int pageSize;
 
-	
     public EnhancedRepeater(RepeaterDefinition repeaterDefinition) {
-		super(repeaterDefinition);
-    	this.currentPage = this.definition.getInitialPage();
-    	this.pageSize = this.definition.getPageSize();
+        super(repeaterDefinition);
+        this.currentPage = this.definition.getInitialPage();
+        this.pageSize = this.definition.getPageSize();
         this.customPageFieldId = this.definition.getCustomPageId();
-	}
+    }
 
-	public void doPageLoad() throws BindingException {
+    public void doPageLoad() throws BindingException {
         clearAllRows();
         collection.flushCachedItems();
         int start = getStartIndex();
         List items = collection.getItems(start, this.pageSize);
         for (Iterator iter = items.iterator(); iter.hasNext();) {
-			RepeaterItem item = (RepeaterItem) iter.next();
-	        if (item == null) break;
+            RepeaterItem item = (RepeaterItem) iter.next();
+            if (item == null) {
+                break;
+            }
             if (item.getRow() != null) {
-            	addRow(item.getRow());
+                addRow(item.getRow());
             } else {
                 RepeaterRow thisRow = addRow();
                 item.setRow(thisRow);
                 collection.getAdapter().populateRow(item);
             }
         }
-        
+
         // set customPageField
         if (this.customPageField != null) {
             StaticSelectionList selectionList = new StaticSelectionList(this.customPageField.getDatatype());
             int j;
-            for (j = 0; j <= this.getMaxPage();j++) {
-                selectionList.addItem(new Integer(j),(j+1)+"");
+            for (j = 0; j <= this.getMaxPage(); j++) {
+                selectionList.addItem(new Integer(j), (j + 1) + "");
             }
             this.customPageField.setSelectionList(selectionList);
             this.customPageField.setValue(new Integer(this.currentPage));
@@ -79,7 +81,7 @@ public class EnhancedRepeater extends Re
     public void doPageSave() throws BindingException {
         List tempUpdatedRows = new ArrayList();
         List tempInsertedRows = new ArrayList();
-        
+
         List cache = collection.getCachedItems();
         // iterate rows in the form model...
         int formRowCount = getSize();
@@ -87,78 +89,80 @@ public class EnhancedRepeater extends Re
             Repeater.RepeaterRow thisRow = getRow(i);
             boolean found = false;
             for (int j = 0; j < cache.size(); j++) {
-            	RepeaterItem item = (RepeaterItem) cache.get(j);
-            	if (item == null) break;
-            	if (item.getRow() == thisRow) {
-                	// Found the matching row
-                	// TODO we need a way to know if the row was really modified or not, maybe a FormHandler?
-                	tempUpdatedRows.add(item);
+                RepeaterItem item = (RepeaterItem) cache.get(j);
+                if (item == null) {
+                    break;
+                }
+                if (item.getRow() == thisRow) {
+                    // Found the matching row
+                    // TODO we need a way to know if the row was really modified or not, maybe a FormHandler?
+                    tempUpdatedRows.add(item);
                     found = true;
                     break;
                 }
             }
             if (!found) {
-            	tempInsertedRows.add(thisRow);
+                tempInsertedRows.add(thisRow);
             }
         }
-        
+
         List toDelete = new ArrayList();
         for (int j = 0; j < cache.size(); j++) {
-        	RepeaterItem item = (RepeaterItem) cache.get(j);
-        	if (item == null) break;
-        	boolean found = false;
+            RepeaterItem item = (RepeaterItem) cache.get(j);
+            if (item == null) {
+                break;
+            }
+            boolean found = false;
             for (int i = 0; i < formRowCount; i++) {
                 Repeater.RepeaterRow thisRow = getRow(i);
                 if (thisRow == item.getRow()) {
-                	found = true;
-                	break;
+                    found = true;
+                    break;
                 }
             }
             if (!found) {
-            	toDelete.add(item);
+                toDelete.add(item);
             }
         }
         for (Iterator iter = tempUpdatedRows.iterator(); iter.hasNext();) {
-			RepeaterItem ele = (RepeaterItem) iter.next();
-			collection.updateRow(ele);
-		}
+            RepeaterItem ele = (RepeaterItem) iter.next();
+            collection.updateRow(ele);
+        }
         for (Iterator iter = tempInsertedRows.iterator(); iter.hasNext();) {
-        	RepeaterRow row = (RepeaterRow) iter.next();
-			collection.addRow(row);
-		}
+            RepeaterRow row = (RepeaterRow) iter.next();
+            collection.addRow(row);
+        }
         for (Iterator iter = toDelete.iterator(); iter.hasNext();) {
-        	RepeaterItem ele = (RepeaterItem) iter.next();
-			collection.deleteRow(ele);
-		}
+            RepeaterItem ele = (RepeaterItem) iter.next();
+            collection.deleteRow(ele);
+        }
         collection.flushCachedItems();
     }
-	
+
     private int getStartIndex() {
         return this.currentPage * this.pageSize;
     }
-            
+
     public int getMaxPage() {
         return ((int)(Math.ceil((double)collection.getActualCollectionSize() / (double)pageSize))) - 1;
     }
-    
+
     public int getCustomPageWidgetValue() {
-        return ((Integer)this.customPageField.getValue()).intValue();
+        return ((Integer) this.customPageField.getValue()).intValue();
     }
-    
+
     public int getCurrentPage() {
         return currentPage;
     }
 
-    
-    
     /*
      * convenience methods for presentation
      */
-    
+
     public int getDisplayableCurrentPage() {
         return this.getCurrentPage() + 1;
     }
-    
+
     public int getDisplayableLastPage() {
         // increment if we created a new page for insertion
         if (this.getCurrentPage() > this.getMaxPage()) {
@@ -166,84 +170,84 @@ public class EnhancedRepeater extends Re
         }
         return this.getMaxPage() + 1;
     }
-    
+
     public boolean isFirstPage() {
         return this.getCurrentPage() == 0;
     }
-    
+
     public boolean isLastPage() {
-    	return this.getCurrentPage() >= this.getMaxPage();
+        return this.getCurrentPage() >= this.getMaxPage();
+    }
+
+    public int getPageSize() {
+        return pageSize;
+    }
+
+    public void setPageSize(int pageSize) {
+        this.pageSize = pageSize;
+    }
+
+    public boolean isEnhanced() {
+        return true;
+    }
+
+    public AttributesImpl getXMLElementAttributes() {
+        AttributesImpl elementAttributes = super.getXMLElementAttributes();
+        if (this.pageSize < Integer.MAX_VALUE) {
+            elementAttributes.addCDATAAttribute("page", String.valueOf(currentPage));
+        }
+        return elementAttributes;
     }
 
-	public int getPageSize() {
-		return pageSize;
-	}
-
-	public void setPageSize(int pageSize) {
-		this.pageSize = pageSize;
-	}
-
-	public boolean isEnhanced() {
-		return true;
-	}
-
-	public AttributesImpl getXMLElementAttributes() {
-		AttributesImpl elementAttributes = super.getXMLElementAttributes();
-	    if (this.pageSize < Integer.MAX_VALUE) {
-	    	elementAttributes.addCDATAAttribute("page", String.valueOf(currentPage));
-	    }
-		return elementAttributes;
-	}
-	
     private void addRow(RepeaterRow row) {
-    	rows.add(row);
+        rows.add(row);
         getForm().addWidgetUpdate(this);
     }
-    
+
     private void clearAllRows() {
-        rows.clear();    	
+        rows.clear();
         getForm().addWidgetUpdate(this);
     }
 
-	public void setCollection(RepeaterJXPathCollection collection) {
-		this.collection = collection;
-	}
+    public void setCollection(RepeaterJXPathCollection collection) {
+        this.collection = collection;
+    }
 
-	public void initialize() {
-		super.initialize();
+    public void initialize() {
+        super.initialize();
         Widget widget = getForm().lookupWidget(this.customPageFieldId);
         if (widget instanceof Field) {
-            this.customPageField = (Field)widget;
+            this.customPageField = (Field) widget;
         }
-	}
+    }
+
+    public RepeaterJXPathCollection getCollection() {
+        return collection;
+    }
+
+    public void refreshPage() throws BindingException {
+        doPageSave();
+        doPageLoad();
+    }
+
+    public void goToPage(int page) throws BindingException {
+        doPageSave();
+        this.currentPage = page;
+        doPageLoad();
+    }
+
+    public void sortBy(String field) throws BindingException {
+        doPageSave();
+        this.collection.sortBy(field);
+        this.currentPage = 0;
+        doPageLoad();
+    }
+
+    public void setFilter(String field, Object value) throws BindingException {
+        doPageSave();
+        this.collection.filter(field, value);
+        this.currentPage = 0;
+        doPageLoad();
+    }
 
-	public RepeaterJXPathCollection getCollection() {
-		return collection;
-	}
-
-	public void refreshPage() throws BindingException {
-		doPageSave();
-		doPageLoad();
-	}
-
-	public void goToPage(int page) throws BindingException {
-		doPageSave();
-		this.currentPage = page;
-		doPageLoad();
-	}
-
-	public void sortBy(String field) throws BindingException {
-		doPageSave();
-		this.collection.sortBy(field);
-		this.currentPage = 0;
-		doPageLoad();
-	}
-
-	public void setFilter(String field, Object value) throws BindingException {
-		doPageSave();
-		this.collection.filter(field, value);
-		this.currentPage = 0;
-		doPageLoad();		
-	}
-    
 }

Modified: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Messages.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Messages.java?rev=1573205&r1=1573204&r2=1573205&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Messages.java (original)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Messages.java Sat Mar  1 18:02:14 2014
@@ -58,7 +58,12 @@ public class Messages extends AbstractWi
 
     public void readFromRequest(FormContext formContext) {
         if (getCombinedState().isAcceptingInputs()) {
+            boolean changed = messages.size() > 0;
             messages.clear();
+            if (changed) {
+                getForm().addWidgetUpdate(this);
+            }
+
         }
     }
 

Modified: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinition.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinition.java?rev=1573205&r1=1573204&r2=1573205&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinition.java (original)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinition.java Sat Mar  1 18:02:14 2014
@@ -23,9 +23,9 @@ import org.apache.cocoon.forms.event.Act
 import org.apache.cocoon.forms.event.ActionListener;
 
 /**
- * Abstract repeater action. Subclasses will typically just self-add an
- * event handler that will act on the repeater.
- *
+ * Abstract repeater action. Subclasses will typically just self-add an event
+ * handler that will act on the repeater.
+ * 
  * @see RepeaterActionDefinitionBuilder
  * @version $Id$
  */
@@ -70,15 +70,15 @@ public abstract class RepeaterActionDefi
     /**
      * Get the name of the repeater on which to act. If <code>null</code>, the repeater
      * is the parent of the current widget (i.e. actions are in repeater rows). Otherwise,
-     * the repeater is a sibling of the current widget.
-     *
+     *the repeater is a sibling of the current widget.
+     * 
      * @return the repeater name (can be <code>null</code>).
      */
     public String getRepeaterName() {
         return this.name;
     }
 
-    //---------------------------------------------------------------------------------------------
+    // ---------------------------------------------------------------------------------------------
 
     /**
      * The definition of a repeater action that deletes the selected rows of a sibling repeater.
@@ -141,7 +141,7 @@ public abstract class RepeaterActionDefi
         }
     }
 
-    //---------------------------------------------------------------------------------------------
+    // ---------------------------------------------------------------------------------------------
 
     /**
      * The definition of a repeater action that adds a row to a sibling repeater.
@@ -157,11 +157,11 @@ public abstract class RepeaterActionDefi
                 public void actionPerformed(ActionEvent event) {
                     Repeater repeater = ((RepeaterAction)event.getSource()).getRepeater();
                     if (repeater instanceof EnhancedRepeater) {
-                    	try {
+                        try {
                             ((EnhancedRepeater) repeater).goToPage(((EnhancedRepeater) repeater).getMaxPage());
                         } catch (BindingException e) {
-							throw new CascadingRuntimeException("Error switching page", e);
-						}
+                            throw new CascadingRuntimeException("Error switching page", e);
+                        }
                     }
                     for (int i = 0; i < AddRowActionDefinition.this.insertRows; i++) {
                         repeater.addRow();
@@ -169,10 +169,10 @@ public abstract class RepeaterActionDefi
                 }
             });
         }
-        
+
     }
 
-    //---------------------------------------------------------------------------------------------
+    // ---------------------------------------------------------------------------------------------
 
     /**
      * The definition of a repeater action that insert rows before the selected rows in a sibling repeater,
@@ -224,22 +224,22 @@ public abstract class RepeaterActionDefi
             });
         }
     }
-    
+
     public static class SortActionDefinition extends RepeaterActionDefinition {
-    	protected String field = null;
-    	
+        protected String field = null;
+
         public SortActionDefinition(String repeaterName, String field) {
             super(repeaterName);
             this.field = field;
-            
+
             this.addActionListener(new ActionListener() {
                 public void actionPerformed(ActionEvent event) {
                     Repeater repeater = ((RepeaterAction)event.getSource()).getRepeater();
                     if (repeater instanceof EnhancedRepeater) {
-                    	EnhancedRepeater erep = (EnhancedRepeater) repeater;
+                        EnhancedRepeater erep = (EnhancedRepeater) repeater;
                         try {
                             if (repeater.validate()) {
-                            	erep.sortBy(SortActionDefinition.this.field);
+                                erep.sortBy(SortActionDefinition.this.field);
                             }
                         } catch (Exception e) {
                             throw new CascadingRuntimeException("Error switching page", e);
@@ -247,44 +247,43 @@ public abstract class RepeaterActionDefi
                     }
                 }
             });
-            
+
         }
     }
 
-  
     public static class ChangePageActionDefinition extends RepeaterActionDefinition {
 
-       protected int method;
-       
-       public static final int FIRST = 0; 
-       public static final int PREV = 1;
-       public static final int NEXT = 2;
-       public static final int LAST = 3;
-       public static final int CUSTOM = 4;
+        protected int method;
+
+        public static final int FIRST = 0;
+        public static final int PREV = 1;
+        public static final int NEXT = 2;
+        public static final int LAST = 3;
+        public static final int CUSTOM = 4;
 
         /**
          * initialize this definition with the other, sort of like a copy constructor
          */
         public void initializeFrom(WidgetDefinition definition) throws Exception {
             super.initializeFrom(definition);
-            if(definition instanceof ChangePageActionDefinition) {
-                ChangePageActionDefinition other = (ChangePageActionDefinition)definition;
+            if (definition instanceof ChangePageActionDefinition) {
+                ChangePageActionDefinition other = (ChangePageActionDefinition) definition;
                 this.method = other.method;
             } else {
-                throw new Exception("Definition to inherit from is not of the right type! (at "+getLocation()+")");
+                throw new Exception("Definition to inherit from is not of the right type! (at " + getLocation() + ")");
             }
         }
 
         public ChangePageActionDefinition(String repeaterName, int m) {
             super(repeaterName);
-            
+
             this.method = m;
-            
+
             this.addActionListener(new ActionListener() {
                 public void actionPerformed(ActionEvent event) {
                     Repeater repeater = ((RepeaterAction)event.getSource()).getRepeater();
                     if (repeater instanceof EnhancedRepeater) {
-                    	EnhancedRepeater erep = (EnhancedRepeater) repeater;
+                        EnhancedRepeater erep = (EnhancedRepeater) repeater;
                         int page = erep.getCurrentPage();
                         if (method == FIRST) {
                             page = 0;
@@ -301,15 +300,15 @@ public abstract class RepeaterActionDefi
                         }
                         try {
                             if (repeater.validate()) {
-                            	erep.goToPage(page);
+                                erep.goToPage(page);
                             }
                         } catch (Exception e) {
                             throw new CascadingRuntimeException("Error switching page", e);
                         }
-                    } 
+                    }
                 }
             });
         }
     }
-    
+
 }

Modified: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/forms-advanced-field-styling.xsl
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/forms-advanced-field-styling.xsl?rev=1573205&r1=1573204&r2=1573205&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/forms-advanced-field-styling.xsl (original)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/forms-advanced-field-styling.xsl Sat Mar  1 18:02:14 2014
@@ -671,22 +671,20 @@
       | fi:multivaluefield with a selection list and suggestions support
       +-->
   <xsl:template match="fi:multivaluefield[fi:styling/@type='MultiValueEditorWithSuggestion']">
-    <!-- <xsl:variable name="values" select="fi:values/fi:value/text()"/>
-    <xsl:variable name="popupUri" select="fi:styling/@popup-uri"/>
-    <xsl:variable name="popupLinkText" select="fi:styling/@popup-link-text"/>
-    <xsl:variable name="dataUrl" select="fi:styling/@dataUrl"/>
-    <xsl:variable name="popupSize" select="fi:styling/@popup-size"/>-->
-
+    <xsl:variable name="values" select="fi:values/fi:value/text()"/>
     <div id="{@id}" dojoType="forms:MultiValueEditorWithSuggestion" styleClass="multivalue-widget" dataUrl="{fi:styling/@dataUrl}"
         popupUri="{fi:styling/@popup-uri}" popupLinkText="{fi:styling/@popup-link-text}" popupSize="{fi:styling/@popup-size}">
+        <xsl:apply-templates select="." mode="styling" />
       <table>
         <tbody>
           <xsl:for-each select="fi:selection-list/fi:item">
             <xsl:variable name="value" select="@value"/>
-            <tr>
-              <td><xsl:value-of select="$value"/></td>
-              <td><xsl:copy-of select="fi:label/node()"/></td>
-            </tr>
+            <xsl:if test="$values[. = $value]">
+              <tr>
+                <td><xsl:value-of select="$value"/></td>
+                <td><xsl:copy-of select="fi:label/node()"/></td>
+              </tr>
+            </xsl:if>
           </xsl:for-each>
         </tbody>
       </table>

Modified: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/forms-field-styling.xsl
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/forms-field-styling.xsl?rev=1573205&r1=1573204&r2=1573205&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/forms-field-styling.xsl (original)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/forms-field-styling.xsl Sat Mar  1 18:02:14 2014
@@ -170,6 +170,9 @@
         <xsl:when test="local-name() = 'booleanfield' or fi:styling/@list-type = 'radio' or fi:styling/@list-type = 'checkbox'">
           <xsl:attribute name="onclick">cocoon.forms.submitForm(this)</xsl:attribute>
         </xsl:when>
+        <xsl:when test="fi:styling/@type = 'suggest'">
+          <xsl:attribute name="onchange">cocoon.forms.submitForm(this.domNode, this.name);</xsl:attribute>
+        </xsl:when>
         <xsl:otherwise>
           <xsl:attribute name="onchange">cocoon.forms.submitForm(this)</xsl:attribute>
         </xsl:otherwise>

Modified: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/DropdownDateTimePicker.js
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/DropdownDateTimePicker.js?rev=1573205&r1=1573204&r2=1573205&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/DropdownDateTimePicker.js (original)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/DropdownDateTimePicker.js Sat Mar  1 18:02:14 2014
@@ -36,7 +36,7 @@ dojo.widget.defineWidget("cocoon.forms.D
     {
         variant: "date", /* date, time or datetime */
 
-        pattern: "yyyy-MM-dd",
+        cPattern: "yyyy-MM-dd",
 
         showInputSample: "false", /* should a sample date entry be shown next to the input field? */
 
@@ -228,11 +228,11 @@ dojo.widget.defineWidget("cocoon.forms.D
 
             if (this.variant == "date") {
                 // pure date mode, assume pattern is only for dates
-                this.datePattern = this.pattern;
+                this.datePattern = this.cPattern;
                 return;
             } else if (this.variant == "time") {
                 // pure time mode, assume patter is only for times
-                this.timePattern = this.pattern;
+                this.timePattern = this.cPattern;
                 return;
             }
 
@@ -240,27 +240,27 @@ dojo.widget.defineWidget("cocoon.forms.D
             // http://www.unicode.org/reports/tr35/tr35-4.html#Date_Format_Patterns
             var timeFormattingChars = ["a", "h", "H", "K", "k", "m", "s", "S", "A", "z", "Z"];
 
-            var pattern = this.pattern;
-            if (pattern == null || pattern == "")
+            var cPattern = this.cPattern;
+            if (cPattern == null || cPattern == "")
                 return;
 
-            // search position of first time pattern character
+            // search position of first time cPattern character
             var beginTimePattern = -1;
-            for (var i = 0; i < pattern.length; i++) {
-                var c = pattern.charAt(i);
+            for (var i = 0; i < cPattern.length; i++) {
+                var c = cPattern.charAt(i);
                 if (dojo.lang.inArray(timeFormattingChars, c)) {
                     beginTimePattern = i;
                     break;
                 }
             }
 
-            // split pattern in date and time component
+            // split cPattern in date and time component
             if (beginTimePattern == -1) {
-                // pure date pattern
-                this.datePattern = pattern;
+                // pure date cPattern
+                this.datePattern = cPattern;
             } else {
-                this.datePattern = dojo.string.trimEnd(pattern.substr(0, beginTimePattern));
-                this.timePattern = pattern.substr(beginTimePattern, pattern.length);
+                this.datePattern = dojo.string.trimEnd(cPattern.substr(0, beginTimePattern));
+                this.timePattern = cPattern.substr(beginTimePattern, cPattern.length);
             }
         },
 

Modified: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/MultiValueEditorWithSuggestion.js
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/MultiValueEditorWithSuggestion.js?rev=1573205&r1=1573204&r2=1573205&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/MultiValueEditorWithSuggestion.js (original)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/MultiValueEditorWithSuggestion.js Sat Mar  1 18:02:14 2014
@@ -43,7 +43,6 @@ dojo.widget.defineWidget("cocoon.forms.M
         popupUri: "",
         popupSize: "",
         popupLinkText: "",
-        resourcesUri: cocoon.resourcesUri,
         templatePath: cocoon.resourcesUri + "/forms/js/templates/MultiValueEditorWithSuggestion.html",
 
         _setUpDataUrl: function() {
@@ -112,6 +111,8 @@ dojo.widget.defineWidget("cocoon.forms.M
                     dojo.event.browser.stopEvent(event);
                     this.entry.setValue("");
                     this.entry.setSelectedValue("");
+                    this._selectAll();
+                    this.select.onchange();
                     break;
             }
         },
@@ -174,6 +175,12 @@ dojo.widget.defineWidget("cocoon.forms.M
                 this.popupWindow.setUrl(this.popupUri);
             }
             this.popupWindow.showPopup(this.linkButton.id);
+        },
+
+        _deleteValues: function(event) {
+        	cocoon.forms.MultiValueEditorWithSuggestion.superclass._deleteValues.call(this, event);
+        	this._selectAll();
+          this.select.onchange();
         }
     }
 );

Modified: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/templates/InfoPopup.html
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/templates/InfoPopup.html?rev=1573205&r1=1573204&r2=1573205&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/templates/InfoPopup.html (original)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/templates/InfoPopup.html Sat Mar  1 18:02:14 2014
@@ -1,4 +1,20 @@
 <span style='white-space: nowrap'>
+<!--
+  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.
+-->
     <img src='${this.iconURL}' dojoAttachEvent='onclick:_onIconClick' dojoAttachPoint='buttonNode'
          style='vertical-align: middle; cursor: pointer; cursor: hand'/>
 

Propchange: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/templates/InfoPopup.html
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/templates/MultiValueDoubleList.html
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/templates/MultiValueDoubleList.html?rev=1573205&r1=1573204&r2=1573205&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/templates/MultiValueDoubleList.html (original)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/templates/MultiValueDoubleList.html Sat Mar  1 18:02:14 2014
@@ -1,4 +1,20 @@
 <div id="${this.widgetId}" class="${this.styleClass}">
+<!--
+  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.
+-->
   <table>
     <tr>
     <th>${this.availableListLabel}</th>

Modified: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/templates/MultiValueEditor.html
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/templates/MultiValueEditor.html?rev=1573205&r1=1573204&r2=1573205&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/templates/MultiValueEditor.html (original)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/templates/MultiValueEditor.html Sat Mar  1 18:02:14 2014
@@ -1,4 +1,20 @@
 <div id="${this.widgetId}">
+<!--
+  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.
+-->
   <input name="${this.cformsIdPrefix}:entry" id="${this.cformsIdPrefix}:entry"
         dojoAttachPoint="entry"/>
   <table>

Propchange: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/templates/MultiValueEditor.html
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/templates/MultiValueEditorWithSuggestion.html
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/templates/MultiValueEditorWithSuggestion.html?rev=1573205&r1=1573204&r2=1573205&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/templates/MultiValueEditorWithSuggestion.html (original)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/templates/MultiValueEditorWithSuggestion.html Sat Mar  1 18:02:14 2014
@@ -1,4 +1,20 @@
 <div id="${this.widgetId}" class="${this.styleClass}">
+<!--
+  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.
+-->
   <table>
     <tr>
       <td>Search:</td>
@@ -13,12 +29,12 @@
       <td/>
       <td>
         <select name="${this.widgetId}" id="${this.widgetId}:input" size="5" multiple="multiple" style="width:100%"
-          dojoAttachPoint="select">
+          dojoAttachPoint="select" onchange="${this.onchange}">
         </select>
       </td>
       <td width="20px">
         <a id="${this.widgetId}.link" href="#" dojoAttachPoint="linkButton">${this.popupLinkText}</a>
-        <br/>		
+        <br/>
         <img dojoAttachPoint="deleteButton" src="${this.resourcesUri}/forms/img/delete.gif"/>
         <br/>
         <img dojoAttachPoint="moveUpButton" src="${this.resourcesUri}/forms/img/move_up.gif"/>

Propchange: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/system/i18n/messages_pt_BR.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/samples/forms/contactsjson.xml
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/samples/forms/contactsjson.xml?rev=1573205&r1=1573204&r2=1573205&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/samples/forms/contactsjson.xml (original)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/samples/forms/contactsjson.xml Sat Mar  1 18:02:14 2014
@@ -1,4 +1,20 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
 <fi:selection-list
     xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
     xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">

Propchange: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/html/java/org/apache/cocoon/components/NekoHtmlSaxParser.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message