You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2009/04/09 17:12:13 UTC

svn commit: r763683 [1/2] - in /myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces: ./ _impl/ _impl/_util/ _impl/core/ _impl/xhrCore/ api/

Author: werpu
Date: Thu Apr  9 15:12:12 2009
New Revision: 763683

URL: http://svn.apache.org/viewvc?rev=763683&view=rev
Log:
https://issues.apache.org/jira/browse/MYFACES-2188

Committing merged codebase

Added:
    myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/
    myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/
    myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/
    myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_LangUtils.js
    myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_ListenerQueue.js
    myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Logger.js
    myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Utils.js
    myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/
    myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/jsf_impl.js
    myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/
    myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequest.js
    myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestQueue.js
    myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxResponse.js
    myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxUtils.js
    myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_Exception.js
    myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_Extensions.js
    myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_VbsUtils.vbs
    myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_xhrCoreAdapter.js
    myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/api/
    myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/api/OpenAjax.js
    myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/api/jsf.js

Added: myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_LangUtils.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_LangUtils.js?rev=763683&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_LangUtils.js (added)
+++ myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_LangUtils.js Thu Apr  9 15:12:12 2009
@@ -0,0 +1,321 @@
+
+
+/*
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *  under the License.
+ */
+
+var myfaces = null;
+/**
+ * A simple provide function
+ * fixing the namespaces
+ */
+function _reserveMyfacesNamespaces() {
+   /**
+     *
+     * reserve the namespaces used by the myfaces core
+     */
+    if ('undefined' != typeof OpenAjax && ( 'undefined' == typeof myfaces || null == myfaces)) {
+        OpenAjax.hub.registerLibrary("myfaces", "myfaces.apache.org", "1.0", null);
+    }
+
+    /*originally we had it at org.apache.myfaces, but we are now down to myfaces since the openajax seems to have problems registering more than a root domain and org is not only apache specific*/
+    if('undefined' == typeof myfaces || null == myfaces) {
+        myfaces = new Object();
+    }
+
+    if('undefined' == typeof(myfaces._impl) || null == myfaces._impl) {
+        myfaces._impl = new Object();
+    }
+
+    if('undefined' == typeof(myfaces._impl._util) || null == myfaces._impl._util) {
+        myfaces._impl._util = new Object();
+    }
+    if('undefined' == typeof(myfaces._impl.core) || null == myfaces._impl.core) {
+        myfaces._impl.core = new Object();
+    }
+    if('undefined' == typeof(myfaces._impl.xhrCore) || null == myfaces._impl.xhrCore) {
+        myfaces._impl.xhrCore = new Object();
+    }
+
+}
+
+_reserveMyfacesNamespaces();
+
+/**
+ * Central internal JSF2 Utils with code used
+ * by various aspects of the JSF2 Ajax subsystem
+ *
+ * Note parts of the code were crossported from the dojo
+ * javascript library (see license.txt for more details
+ * on the dojo bsd license)
+ */
+
+
+
+if ('undefined' == typeof(myfaces._impl._util._LangUtils) || null == myfaces._impl._util._LangUtils) {
+    myfaces._impl._util._LangUtils = function() {
+        }
+
+    myfaces._impl._util._LangUtils.global = this;
+
+    myfaces._impl._util._LangUtils._underTest = false;
+    myfaces._impl._util._LangUtils._logger = null;
+
+    myfaces._impl._util._LangUtils.isUnderTest = function() {
+        return this._underTest;
+    }
+
+
+    myfaces._impl._util._LangUtils.byId = function(/*object*/ reference) {
+        if(myfaces._impl._util._LangUtils.isString(reference)) {
+            return document.getElementById(reference);
+        }
+        return reference;
+    },
+
+    /**
+     * backported from dojo
+     * Converts an array-like object (i.e. arguments, DOMCollection) to an
+     array. Returns a new Array with the elements of obj.
+     * @param obj the object to "arrayify". We expect the object to have, at a
+     minimum, a length property which corresponds to integer-indexed
+     properties.
+     * @param offset the location in obj to start iterating from. Defaults to 0.
+     Optional.
+     * @param startWith An array to pack with the properties of obj. If provided,
+     properties in obj are appended at the end of startWith and
+     startWith is the returned array.
+     */
+    myfaces._impl._util._LangUtils._toArray = function(/*Object*/obj, /*Number?*/offset, /*Array?*/ startWith) {
+        //	summary:
+        //		Converts an array-like object (i.e. arguments, DOMCollection) to an
+        //		array. Returns a new Array with the elements of obj.
+        //	obj:
+        //		the object to "arrayify". We expect the object to have, at a
+        //		minimum, a length property which corresponds to integer-indexed
+        //		properties.
+        //	offset:
+        //		the location in obj to start iterating from. Defaults to 0.
+        //		Optional.
+        //	startWith:
+        //		An array to pack with the properties of obj. If provided,
+        //		properties in obj are appended at the end of startWith and
+        //		startWith is the returned array.
+        var arr = startWith || [];
+        for (var x = offset || 0; x < obj.length; x++) {
+            arr.push(obj[x]);
+        }
+        return arr; // Array
+    };
+
+    myfaces._impl._util._LangUtils.trimStringInternal = function(/*string*/ it,/*regexp*/ splitter) {
+        return myfaces._impl._util._LangUtils.strToArray(it, splitter).join(splitter);
+    };
+
+
+    myfaces._impl._util._LangUtils.strToArray = function(/*string*/ it,/*regexp*/ splitter) {
+        //	summary:
+        //		Return true if it is a String
+
+        if(!myfaces._impl._util._LangUtils.isString(it)) {
+            throw new Exception("myfaces._impl._util._LangUtils.strToArray param not of type string")
+        }
+        var resultArr = it.split(splitter);
+        for(var cnt = 0; cnt < resultArr.length; cnt++) {
+            resultArr[cnt] = myfaces._impl._util._LangUtils.trim(resultArr[cnt]);
+        }
+        return resultArr;
+    };
+
+    /**
+     * hyperfast trim
+     * http://blog.stevenlevithan.com/archives/faster-trim-javascript
+     */
+    myfaces._impl._util._LangUtils.trim = function(/*string*/) {
+
+        var	str = str.replace(/^\s\s*/, ''),
+        ws = /\s/,
+        i = str.length;
+        while (ws.test(str.charAt(--i)));
+        return str.slice(0, i + 1);
+    };
+
+    myfaces._impl._util._LangUtils.splitAndGetLast = function(theString, delimiter) {
+        var arr = theString.split(delimiter);
+        return arr[arr.length - 1];
+    };
+
+    
+
+    /**
+     * Backported from dojo
+     */
+    myfaces._impl._util._LangUtils.isString = function(/*anything*/ it) {
+        //	summary:
+        //		Return true if it is a String
+        return !!arguments.length && it != null && (typeof it == "string" || it instanceof String); // Boolean
+    };
+    /**
+     * hitch backported from dojo
+     * hitch allows to assign a function to a dedicated scope
+     * this is helpful in situations when function reassignments
+     * can happen
+     * (notably happens often in lazy xhr code)
+     */
+    myfaces._impl._util._LangUtils.hitch = function(/*Object*/scope, /*Function|String*/method /*,...*/) {
+        //	summary:
+        //		Returns a function that will only ever execute in the a given scope.
+        //		This allows for easy use of object member functions
+        //		in callbacks and other places in which the "this" keyword may
+        //		otherwise not reference the expected scope.
+        //		Any number of default positional arguments may be passed as parameters
+        //		beyond "method".
+        //		Each of these values will be used to "placehold" (similar to curry)
+        //		for the hitched function.
+        //	scope:
+        //		The scope to use when method executes. If method is a string,
+        //		scope is also the object containing method.
+        //	method:
+        //		A function to be hitched to scope, or the name of the method in
+        //		scope to be hitched.
+        //	example:
+        //	|	myfaces._impl._util._LangUtils.hitch(foo, "bar")();
+        //		runs foo.bar() in the scope of foo
+        //	example:
+        //	|	myfaces._impl._util._LangUtils.hitch(foo, myFunction);
+        //		returns a function that runs myFunction in the scope of foo
+        if (arguments.length > 2) {
+            return myfaces._impl._util._LangUtils._hitchArgs._hitchArgs.apply(myfaces._impl._util._LangUtils._hitchArgs, arguments); // Function
+        }
+        if (!method) {
+            method = scope;
+            scope = null;
+        }
+        if (this.isString(method)) {
+            scope = scope || window || function() {};/*since we do not have dojo global*/
+            if (!scope[method]) {
+                throw(['myfaces._impl._util._LangUtils: scope["', method, '"] is null (scope="', scope, '")'].join(''));
+            }
+            return function() {
+                return scope[method].apply(scope, arguments || []);
+            }; // Function
+        }
+        return !scope ? method : function() {
+            return method.apply(scope, arguments || []);
+        }; // Function
+    };
+    /*used internally to lazy init the logger*/
+    myfaces._impl._util._LangUtils._getLogger = function() {
+        if(null ==  myfaces._impl._util._LangUtils._logger) {
+            myfaces._impl._util._LangUtils._logger = myfaces._impl._util._Logger.getInstance();
+        }
+        return myfaces._impl._util._LangUtils._logger;
+    };
+
+    myfaces._impl._util._LangUtils._hitchArgs = function(scope, method /*,...*/) {
+        var pre = this._toArray(arguments, 2);
+        var named = this.isString(method);
+        return function() {
+            // arrayify arguments
+            var args = this._toArray(arguments);
+            // locate our method
+            var f = named ? (scope || myfaces._impl._util._LangUtils.global)[method] : method;
+            // invoke with collected args
+            return f && f.apply(scope || this, pre.concat(args)); // mixed
+        } // Function
+    };
+
+
+    /**
+     * Helper function to merge two maps
+     * into one
+     * @param dest the destination map
+     * @param source the source map
+     * @param overwriteDest if set to true the destination is overwritten if the keys exist in both maps
+     **/
+    myfaces._impl._util._LangUtils.mixMaps = function(/*map*/ destination, /*map*/source, /*boolean*/ overwriteDest) {
+        /**
+         * mixin code depending on the state of dest and the overwrite param
+         */
+        var _JSF2Utils = myfaces._impl._util._LangUtils;
+        var result = {};
+        var keyIdx = {};
+        for(var key in source) {
+            /**
+           *we always overwrite dest with source
+           *unless overWrite is not set or source does not exist
+           *but also only if dest exists otherwise source still is taken
+           */
+            if(!overwriteDest) {
+                /**
+                 *we use exists instead of booleans because we cannot reloy
+                 *on all values being non boolean, we would need an elvis
+                 *operator in javascript to shorten this :-(
+                 */
+                result[key] = _JSF2Utils.exists(dest,key) ? dest[key] : source[key];
+            } else {
+                result[key] = _JSF2Utils.exists(source,key) ? source[key] : dest[key];
+            }
+            keyIdx[key] = true;
+        }
+        for(var key in destination) {
+            /*if result.key does not exist we push in dest.key*/
+            result[key] = _JSF2Utils.exists(result,key) ? result[key] : destination[key];
+        }
+        return result;
+    };
+
+    /**
+     * check if an element exists in the root
+     */
+    myfaces._impl._util._LangUtils.exists = function(root, element) {
+        return ('undefined' != typeof root && null != root &&  'undefined' != typeof root[element] && null != root[element]);
+    }
+
+
+    /**
+     * checks if an array contains an element
+     * @param arr   array
+     * @param string_name string to check for
+     */
+    myfaces._impl._util._LangUtils.arrayContains = function(arr, string_name) {
+        for ( var loop = 0; loop < arr.length; loop++) {
+            if (arr[loop] == string_name) {
+                return true;
+            }
+        }
+        return false;
+    },
+
+    /**
+     *
+     */
+    myfaces._impl._util._LangUtils.arrayToString = function(/*String or array*/ arr, /*string*/ delimiter) {
+        if( myfaces._impl._util._LangUtils.isString(arr) ) {
+            return arr;
+        }
+        var finalDelimiter = (null == delimiter) ? "\n" : delimiter;
+
+        var resultArr = [];
+        for(var cnt = 0; cnt < arr.length; cnt ++) {
+            if(myfaces._impl._util._LangUtils.isString(arr[cnt])) {
+                resultArr.push(((delimiter == null) ? ("[" + cnt + "] ") : "") + arr[cnt]);
+            } else {
+                resultArr.push(((delimiter == null) ? ("[" + cnt + "] ") : "") + arr[cnt].toString());
+            }
+        }
+        return resultArr.join(finalDelimiter);
+    };
+   
+}

