You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by sy...@apache.org on 2005/09/28 12:33:55 UTC
svn commit: r292159 - in /cocoon/branches/BRANCH_2_1_X: ./ src/blocks/
src/java/org/apache/cocoon/components/flow/
src/java/org/apache/cocoon/components/flow/javascript/fom/
src/java/org/apache/cocoon/matching/helpers/
src/java/org/apache/cocoon/transf...
Author: sylvain
Date: Wed Sep 28 03:33:42 2005
New Revision: 292159
URL: http://svn.apache.org/viewcvs?rev=292159&view=rev
Log:
New Ajax block, and prototypic CForms suggestion-lists
Removed:
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/BrowserUpdateTransformer.java
Modified:
cocoon/branches/BRANCH_2_1_X/blocks.properties
cocoon/branches/BRANCH_2_1_X/gump.xml
cocoon/branches/BRANCH_2_1_X/src/blocks/ (props changed)
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/flow/WebContinuation.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/flow/javascript/fom/FOM_WebContinuation.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/matching/helpers/WildcardHelper.java
Modified: cocoon/branches/BRANCH_2_1_X/blocks.properties
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/blocks.properties?rev=292159&r1=292158&r2=292159&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/blocks.properties (original)
+++ cocoon/branches/BRANCH_2_1_X/blocks.properties Wed Sep 28 03:33:42 2005
@@ -125,6 +125,8 @@
# its development as things might change over time before they are marked
# stable.
+#-----[dependency]: "ajax" is needed by "forms".
+#include.block.ajax=false
#-----[dependency]: "apples" depends on "forms" (for samples).
#include.block.apples=false
#-----[dependency]: "asciiart" is needed by "mail".
@@ -139,6 +141,7 @@
#include.block.eventcache=false
#-----[dependency]: "faces" depends on "portal", "taglib".
#include.block.faces=false
+#-----[dependency]: "forms" depends on "ajax".
#-----[dependency]: "forms" is needed by "apples", "javaflow", "ojb", "petstore", "portal", "querybean", "tour".
#include.block.forms=false
#-----[dependency]: "javaflow" depends on "forms", "ojb".
Modified: cocoon/branches/BRANCH_2_1_X/gump.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/gump.xml?rev=292159&r1=292158&r2=292159&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/gump.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/gump.xml Wed Sep 28 03:33:42 2005
@@ -937,6 +937,7 @@
</ant>
<depend project="cocoon" inherit="all"/>
+ <depend project="cocoon-block-ajax"/>
<depend project="xreporter-expression"/>
<depend project="jakarta-oro"/>
<depend project="nekohtml"/>
@@ -1639,6 +1640,26 @@
<nag from="Gump <general@gump.apache.org>" to="dev@cocoon.apache.org"/>
</project>
+ <project name="cocoon-block-ajax" status="unstable" dir="src/blocks/ajax">
+ <package>org.apache.cocoon</package>
+
+ <description>Ajax - Utilities and resources for Ajax applications.</description>
+
+ <ant target="gump-block">
+ <property name="block-name" value="ajax"/>
+ <property name="version" value="@@DATE@@"/>
+ </ant>
+
+ <depend project="cocoon" inherit="all"/>
+
+ <work nested="build/cocoon-@@DATE@@/blocks/forms/ajax"/>
+ <work nested="tools/anttasks"/>
+ <home nested="build/cocoon-@@DATE@@"/>
+
+ <jar name="blocks/ajax-block.jar"/>
+
+ <nag from="Gump <general@gump.apache.org>" to="dev@cocoon.apache.org"/>
+ </project>
<!--
********************************************
******** COCOON SUPPLIED PROJECTS ********
Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/
------------------------------------------------------------------------------
--- svn:externals (original)
+++ svn:externals Wed Sep 28 03:33:42 2005
@@ -1,2 +1,3 @@
-jcr https://svn.apache.org/repos/asf/cocoon/blocks/jcr/trunk
+ajax https://svn.apache.org/repos/asf/cocoon/blocks/ajax/trunk
forms https://svn.apache.org/repos/asf/cocoon/blocks/forms/trunk
+jcr https://svn.apache.org/repos/asf/cocoon/blocks/jcr/trunk
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/flow/WebContinuation.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/flow/WebContinuation.java?rev=292159&r1=292158&r2=292159&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/flow/WebContinuation.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/flow/WebContinuation.java Wed Sep 28 03:33:42 2005
@@ -16,9 +16,14 @@
package org.apache.cocoon.components.flow;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.commons.collections.iterators.IteratorEnumeration;
import org.apache.commons.lang.StringUtils;
/**
@@ -102,6 +107,10 @@
*/
protected ContinuationsDisposer disposer;
+ /**
+ * The attributes of this continuation
+ */
+ private Map attributes;
/**
* Create a <code>WebContinuation</code> object. Saves the object in
@@ -132,6 +141,57 @@
if (parentContinuation != null) {
this.parentContinuation.children.add(this);
}
+ }
+
+ /**
+ * Get an attribute of this continuation
+ *
+ * @param name the attribute name.
+ */
+ public Object getAttribute(String name) {
+ if (this.attributes == null)
+ return null;
+
+ return this.attributes.get(name);
+ }
+
+ /**
+ * Set an attribute of this continuation
+ *
+ * @param name the attribute name
+ * @param value its value
+ */
+ public void setAttribute(String name, Object value) {
+ if (this.attributes == null) {
+ this.attributes = Collections.synchronizedMap(new HashMap());
+ }
+
+ this.attributes.put(name, value);
+ }
+
+ /**
+ * Remove an attribute of this continuation
+ *
+ * @param name the attribute name
+ */
+ public void removeAttribute(String name) {
+ if (this.attributes == null)
+ return;
+
+ this.attributes.remove(name);
+ }
+
+ /**
+ * Enumerate the attributes of this continuation.
+ *
+ * @return an enumeration of strings
+ */
+ public Enumeration getAttributeNames() {
+ if (this.attributes == null)
+ return new IteratorEnumeration();
+
+ ArrayList keys = new ArrayList(this.attributes.keySet());
+ return new IteratorEnumeration(keys.iterator());
}
/**
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/flow/javascript/fom/FOM_WebContinuation.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/flow/javascript/fom/FOM_WebContinuation.java?rev=292159&r1=292158&r2=292159&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/flow/javascript/fom/FOM_WebContinuation.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/flow/javascript/fom/FOM_WebContinuation.java Wed Sep 28 03:33:42 2005
@@ -103,6 +103,26 @@
return "FOM_WebContinuation";
}
+ public Object jsFunction_getAttribute(String name) {
+ return org.mozilla.javascript.Context.toObject(
+ wk.getAttribute(name),
+ getParentScope());
+ }
+
+ public void jsFunction_setAttribute(String name, Object value) {
+ wk.setAttribute(name, unwrap(value));
+ }
+
+ public void jsFunction_removeAttribute(String name) {
+ wk.removeAttribute(name);
+ }
+
+ public Object jsFunction_getAttributeNames() {
+ return org.mozilla.javascript.Context.toObject(
+ wk.getAttributeNames(),
+ getParentScope());
+ }
+
public String jsGet_id() {
return wk.getId();
}
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/matching/helpers/WildcardHelper.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/matching/helpers/WildcardHelper.java?rev=292159&r1=292158&r2=292159&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/matching/helpers/WildcardHelper.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/matching/helpers/WildcardHelper.java Wed Sep 28 03:33:42 2005
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,7 +26,7 @@
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
- * @version CVS $Id: WildcardHelper.java,v 1.2 2004/03/05 13:02:57 bdelacretaz Exp $
+ * @version CVS $Id$
*/
public class WildcardHelper {
@@ -133,14 +133,14 @@
* match a pattern agains a string and isolates wildcard replacement into a
* <code>Stack</code>.
*/
- public static boolean match (HashMap map, String data,
- int[] expr) throws NullPointerException {
- if (map == null)
- throw new NullPointerException ("No map provided");
- if (data == null)
+ public static boolean match (HashMap map, String data, int[] expr)
+ throws NullPointerException {
+ if (data == null) {
throw new NullPointerException ("No data provided");
- if (expr == null)
+ }
+ if (expr == null) {
throw new NullPointerException ("No pattern expression provided");
+ }
char buff[] = data.toCharArray();
@@ -161,8 +161,10 @@
// The matching count
int mcount = 0;
- // We want the complete data be in {0}
- map.put(Integer.toString(mcount),data);
+ if ( map != null ) {
+ // We want the complete data be in {0}
+ map.put(Integer.toString(mcount),data);
+ }
// First check for MATCH_BEGIN
boolean matchBegin = false;
@@ -204,13 +206,15 @@
// Check for END's
if (exprchr == MATCH_END) {
- if (rsltpos > 0)
+ if (rsltpos > 0 && map != null) {
map.put(Integer.toString(++mcount),new String(rslt, 0, rsltpos));
+ }
// Don't care about rest of input buffer
return (true);
} else if (exprchr == MATCH_THEEND) {
- if (rsltpos > 0)
+ if (rsltpos > 0 && map != null ) {
map.put (Integer.toString(++mcount),new String(rslt, 0, rsltpos));
+ }
// Check that we reach buffer's end
return (buffpos == buff.length);
}
@@ -245,7 +249,9 @@
}
}
- map.put(Integer.toString(++mcount),new String (rslt, 0, rsltpos));
+ if ( map != null ) {
+ map.put(Integer.toString(++mcount),new String (rslt, 0, rsltpos));
+ }
rsltpos = 0;
}
}