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 2010/05/17 21:12:11 UTC

svn commit: r945316 - in /myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl: _util/_Dom.js xhrCore/_AjaxRequestQueue.js xhrCore/_Transports.js

Author: werpu
Date: Mon May 17 19:12:11 2010
New Revision: 945316

URL: http://svn.apache.org/viewvc?rev=945316&view=rev
Log:
https://issues.apache.org/jira/browse/MYFACES-2721
fixed a few minor things but not a real bug (well one bug which was never called)

Modified:
    myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js
    myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestQueue.js
    myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_Transports.js

Modified: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js?rev=945316&r1=945315&r2=945316&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js (original)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js Mon May 17 19:12:11 2010
@@ -618,8 +618,7 @@ myfaces._impl.core._Runtime.singletonExt
                 domNode.setAttribute(attribute, value);
             }
         }
-    }
-    ,
+    },
 
     /**
      * gets an element from a form with its id -> sometimes two elements have got

Modified: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestQueue.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestQueue.js?rev=945316&r1=945315&r2=945316&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestQueue.js (original)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestQueue.js Mon May 17 19:12:11 2010
@@ -19,14 +19,21 @@
  */
 myfaces._impl.core._Runtime.extendClass("myfaces._impl.xhrCore._AjaxRequestQueue", myfaces._impl._util._Queue, {
 
+    /**
+     * a pointer towards the currently processed
+     * request in our queue
+     */
     _curReq : null,
 
+    /**
+     * the standard constructur of our class
+     */
     constructor_: function(){
         this._callSuper("constructor");
     },
 
     /**
-     * delay request, then call queueNow
+     * delay request, then call enqueue
      * @param {Object} request (myfaces._impl.xhrCore._AjaxRequest) request to send
      */
     queueRequest : function(request) {
@@ -36,7 +43,7 @@ myfaces._impl.core._Runtime.extendClass(
             this.delayTimeoutId = window.setTimeout(
                     _Lang.hitch(this, function() {
                         this.clearDelayTimeout();
-                        this.queueNow(request);
+                        this.enqueue(request);
                     }), request._delay);
         } else {
             this.enqueue(request);

Modified: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_Transports.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_Transports.js?rev=945316&r1=945315&r2=945316&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_Transports.js (original)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_Transports.js Mon May 17 19:12:11 2010
@@ -44,8 +44,19 @@ myfaces._impl.core._Runtime.extendClass(
 
     /**
      * a singleton queue
+     * note the structure of our inheritance
+     * is that that _queue is attached to prototype
+     * and hence the pointer to the request qeue
+     * is shared over all instances
+     *
+     * if you need to have it per instance for complex objects
+     * you have to initialize in the constructor
+     *
+     * (This is the same limitation dojo class inheritance
+     * where our inheritance pattern is derived from has)
      */
     _queue: new myfaces._impl.xhrCore._AjaxRequestQueue(),
+
     _threshold: "ERROR",
 
     _Lang :  myfaces._impl._util._Lang,
@@ -60,7 +71,7 @@ myfaces._impl.core._Runtime.extendClass(
      * @param {Object} passThroughValues (Map) values to be passed through
      **/
     xhrQueuedPost : function(source, sourceForm, context, passThroughValues) {
-        this._queue.enqueue(
+        this._queue.queueRequest(
                 new myfaces._impl.xhrCore._AjaxRequest(this._getArguments(source, sourceForm, context, passThroughValues)));
     },
 
@@ -150,9 +161,9 @@ myfaces._impl.core._Runtime.extendClass(
      * @param context the context holding all values for further processing
      */
     _stdOnDone: function(request, context) {
-        var _Impl = myfaces._impl.core._Runtime.getGlobalConfig("jsfAjaxImpl", myfaces._impl.core.Impl);
+        this._loadImpl();
 
-        _Impl.sendEvent(request, context, _Impl._AJAX_STAGE_COMPLETE);
+        this._Impl.sendEvent(request, context, this._Impl._AJAX_STAGE_COMPLETE);
     },
 
     /**
@@ -163,10 +174,10 @@ myfaces._impl.core._Runtime.extendClass(
      */
     _stdOnSuccess: function(request, context) {
         //_onSuccess
-        var _Impl = myfaces._impl.core._Runtime.getGlobalConfig("jsfAjaxImpl", myfaces._impl.core.Impl);
+        this._loadImpl();
 
-        _Impl.response(request, context);
-        _Impl.sendEvent(request, context, _Impl._AJAX_STAGE_SUCCESS);
+        this._Impl.response(request, context);
+        this._Impl.sendEvent(request, context, this._Impl._AJAX_STAGE_SUCCESS);
         this._queue.processQueue();
 
     },
@@ -179,8 +190,8 @@ myfaces._impl.core._Runtime.extendClass(
      * @param context the context holding all values for further processing
      */
     _stdOnError: function(request, context) {
-        var _Impl = myfaces._impl.core._Runtime.getGlobalConfig("jsfAjaxImpl", myfaces._impl.core.Impl);
-        
+        this._loadImpl();
+
         //_onError
         var errorText;
         try {
@@ -195,7 +206,7 @@ myfaces._impl.core._Runtime.extendClass(
             errorText = "Request failed with unknown status";
         }
         //_onError
-        _Impl.sendError(request, context, myfaces._impl.core.Impl._ERROR_HTTPERROR,
+        this._Impl.sendError(request, context, myfaces._impl.core.Impl._ERROR_HTTPERROR,
                 myfaces._impl.core.Impl._ERROR_HTTPERROR, errorText);
     },
 
@@ -226,9 +237,10 @@ myfaces._impl.core._Runtime.extendClass(
      * @param exception the embedded exception
      */
     _stdErrorHandler: function(request, context, sourceClass, func, exception) {
-        var _Impl = myfaces._impl.core._Runtime.getGlobalConfig("jsfAjaxImpl", myfaces._impl.core.Impl);
+        this._loadImpl();
+        
         if (this._threshold == "ERROR") {
-            _Impl.sendError(request, context, _Impl._ERROR_CLIENT_ERROR, exception.name,
+            this._Impl.sendError(request, context, this._Impl._ERROR_CLIENT_ERROR, exception.name,
                     "MyFaces ERROR:" + this._Lang.createErrorMessage(sourceClass, func, exception));
         }
         this._queue.clear();
@@ -247,13 +259,20 @@ myfaces._impl.core._Runtime.extendClass(
      * @param exception the embedded exception
      */
     _stdWarningsHandler: function(request, context, sourceClass, func, exception) {
-        var _Impl = myfaces._impl.core._Runtime.getGlobalConfig("jsfAjaxImpl", myfaces._impl.core.Impl);
+        this._loadImpl();
 
         if (this._threshold == "WARNING" || this._threshold == "ERROR") {
-            _Impl.sendError(request, context, _Impl._ERROR_CLIENT_ERROR, exception.name,
+            this._Impl.sendError(request, context, this._Impl._ERROR_CLIENT_ERROR, exception.name,
                     "MyFaces WARNING:" + this._Lang.createErrorMessage(sourceClass, func, exception));
         }
         this.destroy();
+    },
+
+    _loadImpl: function() {
+        if(!this._Impl) {
+            this._Impl = myfaces._impl.core._Runtime.getGlobalConfig("jsfAjaxImpl", myfaces._impl.core.Impl);
+        }
+        return this._Impl;
     }
 
 });