Added: myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_ListenerQueue.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_ListenerQueue.js?rev=763683&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_ListenerQueue.js (added)
+++ myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_ListenerQueue.js Thu Apr  9 15:12:12 2009
@@ -0,0 +1,82 @@
+/*
+ * a classical listener queue pattern
+ */
+
+
+_reserveMyfacesNamespaces();
+
+/**
+ * Simple listener queue with closures which shall be
+ * called
+ *
+ * idea:
+ * var queue = new myfaces._impl._util._ListenerQueue();
+ */
+if(!myfaces._impl._util._LangUtils.exists(myfaces, "_ListenerQueue")) {
+    myfaces._impl._util._ListenerQueue = function() {
+        this._queue = [];
+
+    }
+
+    myfaces._impl._util._ListenerQueue.prototype._assertListener = function(/*function*/listener) {
+        if("function" != typeof (listener)) {
+            throw new Exception("Error: myfaces._impl._util._ListenerQueue." + arguments.caller.toString() + "Parameter must be of type function");
+        }
+    }
+
+    myfaces._impl._util._ListenerQueue.prototype.add = function(/*function*/listener) {
+        this._assertListener( listener);
+        this._queue.push(listener);
+    }
+
+    myfaces._impl._util._ListenerQueue.prototype.remove = function(/*function*/listener) {
+        this._assertListener( listener);
+        /*find element in queue*/
+        var cnt = 0;
+        while(cnt < this._queue.length && this._queue[cnt] != listener) {
+            cnt += 1;
+        }
+        /*found*/
+        if(cnt < this._queue.length) {
+            this._queue[cnt] = null;
+            /*we remove the element now as fast as possible*/
+            this._queue.splice(cnt, 1);
+        }
+
+    }
+   /**
+     * generic broadcast with a number of arguments being passed down
+     * @param scope the execution scope for the event callback
+     * @param argument,...*  the arguments list which has to be passed
+     *                  down the queue function
+     */
+    myfaces._impl._util._ListenerQueue.prototype.broadcastScopedEvent = function(scope, /*any*/argument) {
+        for(var cnt = 0; cnt < this._queue.length; cnt ++) {
+            /**
+             * we call the original method under its original scope
+             * use hitch to keep the original scope in place
+             * because there is no way that I can keep it from here
+             **/
+            var varArgs = [];
+            for(var argsCnt = 1; argsCnt < arguments.length; argsCnt++) {
+                varArgs.push(arguments[argsCnt]);
+            }
+            this._queue[cnt].apply(scope, varArgs);
+        }
+    }
+
+    /**
+     * generic broadcast with a number of arguments being passed down
+     */
+    myfaces._impl._util._ListenerQueue.prototype.broadcastEvent = function(/*any*/argument) {
+        for(var cnt = 0; cnt < this._queue.length; cnt ++) {
+            /**
+             * we call the original method under its original scope
+             * use hitch to keep the original scope in place
+             * because there is no way that I can keep it from here
+             **/
+ 
+            this._queue[cnt].apply(null, arguments);
+        }
+    }
+};
\ No newline at end of file

