You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by aw...@apache.org on 2007/07/31 00:42:42 UTC
svn commit: r561171 - in
/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs:
Core.js Page.js StatusIndicator.js xhr/RequestQueue.js
Author: awiner
Date: Mon Jul 30 15:42:41 2007
New Revision: 561171
URL: http://svn.apache.org/viewvc?view=rev&rev=561171
Log:
JS cleanup from XHR work (TRINIDAD-46)
- Instead of TrRequestQueue.getInstance(), have TrPage.getInstance().getRequestQueue().
This way the page has a single request queue (which is ordered), but someone else
could create their own request queue if they wanted.
- Rename TrPage.sendFormPost() to TrPage.sendPartialFormPost() to be a bit clearer.
Modified:
myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js
myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Page.js
myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/StatusIndicator.js
myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/RequestQueue.js
Modified: myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js?view=diff&rev=561171&r1=561170&r2=561171
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js Mon Jul 30 15:42:41 2007
@@ -1786,7 +1786,7 @@
if (isPartial)
{
- TrPage.getInstance().sendFormPost(form, parameters);
+ TrPage.getInstance().sendPartialFormPost(form, parameters);
}
else
{
Modified: myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Page.js
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Page.js?view=diff&rev=561171&r1=561170&r2=561171
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Page.js (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Page.js Mon Jul 30 15:42:41 2007
@@ -19,6 +19,7 @@
function TrPage()
{
this._loadedLibraries = TrPage._collectLoadedLibraries();
+ this._requestQueue = new TrRequestQueue(window);
}
@@ -34,6 +35,14 @@
}
/**
+ * Return the shared request queue for the page.
+ */
+TrPage.prototype.getRequestQueue = function()
+{
+ return this._requestQueue;
+}
+
+/**
* Post the form for partial postback. Supports both standard AJAX
* posts and, for multipart/form posts, IFRAME-based transmission.
* @param actionForm{FormElement} the HTML form to post
@@ -41,13 +50,12 @@
* @param headerParams{Object} HTTP headers to include (ignored if
* the request must be a multipart/form post)
*/
-// TODO rename?
-TrPage.prototype.sendFormPost = function(
+TrPage.prototype.sendPartialFormPost = function(
actionForm,
params,
headerParams)
{
- TrRequestQueue.getInstance().sendFormPost(
+ this.getRequestQueue().sendFormPost(
this, this._requestStatusChanged,
actionForm, params, headerParams);
}
Modified: myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/StatusIndicator.js
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/StatusIndicator.js?view=diff&rev=561171&r1=561170&r2=561171
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/StatusIndicator.js (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/StatusIndicator.js Mon Jul 30 15:42:41 2007
@@ -25,7 +25,7 @@
if (!TrStatusIndicator._registered)
{
TrStatusIndicator._registered = new Object();
- TrRequestQueue.getInstance().addStateChangeListener(
+ TrPage.getInstance().getRequestQueue().addStateChangeListener(
TrStatusIndicator._handleStateChange);
}
Modified: myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/RequestQueue.js
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/RequestQueue.js?view=diff&rev=561171&r1=561170&r2=561171
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/RequestQueue.js (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/RequestQueue.js Mon Jul 30 15:42:41 2007
@@ -17,7 +17,6 @@
* under the License.
*/
-//FIXME: go from "listeners" to a callback approach
/**
* The RequestQueue class is a service to serialize the XML HTTP
* request communication from the client to the server.
@@ -43,13 +42,6 @@
TrRequestQueue._XMLHTTP_TYPE = 0;
TrRequestQueue._MULTIPART_TYPE = 1;
-TrRequestQueue.getInstance = function()
-{
- if (TrRequestQueue._INSTANCE == null)
- TrRequestQueue._INSTANCE = new TrRequestQueue(window);
- return TrRequestQueue._INSTANCE;
-}
-
TrRequestQueue.prototype.dispose = function()
{
// TODO aschwart
@@ -373,7 +365,8 @@
var xmlHttp = new TrXMLRequest();
xmlHttp.__dtsRequestContext = requestItem._context;
xmlHttp.__dtsRequestMethod = requestItem._method;
- xmlHttp.setCallback(TrRequestQueue._requestCallback);
+ var callback = TrUIUtils.createCallback(this, this._handleRequestCallback);
+ xmlHttp.setCallback(callback);
// xmlhttp request uses the same charset as its parent document's charset.
// There is no need to set the charset.
@@ -651,12 +644,6 @@
}
}
-TrRequestQueue._requestCallback = function(
- xmlRequest
- )
-{
- TrRequestQueue.getInstance()._handleRequestCallback(xmlRequest);
-}
/**
* Adds a listener to the request queue that is interested in its state change.