Added: myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Logger.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Logger.js?rev=763683&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Logger.js (added)
+++ myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Logger.js Thu Apr  9 15:12:12 2009
@@ -0,0 +1,125 @@
+/**
+ * Generical simplified browser independend logger
+ * on browsers which offer a console object
+ * it logs into the
+ *
+ * It follows a factory pattern so that it can be reroutet
+ * to other debugging divs! Loggers are cached internally
+ * so using the factory should cause a limited performance
+ * overhead
+ *
+ * The output is either to the console if present
+ * or to a debugging div
+ * or to the outer document if nothing is present
+ *
+ * var logger = myfaces._impl._util._Logger.getInstance([loggingDivId]);
+ * log.error("myError");
+ * log.debug("from me", "this is my error");
+ * etc...
+ */
+
+_reserveMyfacesNamespaces();
+
+if(!myfaces._impl._util._LangUtils.exists(myfaces, "_Logger")) {
+    myfaces._impl._util._Logger = function() {
+        var targetDiv = document.getElementById("log_console");
+        this._targetDiv = targetDiv;/*null or a valid element*/
+        this._logLevel  = this.LOG_LEVEL_ALL;
+        this._hasConsole = ('undefined' != typeof console && null != typeof console);
+
+    };
+    myfaces._impl._util._Logger._loggerIdx = {};
+
+    myfaces._impl._util._Logger.prototype.LOG_LEVEL_ALL      = 1;
+    myfaces._impl._util._Logger.prototype.LOG_LEVEL_DEBUG    = 2;
+    myfaces._impl._util._Logger.prototype.LOG_LEVEL_ERROR    = 3;
+    myfaces._impl._util._Logger.prototype.LOG_LEVEL_WARN     = 4;
+    myfaces._impl._util._Logger.prototype.LOG_LEVEL_INFO     = 5;
+    myfaces._impl._util._Logger.prototype.LOG_LEVEL_OFF      = 6;
+
+    /*global logging configuration*/
+    myfaces._impl._util._Logger.LOG_CONSOLE     = true;
+    myfaces._impl._util._Logger.LOG_DIV         = true;
+    myfaces._impl._util._Logger.LOG_DOCUMENT    = true;
+    myfaces._impl._util._Logger.LOG_ALERT       = false;
+
+    myfaces._impl._util._Logger.getInstance = function(targetDiv) {
+        var retVal = null;
+        var targetDivId = null;
+        if('undefined' != typeof(targetDiv) && null != targetDiv) {
+            targetDivId = myfaces._impl._util._LangUtils.isString(targetDiv) ? targetDiv : targetDiv.id;
+            retVal = myfaces._impl._util._Logger._loggerIdx[targetDivId];
+        } else {
+            retVal = myfaces._impl._util._Logger._loggerIdx["myfaces._impl._util._Logger.standardLogger"];
+        }
+        if('undefined' != typeof retVal || null != retVal) {
+            return retVal;
+        }
+
+        retVal = new myfaces._impl._util._Logger();
+
+        if('undefined' != typeof(targetDiv) && null != targetDiv) {
+            retVal.setTargetDiv(targetDiv);
+            myfaces._impl._util._Logger._loggerIdx[targetDivId] = retVal;
+        } else {
+            myfaces._impl._util._Logger._loggerIdx["myfaces._impl._util._Logger.standardLogger"] = retVal;
+        }
+        return retVal;
+    };
+
+    myfaces._impl._util._Logger.prototype._setLogLevel = function(/*int*/ logLevel) {
+        this._logLevel = logLevel;
+    };
+
+    myfaces._impl._util._Logger.prototype._setTargetDiv = function(/*String*/ targetDiv) {
+        targetDiv = document.getElementById(targetDiv);
+        this._targetDiv = targetDiv;/*null or a valid element*/
+    };
+
+    /**
+     * main logging algorithm
+     * we either root into the console
+     * or into the dom
+     * or into the document
+     * or into alerts depending on whehther one or the other
+     * exists and the configuration!
+     */
+    myfaces._impl._util._Logger.prototype._logIt = function(/*String*/logType,/*caller arguments*/ varArgs) {
+        //TODO map the caller...
+        if(this._hasConsole) {
+            if(myfaces._impl._util._Logger.LOG_CONSOLE) {
+                //TODO find out how to reference the proper line number etc...
+                console[logType.toLowerCase()](myfaces._impl._util._LangUtils.arrayToString( arguments[1] ));
+            }
+        } else if(null != this._targetDiv) {
+            if(myfaces._impl._util._Logger.LOG_DIV) {
+                this._targetDiv.innerHTML = this._targetDiv.innerHTML + "<br /> ["+logType+"] : "+ myfaces._impl._util._LangUtils.arrayToString(arguments[1], " ");
+            }
+        } else { /*in case a target fails we use document.write*/
+            if(myfaces._impl._util._Logger.LOG_DOCUMENT) {
+                document.write("<br /> ["+logType+"] : " + myfaces._impl._util._LangUtils.arrayToString(arguments[1], " "));
+            }
+            if(myfaces._impl._util._Logger.LOG_ALERT) {
+                alert("<br /> ["+logType+"] : " + myfaces._impl._util._LangUtils.arrayToString(arguments[1], " "));
+            }
+
+        }
+    }
+
+    myfaces._impl._util._Logger.prototype.debug = function(/*Object*/varArgs/*,...*/) {
+        if(this._logLevel > this.LOG_LEVEL_DEBUG) return;
+        this._logIt("DEBUG", arguments);
+    };
+    myfaces._impl._util._Logger.prototype.error = function(varArgs/*,...*/) {
+        if(this._logLevel > this.LOG_LEVEL_ERROR) return;
+        this._logIt("ERROR", arguments);
+    };
+    myfaces._impl._util._Logger.prototype.warn = function(varArgs/*,...*/) {
+        if(this._logLevel > this.LOG_LEVEL_WARN) return;
+        this._logIt("WARN", arguments);
+    };
+    myfaces._impl._util._Logger.prototype.info = function(/*Object*/varArgs/*,...*/) {
+        if(this._logLevel > this.LOG_LEVEL_WARN) return;
+        this._logIt("INFO", arguments);
+    };
+}
\ No newline at end of file

Added: myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Utils.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Utils.js?rev=763683&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Utils.js (added)
+++ myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Utils.js Thu Apr  9 15:12:12 2009
@@ -0,0 +1,208 @@
+/*
+ * Copyright 2009 Ganesh Jung
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Author: Ganesh Jung (latest modification by $Author: werpu $)
+ * Version: $Revision: 1.3 $ $Date: 2009/04/09 13:58:56 $
+ *
+ */
+
+if(!window.myfaces) window.myfaces = {};
+if(!myfaces.xhrCore) myfaces.xhrCore = {};
+
+/**
+ * Constructor
+ */
+myfaces._impl._util._Utils = function() {
+	
+    }
+
+/**
+ * [STATIC]
+ * Run through the given Html item and execute the inline scripts
+ * (IE doesn't do this by itself)
+ * @param {HtmlElement} item
+ */
+myfaces._impl._util._Utils.runScripts = function(item) {
+    if (item.nodeType == 1) { // only if it's an element node
+        if (item.tagName.toLowerCase() == 'script') {
+            try {
+                var test = item.text;
+                var go = true;
+                while (go) {
+                    go = false;
+                    if (test.substring(0, 1) == " ") {
+                        test = test.substring(1);
+                        go = true;
+                    }
+                    if (test.substring(0, 4) == "<!--") {
+                        test = test.substring(4);
+                        go = true;
+                    }
+                    if (test.substring(0, 11) == "//<![CDATA[") {
+                        test = test.substring(11);
+                        go = true;
+                    }
+                }
+                window.execScript(test); // run the script
+            } catch (e) {
+                myfaces._impl.xhrCore_Exception.throwNewError ("Utils", "runScripts", e);
+            }
+        } else {
+            var child = item.firstChild;
+            while (child) {
+                myfaces._impl._util._Utils.runScripts(child);
+                child = child.nextSibling;
+            }
+        }
+    }
+}
+
+/**
+ * Simple delete on an existing item
+ */
+myfaces._impl._util._Utils.deleteItem = function(itemIdToReplace) {
+    var item = document.getElementById(itemIdToReplace);
+    if (item == null) {
+        myfaces._impl.xhrCore_Exception.throwNewWarning
+        ("Utils", "deleteItem", "Unknown Html-Component-ID: " + itemIdToReplace);
+        return;
+    }
+
+    item.parentNode.removeChild(item);
+}
+
+/**
+ * [STATIC]
+ * Replaces HTML elements through others
+ * @param {String} itemIdToReplace - ID of the element to replace
+ * @param {String} newTag - the new tag
+ * @param {HTML Element} form - form element that is parent of the element
+ */
+myfaces._impl._util._Utils.replaceHtmlItem = function(itemIdToReplace, newTag, form) {
+    try {
+        var item = myfaces._impl._util._Utils.getElementFromForm(itemIdToReplace, form);
+        if (item == null) {
+            myfaces._impl.xhrCore_Exception.throwNewWarning
+            ("Utils", "replaceHTMLItem", "Unknown Html-Component-ID: " + itemIdToReplace);
+            return;
+        }
+
+        if (newTag != "") {
+            if (typeof window.Range != 'undefined'
+                && typeof Range.prototype.createContextualFragment == 'function') {
+                var range = document.createRange();
+                range.setStartBefore(item);
+                var fragment = range.createContextualFragment(newTag);
+                item.parentNode.insertBefore(fragment, item);
+            } else {
+                item.insertAdjacentHTML('beforeBegin', newTag);
+            }
+            if (myfaces._impl._util._Utils.isUserAgentInternetExplorer()) {
+                myfaces._impl._util._Utils.runScripts(item.previousSibling);
+            }
+        }
+
+        // and remove the old item
+        item.parentNode.removeChild(item);
+    } catch (e) {
+        myfaces._impl.xhrCore_Exception.throwNewError ("Utils", "replaceHTMLItem", e);
+    }
+};
+
+/**
+ * [STATIC]
+ * Determines whether the user agent is IE or not
+ * @return {boolean} - true if it is IE
+ */
+myfaces._impl._util._Utils.isUserAgentInternetExplorer = function() {
+    return window.ActiveXObject;
+};
+
+/**
+ * [STATIC]
+ * gets an element from a form with its id -> sometimes two elements have got
+ * the same id but are located in different forms -> MyFaces 1.1.4 two forms ->
+ * 2 inputHidden fields with ID jsf_tree_64 & jsf_state_64 ->
+ * http://www.arcknowledge.com/gmane.comp.jakarta.myfaces.devel/2005-09/msg01269.html
+ * @param {String} itemId - ID of the HTML element located inside the form
+ * @param {Html-Element} form - form element containing the element
+ * @return {Html-Element} - return the element if found else null
+ */
+myfaces._impl._util._Utils.getElementFromForm = function(itemId, form) {
+    try {
+        if('undefined' == typeof form || form == null) {
+            return document.getElementById(itemId);
+        }
+
+        var fLen = form.elements.length;
+        for ( var f = 0; f < fLen; f++) {
+            var element = form.elements[f];
+            if (element.id != null && element.id == itemId) {
+                return element;
+            }
+        }
+        // element not found inside the form -> try document.getElementById
+        // (kann be null if element doesn't exist)
+        return document.getElementById(itemId);
+    } catch (e) {
+        myfaces._impl.xhrCore_Exception.throwNewError ("Utils", "getElementFromForm", e);
+    }
+};
+
+/**
+ * [STATIC]
+ * gets a parent of an item with a given tagname
+ * @param {HtmlElement} item - child element
+ * @param {String} parentName - TagName of parent element
+ */
+myfaces._impl._util._Utils.getParent = function(item, parentName) {
+    try {
+        // parent tag parentName suchen
+        var parentItem = item.parentNode;
+        while (parentItem != null
+            && parentItem.tagName.toLowerCase() != parentName) {
+            parentItem = parentItem.parentNode;
+        }
+        if (parentItem != null) {
+            return parentItem;
+        } else {
+            myfaces._impl.xhrCore_Exception.throwNewWarning
+            ("Utils", "getParent", "The item has no parent with type <" + parentName + ">");
+            return null;
+        }
+    } catch (e) {
+        myfaces._impl.xhrCore_Exception.throwNewError ("Utils", "getParent", e);
+    }
+};
+
+/**
+ * [STATIC]
+ * gets the child of an item with a given tagname
+ * @param {HtmlElement} item - parent element
+ * @param {String} childName - TagName of child element
+ * @param {String} itemName - name-Attribut the child can have (can be null)
+ */
+myfaces._impl._util._Utils.getChild = function(item, childName, itemName) {
+    var childItems = item.childNodes;
+    for ( var c = 0, cLen = childItems.length; c < cLen; c++) {
+        if (childItems[c].tagName != null
+            && childItems[c].tagName.toLowerCase() == childName
+            && (itemName == null || (itemName != null && itemName == childItems[c]
+                .getAttribute("name")))) {
+            return childItems[c];
+        }
+    }
+    return null;
+}

Added: myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/jsf_impl.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/jsf_impl.js?rev=763683&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/jsf_impl.js (added)
+++ myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/jsf_impl.js Thu Apr  9 15:12:12 2009
@@ -0,0 +1,410 @@
+/*
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *  under the License.
+ */
+
+_reserveMyfacesNamespaces();
+
+if (!myfaces._impl._util._LangUtils.exists(myfaces, "_jsfImpl")) {
+
+    myfaces._impl.core._jsfImpl = function() {
+
+        //third option myfaces._impl.xhrCoreAjax which will be the new core impl for now
+        this._requestHandler = new myfaces._impl.xhrCore_Ajax();
+
+        /**
+         * external event listener queue!
+         */
+        this._eventListenerQueue = new myfaces._impl._util._ListenerQueue();
+
+        /**
+         * external error listener queue!
+         */
+        this._errorListenerQueue = new myfaces._impl._util._ListenerQueue();
+
+    };
+
+    /*CONSTANTS*/
+
+    myfaces._impl.core._jsfImpl.prototype._PROP_PARTIAL_SOURCE = "javax.faces.partial.source";
+    myfaces._impl.core._jsfImpl.prototype._PROP_VIEWSTATE = "javax.faces.viewState";
+    myfaces._impl.core._jsfImpl.prototype._PROP_AJAX = "javax.faces.partial.ajax";
+    myfaces._impl.core._jsfImpl.prototype._PROP_EXECUTE = "javax.faces.partial.execute";
+    myfaces._impl.core._jsfImpl.prototype._PROP_RENDER = "javax.faces.partial.render";
+    myfaces._impl.core._jsfImpl.prototype._PROP_EVENT = "javax.faces.partial.event";
+
+    /*internal identifiers for options*/
+    myfaces._impl.core._jsfImpl.prototype._OPT_IDENT_ALL = "@all";
+    myfaces._impl.core._jsfImpl.prototype._OPT_IDENT_NONE = "@none";
+    myfaces._impl.core._jsfImpl.prototype._OPT_IDENT_THIS = "@this";
+    myfaces._impl.core._jsfImpl.prototype._OPT_IDENT_FORM = "@form";
+
+    /**
+     * collect and encode data for a given form element (must be of type form)
+     * find the javax.faces.ViewState element and encode its value as well!
+     * return a concatenated string of the encoded values!
+     *
+     * @throws an exception in case of the given element not being of type form!
+     * https://issues.apache.org/jira/browse/MYFACES-2110
+     */
+    myfaces._impl.core._jsfImpl.prototype.getViewState = function(formElement) {
+        /**
+         *  typecheck assert!, we opt for strong typing here
+         *  because it makes it easier to detect bugs
+         */
+
+        if ('undefined' == typeof(formElement)
+                || null == formElement
+                || 'undefined' == typeof(formElement.nodeName)
+                || null == formElement.nodeName
+                || formElement.nodeName.toLowerCase() != "form") {
+            throw Exception("jsf.viewState: param value not of type form!");
+        }
+        this._requestHandler.getViewState(formElement);
+    };
+
+    /**
+     * internal assertion check for the element parameter
+     * it cannot be null or undefined
+     * it must be either a string or a valid existing dom node
+     */
+    myfaces._impl.core._jsfImpl.prototype._assertElement = function(/*String|Dom Node*/ element) {
+        /*namespace remap for our local function context we mix the entire function namespace into
+         *a local function variable so that we do not have to write the entire namespace
+         *all the time
+         **/
+        var JSF2Utils = myfaces._impl._util._LangUtils;
+
+        /**
+         * assert element
+         */
+        if ('undefined' == typeof( element ) || null == element) {
+            throw new Exception("jsf.ajax, element must be set!");
+        }
+        if (!JSF2Utils.isString(element) && !(element instanceof Node)) {
+            throw new Exception("jsf.ajax, element either must be a string or a dom node");
+        }
+
+        element = JSF2Utils.byId(element);
+        if ('undefined' == typeof element || null == element) {
+            throw new Exception("Element either must be a string to a or must be a valid dom node");
+        }
+
+    };
+
+    myfaces._impl.core._jsfImpl.prototype._assertFunction = function(func) {
+        if ('undefined' == typeof func || null == func) {
+            return;
+        }
+        if (!(func instanceof Function)) {
+            throw new Exception("Functioncall " + func + " is not a function! ");
+        }
+    }
+
+    /**
+     * Captures the event arguments according to the list in the specification
+     */
+    myfaces._impl.core._jsfImpl.prototype._caputureEventArgs = function(/*Dom node*/node, /*event*/ obj) {
+        /*
+         * TODO encode the rest of the arguments
+         * once it is clear what has to be done here
+         */
+        var retVal = {};
+        return retVal;
+    };
+
+    /**
+     * this function has to send the ajax requests
+     *
+     * following request conditions must be met:
+     * <ul>
+     *  <li> the request must be sent asynchronously! </li>
+     *  <li> the request must be a POST!!! request </li>
+     *  <li> the request url must be the form action attribute </li>
+     *  <li> all requests must be queued with a client side request queue to ensure the request ordering!</li>
+     * </ul>
+     *
+     * @param element: any dom element no matter being it html or jsf, from which the event is emitted
+     * @param event: any javascript event supported by that object
+     * @param options : map of options being pushed into the ajax cycle
+     */
+    myfaces._impl.core._jsfImpl.prototype.request = function(/*String|Dom Node*/ element, /*|EVENT|*/ event, /*{|OPTIONS|}*/ options) {
+
+        /*namespace remap for our local function context we mix the entire function namespace into
+         *a local function variable so that we do not have to write the entire namespace
+         *all the time
+         **/
+        var JSF2Utils = myfaces._impl._util._LangUtils;
+
+        /**
+         * we cross reference statically hence the mapping here
+         * the entire mapping between the functions is stateless
+         */
+
+        /*assert a valid structure of a given element*/
+        this._assertElement(element);
+        /*assert if the onerror is set and once if it is set it must be of type function*/
+        this._assertFunction(options.onerror);
+        /*assert if the onevent is set and once if it is set it must be of type function*/
+        this._assertFunction(options.onevent);
+
+        /**
+         * fetch the parent form first
+         */
+        var sourceForm = myfaces._impl._util._Utils.getParent(element, "form");
+
+        if ('undefined' == typeof sourceForm || null == sourceForm) {
+            sourceForm = document.forms[0];
+        }
+
+        /*
+         * We make a copy of our options because
+         * we should not touch the incoming params!
+         */
+        var passThroughArguments = JSF2Utils.mixMaps({}, options, true);
+
+        /*
+         * binding contract the javax.faces.partial.source must be
+         * set according to the december 2008 preview
+         */
+        passThroughArguments[this._PROP_PARTIAL_SOURCE] = element.id;
+
+        /*
+         * javax.faces.partial.ajax must be set to true
+         */
+        passThroughArguments[this._PROP_AJAX] = true;
+
+        /**
+         * if execute or render exist
+         * we have to pass them down as a blank delimited string representation
+         * of an array of ids!
+         */
+        if (JSF2Utils.exists(passThroughArguments, "execute")) {
+            /*the options must be a blank delimited list of strings*/
+            var execString = JSF2Utils.arrayToString(passThroughArguments.execute, ' ');
+            var execNone = execString.indexOf(this._OPT_IDENT_NONE) != -1;
+            var execAll = execString.indexOf(this._OPT_IDENT_ALL) != -1;
+            if (!execNone && !execAll) {
+                execString = execString.replace(this._OPT_IDENT_FORM, sourceForm.id);
+                execString = execString.replace(this._OPT_IDENT_THIS, element.id);
+
+                passThroughArguments[this._PROP_EXECUTE] = execString;
+            } else if (execAll) {
+                passThroughArguments[this._PROP_EXECUTE] = this._OPT_IDENT_ALL;
+            }
+
+            passThroughArguments.execute = null;
+            /*remap just in case we have a valid pointer to an existing object*/
+            delete passThroughArguments.execute;
+        } else {
+            passThroughArguments[this._PROP_EXECUTE] = element.id;
+        }
+        if (JSF2Utils.exists(passThroughArguments, "render")) {
+            var renderString = JSF2Utils.arrayToString(passThroughArguments.render, ' ');
+            var renderNone = renderString.indexOf(this._OPT_IDENT_NONE) != -1;
+            var renderAll = renderString.indexOf(this._OPT_IDENT_ALL) != -1;
+            if (!renderNone && !renderAll) {
+                renderString = renderString.replace(this._OPT_IDENT_FORM, sourceForm.id);
+                renderString = renderString.replace(this._OPT_IDENT_THIS, element.id);
+                passThroughArguments[this._PROP_RENDER] = JSF2Utils.arrayToString(passThroughArguments.render, ' ');
+                passThroughArguments.render = null;
+            } else if (renderAll) {
+                passThroughArguments[this._PROP_RENDER] = this._OPT_IDENT_ALL;
+
+            }
+            delete passThroughArguments.render;
+        }
+
+        /*additional passthrough cleanup*/
+        /*ie6 supportive code to prevent browser leaks*/
+        passThroughArguments.onevent = null;
+        delete passThroughArguments.onevent;
+        /*ie6 supportive code to prevent browser leaks*/
+        passThroughArguments.onerror = null;
+        delete passThroughArguments.onevent;
+
+        var extractedEventArguments = this._caputureEventArgs(element, event);
+
+        if ('undefined' != typeof event && null != event) {
+            passThroughArguments[this._PROP_EVENT] = event.type;
+        }
+
+        /*we mixin the event params but do not override existing ones!*/
+
+        passThroughArguments = JSF2Utils.mixMaps(passThroughArguments, extractedEventArguments, false);
+
+        /**
+         * ajax pass through context with the source
+         * onevent and onerror
+         */
+        var ajaxContext = {};
+        ajaxContext.source = element;
+        ajaxContext.onevent = options.onevent;
+        ajaxContext.onerror = options.onerror;
+
+       //implementation specific options
+       //TODO check out if we can add them to the context instead it would make more sense there
+       var implementationOptions = null;
+        if('undefined' != typeof passThroughArguments.myfaces && null != passThroughArguments.myfaces) {
+            implementationOptions = passThroughArguments.myfaces;
+            delete passThroughArguments.myfaces;
+        }
+
+        var viewState = "dummy"; //jsf.getViewState(sourceForm);
+        //this._requestHandler.imhere();
+        this._requestHandler._ajaxRequest(element, ajaxContext, sourceForm.action, viewState,  passThroughArguments, implementationOptions);
+
+        /*
+         * TODO #61
+         * https://issues.apache.org/jira/browse/MYFACES-2112
+         * done
+         */
+    };
+
+    myfaces._impl.core._jsfImpl.prototype.addOnError = function(/*function*/errorListener) {
+        /*error handling already done in the assert of the queue*/
+        this._errorListenerQueue.add(errorListener);
+    }
+
+    myfaces._impl.core._jsfImpl.prototype.addOnEvent = function(/*function*/eventListener) {
+        /*error handling already done in the assert of the queue*/
+        this._eventListenerQueue.add(eventListener);
+    }
+
+    /**
+     * RI compatibility method
+     * TODO make sure this method also occurrs in the specs
+     * otherwise simply pull it
+     */
+    myfaces._impl.core._jsfImpl.prototype.sendError = function sendError(/*Object*/request, /*Object*/ context, /*String*/ name, /*String*/ serverErrorName, /*String*/ serverErrorMessage) {
+        var eventData = {};
+        eventData.type = this._MSG_TYPE_ERROR;
+
+        eventData.name = name;
+        eventData.source = context.source;
+        eventData.responseXML = request.responseXML;
+        eventData.responseText = request.responseText;
+        eventData.responseCode = request.status;
+
+        /**/
+        if (myfaces._impl._util._LangUtils.exists(context, "onerror")) {
+            context.onerror(eventData);
+        }
+        /*now we serve the queue as well*/
+        this._errorListenerQueue.broadcastEvent(eventData);
+    };
+
+    /**
+     * RI compatibility method
+     * TODO make sure this method also occurrs in the specs
+     * otherwise simply pull it
+     */
+    myfaces._impl.core._jsfImpl.prototype.sendEvent = function sendEvent(/*Object*/request, /*Object*/ context, /*even name*/ name) {
+        var eventData = {};
+        eventData.type = this._MSG_TYPE_EVENT;
+
+        eventData.name = name;
+        eventData.source = context.source;
+        if (name !== this._AJAX_STAGE_BEGIN) {
+            eventData.responseXML = request.responseXML;
+            eventData.responseText = request.responseText;
+            eventData.responseCode = request.status;
+        }
+
+        /**/
+        if (myfaces._impl._util._LangUtils.exists(context, "onevent")) {
+            /*calling null to preserve the original scope*/
+            context.onevent.call(null, eventData);
+        }
+        /*now we serve the queue as well*/
+        this._eventListenerQueue.broadcastEvent(eventData);
+    }
+
+    /**
+     * processes the ajax response if the ajax request completes successfully
+     * @param {xhrRequest} request the ajax request!
+     * @param {Map} context, context map keeping context data not being passed down over
+     * the request boundary but kept on the client
+     */
+    myfaces._impl.core._jsfImpl.prototype.response = function(request, context) {
+        this._requestHandler._ajaxResponse(request, context);
+        /**
+         * TODO #62
+         * https://issues.apache.org/jira/browse/MYFACES-2114
+         */
+    };
+    /**
+     * @return the current project state emitted by the server side method:
+     * javax.faces.application.Application.getProjectStage()
+     */
+    myfaces._impl.core._jsfImpl.prototype.getProjectStage = function() {
+
+        return "#{facesContext.application.projectStage}";
+        /**
+         * TODO #62
+         * https://issues.apache.org/jira/browse/MYFACES-2115
+         */
+    };
+
+
+  /**
+   * implementation of the external chain function
+   * moved into the impl
+   *
+   * according to the ri the source will bhe the scope
+   * for the functions the event will be the object passed
+   * @param {Object} source the source which also becomes
+   * the scope for the calling function (not sure if this is correct however
+   * the RI does it that way!
+   * @param {Event} event the event object being passed down into the
+   */
+   myfaces._impl.core._jsfImpl.prototype.chain = function(source, event) {
+        var len = arguments.length;
+        if(len < 3) return;
+        //now we fetch from what is given from the parameter list
+        //we cannot work with splice here in any performant way so we do it the hard way
+        //arguments only are give if not set to undefined even null values!
+
+        var thisVal = ('object' == typeof source ) ? source: null;
+        var param   = ('undefined' != typeof event) ? event: null;
+
+        for(loop = 2; loop < len; loop++) {
+            //we do not change the scope of the incoming functions
+            //but we reuse the argument array capabilities of apply
+            var retVal = false;
+            //The spec states arbitrary codeblock
+            //the ri wraps everything into functions
+            //we do it differently here,
+            //
+            //We wrap only if the block itself
+            //is not a function! Should be compatible
+            //to the ri, but saner in its usage because
+            //it saves one intermediate step in most cases
+            //not my personal design decision, I probably would
+            //enforce functions only to keep the caller code clean,
+            //oh well
+            if('function' == typeof arguments[loop]) {    
+                 retVal = arguments[loop].call(thisVal, param);
+            } else {
+                 retVal = (new Function("evt", arguments[loop])).call(thisVal, param);
+            }
+            //now if one function returns null in between we stop the execution of the cycle
+            //here
+            if('undefined' != typeof retVal && retVal === false) return;
+        }
+   };
+    
+    //for debugging purposes only remove before going into production
+    var myfaces_JSFDebug = new myfaces._impl.core._jsfImpl();
+
+}

Added: myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequest.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequest.js?rev=763683&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequest.js (added)
+++ myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequest.js Thu Apr  9 15:12:12 2009
@@ -0,0 +1,168 @@
+/*
+ * Copyright 2009 Ganesh Jung
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Author: Ganesh Jung (latest modification by $Author: werpu $)
+ * Version: $Revision: 1.2 $ $Date: 2009/04/09 13:02:00 $
+ *
+ */
+
+_reserveMyfacesNamespaces();
+
+/**
+ * Constructor
+ * @param {HtmlElement} sourceItem - Item that triggered the request
+ * @param {String} actionIds (JSF 2.0) - Client IDs of the components to trigger during execution phase
+ * @param {String} reRenderIds - Client IDs of the components to rerender
+ * @param {String} alarmThreshold - errorlevel
+ * @param {String} triggerElement - designation for AjaxRequest
+ * @param {String} partialIds - ClientIDs to submit in PartialSubmit (PPS)
+ * @param {Function} callbackFunction (JSF 2.0) - callback Function with XmlHttpRequest parameter
+ */
+myfaces._impl.xhrCore_AjaxRequest = function(sourceItem, actionIds, reRenderIds,
+		alarmThreshold, triggerElement, partialIds) {
+	this.m_exception = new myfaces._impl.xhrCore_Exception("myfaces._impl.xhrCore_AjaxRequest", this.alarmThreshold);
+	try {
+		this.m_actionIds = actionIds; 
+		this.m_reRenderIds = reRenderIds;
+		this.m_partialIds = partialIds;
+		this.m_contentType = "application/x-www-form-urlencoded";
+		this.m_sourceItem = sourceItem;
+		this.m_request = null;
+		this.m_response = new myfaces._impl.xhrCore_AjaxResponse(this.alarmThreshold);
+		this.m_ajaxUtil = new myfaces._impl.xhrCore_AjaxUtils(this.alarmThreshold);
+		this.m_requestQueue = null;
+		this.m_sourceItemParentForm = null;
+		this.m_triggerElement = triggerElement;
+	} catch (e) {
+		this.m_exception.throwError("Ctor", e);
+	}
+};
+
+/**
+ * Sends an Ajax request
+ * @param {RequestQueue} requestQueue - Queue object to trigger next request
+ */
+myfaces._impl.xhrCore_AjaxRequest.prototype.send = function(requestQueue) {
+	try {
+		this.m_requestQueue = requestQueue;
+
+		// FORM-Element holen
+		this.m_sourceItemParentForm = myfaces._impl._util._Utils.getParent(this.m_sourceItem, "form");
+
+		// partialIds behandeln (Form: idEins, idZwei, ...)
+		var partialIdsArray = null;
+		var partialFlag = "";
+		if (this.m_partialIds != null && this.m_partialIds.length > 0) {
+			partialIdsArray = this.m_partialIds.split(",");
+			partialFlag = "partial_submit=true&";
+		}
+
+		// Daten aus aktueller Form holen und Felder gleichzeitig disablen
+		requestParameters = this.m_ajaxUtil.processUserEntries(this.m_sourceItem,
+				this.m_sourceItemParentForm, partialIdsArray);
+
+		requestAction = this.m_sourceItemParentForm.action;
+		if (myfaces._impl._util._Utils.isUserAgentInternetExplorer()) {
+			// request-Objekt for Internet Explorer
+			try {
+				this.m_request = new ActiveXObject("Msxml2.XMLHTTP");
+			} catch (e) {
+				this.m_request = new ActiveXObject('Microsoft.XMLHTTP');
+			}
+		} else {
+			// request-Objekt for standard browser
+			this.m_request = new XMLHttpRequest();
+		}
+		this.m_request.open("POST", requestAction, true);
+		this.m_request.setRequestHeader("Content-Type", this.m_contentType);
+		this.m_request.setRequestHeader("Faces-Request", "partial/ajax");
+		this.m_request.onreadystatechange = myfaces._impl.xhrCore_AjaxRequestQueue.handleCallback;
+		this.m_request.send(requestParameters + this.m_triggerElement + "&"
+				+ partialFlag + this.m_actionIds + "&" + this.m_reRenderIds
+                + "&javax.faces.partial.ajax=true");
+	} catch (e) {
+		this.m_exception.throwError("send", e);
+	}
+};
+
+/**
+ * Callback method to process the Ajax response
+ * triggered by RequestQueue
+ */
+myfaces._impl.xhrCore_AjaxRequest.prototype.requestCallback = function() {
+	try {
+		if (this.isComplete() == true) {
+			this.m_response.processResponse(this.m_request, this.m_sourceItemParentForm);
+			this.m_requestQueue.processQueue();
+		} else if (this.isPending() == false && this.isFailed() == true) {
+			this.m_exception.throwWarning("requestCallback",
+					"Request failed.\nReason " + this.getHtmlStatusText());
+		}
+	} catch (e) {
+		this.m_exception.throwError("requestCallback", e);
+	}
+};
+
+/**
+ * Enable HTML elements
+ */
+myfaces._impl.xhrCore_AjaxRequest.prototype.enableElements = function() {
+	if (this.m_disableFlag == true) {
+		// alle Elemente aus dem Cache wieder enablen
+		this.m_ajaxUtil.enableElementsFromCache(this.m_disableTypesArr);
+	}
+};
+
+/**
+ * @return {String} status text of request
+ */
+myfaces._impl.xhrCore_AjaxRequest.prototype.getHtmlStatusText = function() {
+	return this.m_request.statusText;
+};
+
+/**
+ * @return {boolean} true if ajax request successfull
+ */
+myfaces._impl.xhrCore_AjaxRequest.prototype.isComplete = function() {
+	return (this.m_request.readyState == 4 && this.m_request.status == 200);
+};
+
+/**
+ * @return {boolean} true if ajax request failed
+ */
+myfaces._impl.xhrCore_AjaxRequest.prototype.isFailed = function() {
+	return (this.m_request.readyState == 4 && this.m_request.status != 200);
+};
+
+/**
+ * @return {boolean} true while ajax request is running
+ */
+myfaces._impl.xhrCore_AjaxRequest.prototype.isPending = function() {
+	return (this.m_request.readyState == 1);
+};
+
+myfaces._impl.xhrCore_AjaxRequest.prototype.getSourceItem = function() {
+	return this.m_sourceItem;
+};
+myfaces._impl.xhrCore_AjaxRequest.prototype.setSourceItem = function(sourceItem) {
+	this.m_sourceItem = sourceItem;
+};
+
+myfaces._impl.xhrCore_AjaxRequest.prototype.getContentType = function() {
+	return this.m_contentType;
+};
+myfaces._impl.xhrCore_AjaxRequest.prototype.setContentType = function(contentType) {
+	this.m_contentType = contentType;
+};
\ No newline at end of file

Added: myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestQueue.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestQueue.js?rev=763683&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestQueue.js (added)
+++ myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestQueue.js Thu Apr  9 15:12:12 2009
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2009 Ganesh Jung
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Author: Ganesh Jung (latest modification by $Author: werpu $)
+ * Version: $Revision: 1.3 $ $Date: 2009/04/09 13:02:00 $
+ *
+ */
+
+_reserveMyfacesNamespaces();
+
+
+/**
+ * Constructor
+ */
+myfaces._impl.xhrCore_AjaxRequestQueue = function() {
+	this.m_request = null;
+	this.m_queuedRequests = new Object();
+	this.m_requestPending = false;
+	this.m_exception = new myfaces._impl.xhrCore_Exception("myfaces._impl.xhrCore_AjaxRequestQueue", "NONE");
+};
+
+/**
+ * [STATIC PROPERTIES]
+ */
+myfaces._impl.xhrCore_AjaxRequestQueue.queue = new myfaces._impl.xhrCore_AjaxRequestQueue();
+
+/**
+ * [STATIC]
+ * Triggers callback methode of class Request as callback referencing
+ * of an object is not possible
+ */
+myfaces._impl.xhrCore_AjaxRequestQueue.handleCallback = function() {
+	if (myfaces._impl.xhrCore_AjaxRequestQueue.queue.m_request != null) {
+        jsf.ajax.response(myfaces._impl.xhrCore_AjaxRequestQueue.queue.m_request.m_request, "dummy");
+	} else {
+		myfaces._impl.xhrCore_AjaxRequestQueue.queue.m_exception.throwWarning
+			("doRequestCallback", "No request object available");
+	}
+};
+
+/**
+ * send a reuest or keeps it in a queue
+ * @param {myfaces._impl.xhrCore_AjaxRequest} request - request to send
+ */
+myfaces._impl.xhrCore_AjaxRequestQueue.prototype.queueRequest = function(request) {
+	if (this.m_requestPending == false) {
+		this.m_requestPending = true;
+		this.m_request = request;
+		this.doRequest();
+	} else {
+		this.m_queuedRequest = request;
+	}
+};
+
+/**
+ * process queue, send request, if exists
+ */
+myfaces._impl.xhrCore_AjaxRequestQueue.prototype.processQueue = function() {
+	if (this.m_queuedRequest != null) {
+		this.m_request = this.m_queuedRequest;
+		this.m_queuedRequest = null;
+		this.doRequest();
+	} else {
+		this.m_requestPending = false;
+	}
+};
+
+/**
+ * send ajax request
+ */
+myfaces._impl.xhrCore_AjaxRequestQueue.prototype.doRequest = function() {
+	if (this.m_request != null) {
+		this.m_request.send(this);
+	} else {
+		this.m_exception.throwWarning("doRequest",
+				"No request object available");
+	}
+};
+
+/**
+ * cleanup queue
+ */
+myfaces._impl.xhrCore_AjaxRequestQueue.prototype.clearQueue = function() {
+	this.m_request = null;
+	this.m_queuedRequest = null;
+	this.m_requestPending = false;
+};
\ No newline at end of file

Added: myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxResponse.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxResponse.js?rev=763683&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxResponse.js (added)
+++ myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxResponse.js Thu Apr  9 15:12:12 2009
@@ -0,0 +1,148 @@
+/*
+ * Copyright 2009 Ganesh Jung
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Author: Ganesh Jung (latest modification by $Author: werpu $)
+ * Version: $Revision: 1.5 $ $Date: 2009/04/09 13:58:56 $
+ *
+ */
+
+_reserveMyfacesNamespaces();
+
+
+/**
+ * Constructor
+ * @param {String} alarmThreshold
+ */
+myfaces._impl.xhrCore_AjaxResponse = function(alarmThreshold) {
+	// Request object
+	this.m_request = null;
+	// Html-Form-Element from which the request comes from
+	this.m_htmlFormElement = null;	
+	this.alarmThreshold = alarmThreshold;
+	this.m_exception = new myfaces._impl.xhrCore_Exception("myfaces._impl.xhrCore_AjaxResponse", this.alarmThreshold);
+};
+
+/*partial response types*/
+myfaces._impl.xhrCore_AjaxResponse.prototype._RESPONSE_PARTIAL = "partial-response";
+myfaces._impl.xhrCore_AjaxResponse.prototype._RESPONSETYPE_ERROR = "error";
+myfaces._impl.xhrCore_AjaxResponse.prototype._RESPONSETYPE_REDIRECT = "redirect";
+myfaces._impl.xhrCore_AjaxResponse.prototype._RESPONSETYPE_REDIRECT = "changes";
+
+/*partial commands*/
+myfaces._impl.xhrCore_AjaxResponse.prototype._PCMD_CHANGES = "changes";
+myfaces._impl.xhrCore_AjaxResponse.prototype._PCMD_DELETE = "delete";
+myfaces._impl.xhrCore_AjaxResponse.prototype._PCMD_INSERT = "insert";
+myfaces._impl.xhrCore_AjaxResponse.prototype._PCMD_EVAL = "eval";
+myfaces._impl.xhrCore_AjaxResponse.prototype._PCMD_ATTRIBUTES = "attributes";
+myfaces._impl.xhrCore_AjaxResponse.prototype._PCMD_EXTENSION = "extension";
+
+/*various errors within the rendering stage*/
+myfaces._impl.xhrCore_AjaxResponse.prototype._ERROR_EMPTY_RESPONSE = "emptyResponse";
+myfaces._impl.xhrCore_AjaxResponse.prototype._ERROR_MALFORMEDXML = "malformedXML";
+myfaces._impl.xhrCore_AjaxResponse.prototype._MSG_SUCCESS = "success";
+
+/*various ajax message types*/
+myfaces._impl.xhrCore_AjaxResponse.prototype._MSG_TYPE_ERROR = "error";
+myfaces._impl.xhrCore_AjaxResponse.prototype._MSG_TYPE_EVENT = "event";
+myfaces._impl.xhrCore_AjaxResponse.prototype._AJAX_STAGE_BEGIN = "begin";
+myfaces._impl.xhrCore_AjaxResponse.prototype._AJAX_STAGE_COMPLETE = "complete";
+myfaces._impl.xhrCore_AjaxResponse.prototype._AJAX_STAGE_HTTPERROR = "httpError";
+
+/**
+ * uses response to start Html element replacement
+ * @param {XmlHttpRequest} request - request object
+ * @param {HtmlElement} htmlFormElement - HTML Form element which contains the element that triggered the request
+ */
+myfaces._impl.xhrCore_AjaxResponse.prototype.processResponse = function(request, htmlFormElement) {
+	this.m_request = request;
+	this.m_htmlFormElement = htmlFormElement;
+	try {
+        // TODO:
+        // Solution from
+        // http://www.codingforums.com/archive/index.php/t-47018.html
+        // to solve IE error 1072896658 when a Java server sends iso88591
+        // istead of ISO-8859-1
+        if ('undefined' == typeof(request) || null == request) {
+            throw Exception("jsf.ajaxResponse: The response cannot be null or empty!");
+        }
+
+        if (!myfaces._impl._util._LangUtils.exists(request, "responseXML")) {
+            jsf.ajax.sendError(request, context, this._ERROR_EMPTY_RESPONSE);
+            return;
+        }
+
+        var xmlContent = request.responseXML;
+        if (xmlContent.firstChild.tagName == "parsererror") {
+            jsf.ajax.sendError(request, context, this._ERROR_MALFORMEDXML);
+            return;
+        }
+        var partials = xmlContent.childNodes[0];
+        if ('undefined' == typeof partials || partials == null
+            || partials.tagName != this._RESPONSE_PARTIAL) {
+            jsf.ajax.sendError(request, context, this._ERROR_MALFORMEDXML);
+            return;
+        }
+
+        var childNodesLength = partials.childNodes.length;
+
+        for (var loop = 0; loop < childNodesLength; loop++) {
+            var childNode = partials.childNodes[loop];
+            var tagName = childNode.tagName;
+
+            if (tagName == this._PCMD_EVAL) {
+               //eval is always in CDATA blocks
+               eval(childNode.firstChild.nodeValue);
+
+               //this ought to be enough for eval
+               //however the run scripts still makes sense
+               //in the update and insert area for components
+               //which do not use the response writer properly
+               //we might add this one as custom option in update and
+               //insert!
+
+            } else if (tagName == this._PCMD_CHANGES) {
+                var changes = childNode.childNodes;
+
+                for (var i = 0; i < changes.length; i++) {
+                    if (changes[i].tagName == "update") {
+                        if (changes[i].getAttribute('id') == "javax.faces.ViewState") {
+                            document.getElementById("javax.faces.ViewState").value = changes[i].firstChild.data;
+                        } else {
+                            myfaces._impl._util._Utils.replaceHtmlItem(
+                                changes[i].getAttribute('id'), changes[i].firstChild.data, this.m_htmlFormElement);
+                        }
+                    }
+                }
+            } else if (tagName == this._PCMD_INSERT) {
+                //  this._responseHandler.doInsert(childNode);
+            } else if (tagName == this._PCMD_DELETE) {
+                // this._responseHandler.doDelete(childNode);
+
+                myfaces._impl._util._Utils.deleteItem(childNode.getAttribute("id"), "","");
+
+            } else if (tagName == this._PCMD_ATTRIBUTES) {
+                // this._responseHandler.doAtttributes(childNode);
+            } else if (tagName == this._PCMD_EXTENSION) {
+                //  this._responseHandler.doExtension(childNode);
+            } else {
+                jsf.ajax.sendError(request, context, this._ERROR_MALFORMEDXML);
+                return;
+            }
+        }
+        jsf.ajax.sendEvent(request, context, this._MSG_SUCCESS);
+	} catch (e) {
+		this.m_exception.throwError("processResponse", e);
+	}
+};

Added: myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxUtils.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxUtils.js?rev=763683&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxUtils.js (added)
+++ myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxUtils.js Thu Apr  9 15:12:12 2009
@@ -0,0 +1,189 @@
+/*
+ * Copyright 2009 Ganesh Jung
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Author: Ganesh Jung (latest modification by $Author: werpu $)
+ * Version: $Revision: 1.2 $ $Date: 2009/04/09 13:02:00 $
+ *
+ */
+
+_reserveMyfacesNamespaces();
+
+
+/**
+ * Constructor
+ * @param {String} alarmThreshold - Error Level
+ */
+myfaces._impl.xhrCore_AjaxUtils = function(alarmThreshold) {
+	// Exception Objekt
+	this.alarmThreshold = alarmThreshold;
+	this.PARTIAL_PREFIX = "_j4fry_partial_submit_";
+	this.m_exception = new myfaces._impl.xhrCore_Exception("myfaces._impl.xhrCore_AjaxUtils", this.alarmThreshold);
+};
+
+/**
+ * determines fields to submit
+ * @param {HtmlElement} item - item that triggered the event
+ * @param {HtmlElement} parentItem - form element item is nested in
+ * @param {Array} partialIds - ids fo PPS
+ */
+myfaces._impl.xhrCore_AjaxUtils.prototype.processUserEntries = function(item,
+		parentItem,	partialIds) {
+	try {
+		var form = parentItem;
+
+		if (form == null) {
+			this.m_exception.throwWarning("processUserEntries",
+					"Html-Component is not nested in a Form-Tag");
+			return null;
+		}
+
+		var stringBuffer = new Array();
+
+		if (partialIds != null && partialIds.length > 0) {
+			// recursivly check items
+			this.addNodes(form, false, partialIds, stringBuffer);
+		} else {
+			// add all nodes
+			var eLen = form.elements.length;
+			for ( var e = 0; e < eLen; e++) {
+				this.addField(form.elements[e], stringBuffer);
+			} // end of for (formElements)
+		}
+
+		// if triggered by a Button send it along
+		if (item.type != null && item.type.toLowerCase() == "submit") {
+			stringBuffer[stringBuffer.length] = encodeURIComponent(item.name);
+			stringBuffer[stringBuffer.length] = "=";
+			stringBuffer[stringBuffer.length] = encodeURIComponent(item.value);
+			stringBuffer[stringBuffer.length] = "&";
+		}
+
+		return stringBuffer.join("");
+	} catch (e) {
+		alert(e);
+		this.m_exception.throwError("processUserEntries", e);
+	}
+};
+
+/**
+ * checks recursively if contained in PPS
+ * @param {} node - 
+ * @param {} insideSubmittedPart -
+ * @param {} partialIds -
+ * @param {} disableFlag -
+ * @param {} disableTypesArr -
+ * @param {} stringBuffer -
+ */
+myfaces._impl.xhrCore_AjaxUtils.prototype.addNodes = function(node, insideSubmittedPart,
+		partialIds, stringBuffer) {
+	if (node != null && node.childNodes != null) {
+		var nLen = node.childNodes.length;
+		for ( var i = 0; i < nLen; i++) {
+			var child = node.childNodes[i];
+			var id = child.id;
+			var elementName = child.name;
+			if (child.nodeType == 1) {
+				var isPartialSubmitContainer = ((id != null) && partialIds
+						.contains(id.splitAndGetLast(":")));
+				if (insideSubmittedPart
+						|| isPartialSubmitContainer
+						|| (elementName != null && jsfKeywords
+								.contains(elementName))) {
+					// send id for PPS if uppermost submitted container
+					if (isPartialSubmitContainer) {
+						stringBuffer[stringBuffer.length] = this.PARTIAL_PREFIX;
+						stringBuffer[stringBuffer.length] = encodeURIComponent(id);
+						stringBuffer[stringBuffer.length] = "=&";
+					}
+					// node required fpr PPS
+					this.addField(child, stringBuffer);
+					if (insideSubmittedPart || isPartialSubmitContainer) {
+						// check for further children
+						this.addNodes(child, true, partialIds, stringBuffer);
+					}
+				} else {
+					// check for further children
+					this.addNodes(child, false, partialIds, stringBuffer);
+				}
+			}
+		}
+	}
+}
+
+/**
+ * add a single field to stringbuffer for param submission
+ * @param {HtmlElement} element - 
+ * @param {} stringBuffer - 
+ */
+myfaces._impl.xhrCore_AjaxUtils.prototype.addField = function(element, stringBuffer) {
+	var elementName = element.name;
+	var elementTagName = element.tagName.toLowerCase();
+	var elementType = element.type;
+	if (elementType != null) {
+		elementType = elementType.toLowerCase();
+	}
+
+	// routine for all elements
+	// rules:
+	// - process only inputs, textareas and selects
+	// - elements muest have attribute "name"
+	// - elements must not be disabled
+	if (((elementTagName == "input" || elementTagName == "textarea" || elementTagName == "select") && 
+		 (elementName != null && elementName != "")) && element.disabled == false) {
+
+		// routine for select elements
+		// rules:
+		// - if select-one and value-Attribute exist => "name=value"
+		// (also if value empty => "name=")
+		// - if select-one and value-Attribute don't exist =>
+		// "name=DisplayValue"
+		// - if select multi and multple selected => "name=value1&name=value2"
+		// - if select and selectedIndex=-1 don't submit
+		if (elementTagName == "select") {
+			// selectedIndex must be >= 0 sein to be submittet
+			if (element.selectedIndex >= 0) {
+				var uLen = element.options.length;
+				for ( var u = 0; u < uLen; u++) {
+					// find all selected options
+					if (element.options[u].selected == true) {
+						var elementOption = element.options[u];
+						stringBuffer[stringBuffer.length] = encodeURIComponent(elementName);
+						stringBuffer[stringBuffer.length] = "=";
+						if (elementOption.getAttribute("value") != null) {
+							stringBuffer[stringBuffer.length] = encodeURIComponent(elementOption.value);
+						} else {
+							stringBuffer[stringBuffer.length] = encodeURIComponent(elementOption.text);
+						}
+						stringBuffer[stringBuffer.length] = "&";
+					}
+				}
+			}
+		}
+
+		// routine for remaining elements
+		// rules:
+		// - don't submit no selects (processed above), buttons, reset buttons, submit buttons,
+		// - submit checkboxes and radio inputs only if checked
+		if ((elementTagName != "select" && elementType != "button"
+				&& elementType != "reset" && elementType != "submit" && elementType != "image")
+				&& ((elementType != "checkbox" && elementType != "radio") || element.checked)) {
+			stringBuffer[stringBuffer.length] = encodeURIComponent(elementName);
+			stringBuffer[stringBuffer.length] = "=";
+			stringBuffer[stringBuffer.length] = encodeURIComponent(element.value);
+			stringBuffer[stringBuffer.length] = "&";
+		}
+
+	}
+}

Added: myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_Exception.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_Exception.js?rev=763683&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_Exception.js (added)
+++ myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_Exception.js Thu Apr  9 15:12:12 2009
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2009 Ganesh Jung
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Author: Ganesh Jung (latest modification by $Author: werpu $)
+ * Version: $Revision: 1.2 $ $Date: 2009/04/09 13:02:00 $
+ *
+ */
+
+_reserveMyfacesNamespaces();
+
+
+myfaces._impl.xhrCore_Exception = function(sourceClass, threshold) {
+	this.m_class = sourceClass
+	this.m_threshold = threshold
+};
+
+/**
+ * [STATIC]
+ * static method used by static methods that throw errors
+ */
+myfaces._impl.xhrCore_Exception.throwNewError = function(sourceClass, func, exception) {
+	newException = new myfaces._impl.xhrCore_Exception(sourceClass, "ERROR");
+	newException.throwError(func, exception);
+};
+
+/**
+ * [STATIC]
+ * static method used by static methods that throw warnings
+ */
+myfaces._impl.xhrCore_Exception.throwNewWarning = function(sourceClass, func, message){
+	newException = new myfaces._impl.xhrCore_Exception(sourceClass, "WARNING");
+	newException.throwWarning(func, message);
+};
+
+/**
+ * throws errors
+ */
+myfaces._impl.xhrCore_Exception.prototype.throwError = function(func, exception) {
+	if (this.m_threshold == "ERROR") {
+		alert("[J4Fry ERROR]\n\n"
+				+ "Affected Class: " + this.m_class + "\n"
+				+ "Affected Method: " + func + "\n"
+				+ "Error name: " + exception.name + "\n"
+				+ "Error message: " + exception.message + "\n"
+				+ "Error description: " + exception.description	+ "\n"
+				+ "Error number: " + exception.number + "\n"
+				+ "Error line number: " + exception.lineNumber
+				+ "\n\nIf the error occurs many times, \nplease contact one of the J4Fry members on http://www.j4fry.org");
+	}
+	this.destroy();
+};
+
+/**
+ * throws warnings
+ */
+myfaces._impl.xhrCore_Exception.prototype.throwWarning = function(func, message) {
+	if (this.m_threshold == "WARNING" || this.m_threshold == "ERROR") {
+		alert("[J4Fry WARNING]\n[" + this.m_class + "::" + func + "]\n\n"
+				+ message);
+	}
+	this.destroy();
+};
+
+/**
+ * cleanup activities if an error occurs
+ */
+myfaces._impl.xhrCore_Exception.prototype.destroy = function() {
+	if (myfaces._impl.xhrCore_AjaxRequestQueue.queue &&
+			myfaces._impl.xhrCore_AjaxRequestQueue.queue != null) {
+		// clear RequestQueue when an exception occurs
+		myfaces._impl.xhrCore_AjaxRequestQueue.queue.clearQueue();
+	}
+};
\ No newline at end of file

Added: myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_Extensions.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_Extensions.js?rev=763683&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_Extensions.js (added)
+++ myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_Extensions.js Thu Apr  9 15:12:12 2009
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2009 Ganesh Jung
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Author: Ganesh Jung (latest modification by $Author: werpu $)
+ * Version: $Revision: 1.2 $ $Date: 2009/04/09 12:38:48 $
+ *
+ */
+
+/**
+ * Array.contains
+ * searches an Array for a String
+ * param {String} string_name - String to find
+ *
+ *
+ * TODO please remove this, this causes too much cross interference
+ * such things belong into _LangUtils!
+ * 
+ */
+Array.prototype.contains = function(string_name) {
+	for ( var i = 0; i < this.length; i++) {
+		if (this[i] == string_name) {
+			return true;
+		}
+	}
+	return false;
+};
+
+/**
+ * Array.toString
+ * translates an Array to a String @param {String} delimiter - Delimiter
+ * to separate Array elements
+ *
+ * added missing functionality
+ */
+Array.prototype.toString = function(delimiter) {
+	var result = "";
+	for ( var i = 0; i < this.length; i++) {
+		result += ((delimiter == null) ? ("[" + i + "] ") : "") + this[i];
+		if (i != this.length - 1)
+			result += (delimiter == null) ? "\n" : delimiter;
+	}
+	return result;
+};
+
+/**
+ * String.trim
+ * remove blank at head and tail of a string
+ *
+ * faster implementation in LangUtils
+ */
+String.prototype.trim = function() {
+	var i = 0;
+	var x = this.length - 1;
+	for (; this.charAt(i) == " "; i++) {}
+	for (; this.charAt(x) == " "; x--) {}
+	return this.substring(i, x + 1);
+};
+
+/**
+ * String.splitAndGetLast
+ * splits an Array at the Delimiter and returns last element
+ *
+ * added to LangUtils
+ */
+String.prototype.splitAndGetLast = function(delimiter) {
+	var arr = this.split(delimiter);
+	return arr[arr.length - 1];
+};
\ No newline at end of file

Added: myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_VbsUtils.vbs
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_VbsUtils.vbs?rev=763683&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_VbsUtils.vbs (added)
+++ myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_VbsUtils.vbs Thu Apr  9 15:12:12 2009
@@ -0,0 +1,7 @@
+Function BinaryToString(Binary)
+	Dim I,S
+	For I = 1 to LenB(Binary)
+		S = S & Chr(AscB(MidB(Binary,I,1)))
+	Next
+	BinaryToString = S
+End Function
\ No newline at end of file