You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ar...@apache.org on 2010/03/30 22:19:45 UTC

svn commit: r929254 - in /myfaces/trinidad/branches/jsf2_ajax.3: ./ trinidad-examples/trinidad-demo/src/main/webapp/components/ trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/ trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/

Author: arobinson74
Date: Tue Mar 30 20:19:45 2010
New Revision: 929254

URL: http://svn.apache.org/viewvc?rev=929254&view=rev
Log:
Small fixes including TRINIDAD-1768

Modified:
    myfaces/trinidad/branches/jsf2_ajax.3/   (props changed)
    myfaces/trinidad/branches/jsf2_ajax.3/trinidad-examples/trinidad-demo/src/main/webapp/components/inputFile.jspx   (contents, props changed)
    myfaces/trinidad/branches/jsf2_ajax.3/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Page.js
    myfaces/trinidad/branches/jsf2_ajax.3/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/IFrameXMLRequestEvent.js
    myfaces/trinidad/branches/jsf2_ajax.3/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/RequestQueue.js

Propchange: myfaces/trinidad/branches/jsf2_ajax.3/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar 30 20:19:45 2010
@@ -5,6 +5,6 @@
 /myfaces/trinidad/branches/ar-1715:908782
 /myfaces/trinidad/branches/ar_clientBehaviors:881469-891464
 /myfaces/trinidad/branches/jwaldman_StyleMap:754977-770778
-/myfaces/trinidad/branches/trinidad-1.2.x:923447,923460
+/myfaces/trinidad/branches/trinidad-1.2.x:923447,923460,929241
 /myfaces/trinidad/branches/trinidad-2.0.x:823098-895949
-/myfaces/trinidad/trunk:819601,819622,834147,886881,888973,893043,896231-908455,908699-921461
+/myfaces/trinidad/trunk:819601,819622,834147,886881,888973,893043,896231-908455,908699-921461,929242

Modified: myfaces/trinidad/branches/jsf2_ajax.3/trinidad-examples/trinidad-demo/src/main/webapp/components/inputFile.jspx
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/jsf2_ajax.3/trinidad-examples/trinidad-demo/src/main/webapp/components/inputFile.jspx?rev=929254&r1=929253&r2=929254&view=diff
==============================================================================
--- myfaces/trinidad/branches/jsf2_ajax.3/trinidad-examples/trinidad-demo/src/main/webapp/components/inputFile.jspx (original)
+++ myfaces/trinidad/branches/jsf2_ajax.3/trinidad-examples/trinidad-demo/src/main/webapp/components/inputFile.jspx Tue Mar 30 20:19:45 2010
@@ -1,48 +1,49 @@
-<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
-<!--
-    Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-	   
--->
-<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
-          xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
-          xmlns:trh="http://myfaces.apache.org/trinidad/html"
-          xmlns:tr="http://myfaces.apache.org/trinidad">
-  <jsp:directive.page contentType="text/html;charset=utf-8"/>
-  <f:view>
-    <tr:document title="InputFile Demo">
-      <tr:form usesUpload="true">
-        <tr:panelGroupLayout layout="vertical">
-          <f:facet name="separator">
-            <tr:separator/>
-          </f:facet>
-          <tr:panelGroupLayout layout="horizontal" partialTriggers="cb1">
-            <tr:commandLink immediate="true" text="Component Guide" action="guide"/>
-            <tr:spacer width="10"/>
-            <tr:goLink destination="http://myfaces.apache.org/trinidad/trinidad-api/tagdoc/tr_inputFile.html"
-                       text="Tag Documentation"/>
-          </tr:panelGroupLayout>
-          <tr:outputFormatted styleUsage="instruction" value="&lt;b>inputFile&lt;/b>"/>
-          <tr:inputFile binding="#{editor.component}" label="Label"
-                        valueChangeListener="#{ui.fileUploaded}"/>
-          <tr:commandButton text="Submit" id="cb1" partialSubmit="true" />
-          <jsp:directive.include file="editor.jspf"/>
-        </tr:panelGroupLayout>
-      </tr:form>
-    </tr:document>
-  </f:view>
-</jsp:root>
+<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
+          xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
+          xmlns:trh="http://myfaces.apache.org/trinidad/html"
+          xmlns:tr="http://myfaces.apache.org/trinidad">
+  <jsp:directive.page contentType="text/html;charset=utf-8"/>
+  <f:view>
+    <tr:document title="InputFile Demo">
+      <tr:form usesUpload="true">
+        <tr:panelGroupLayout layout="vertical">
+          <f:facet name="separator">
+            <tr:separator/>
+          </f:facet>
+          <tr:panelGroupLayout layout="horizontal" partialTriggers="cb1">
+            <tr:commandLink immediate="true" text="Component Guide" action="guide"/>
+            <tr:spacer width="10"/>
+            <tr:goLink destination="http://myfaces.apache.org/trinidad/trinidad-api/tagdoc/tr_inputFile.html"
+                       text="Tag Documentation"/>
+          </tr:panelGroupLayout>
+          <tr:outputFormatted styleUsage="instruction" value="&lt;b>inputFile&lt;/b>"/>
+          <tr:inputFile binding="#{editor.component}" label="Label"
+                        valueChangeListener="#{ui.fileUploaded}"
+                        partialTriggers="cb1" />
+          <tr:commandButton text="Submit" id="cb1" partialSubmit="true" />
+          <jsp:directive.include file="editor.jspf"/>
+        </tr:panelGroupLayout>
+      </tr:form>
+    </tr:document>
+  </f:view>
+</jsp:root>

Propchange: myfaces/trinidad/branches/jsf2_ajax.3/trinidad-examples/trinidad-demo/src/main/webapp/components/inputFile.jspx
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: myfaces/trinidad/branches/jsf2_ajax.3/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Page.js
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/jsf2_ajax.3/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Page.js?rev=929254&r1=929253&r2=929254&view=diff
==============================================================================
--- myfaces/trinidad/branches/jsf2_ajax.3/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Page.js (original)
+++ myfaces/trinidad/branches/jsf2_ajax.3/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Page.js Tue Mar 30 20:19:45 2010
@@ -120,13 +120,13 @@ TrPage.prototype._requestStatusChanged =
           {
             this._handleJsfAjaxResponse(requestEvent);
           }
-          else 
+          else
           {
             this._handlePprResponse(requestEvent, responseDocument);
           }
         }
       }
-      else 
+      else
       {
         // Should log some warning that we got an invalid response
       }
@@ -147,7 +147,7 @@ TrPage.prototype._requestStatusChanged =
 
 TrPage.prototype._handleJsfAjaxResponse = function (requestEvent)
 {
-  try 
+  try
   {
     var statusCode = requestEvent.getResponseStatusCode();
     if (statusCode >= 200 && statusCode < 300)
@@ -187,7 +187,7 @@ TrPage.prototype._handleJsfAjaxResponse 
     // TODO: do we need to do any additional processing here, for instance,
     // error processing?
   }
-  finally 
+  finally
   {
     delete this._ajaxOldDomElements;
     delete this._activeNode;
@@ -200,7 +200,6 @@ TrPage.prototype._handleJsfAjaxResponse 
  */
 TrPage.prototype._delegateResponseToJsfAjax = function (requestEvent, document)
 {
-  console.log("_delegateResponseToJsfAjax");
   // We wish to have JSF 2 handle the response. In order to do that we need to
   // construct the necessary parameters for the jsf.ajax.response method.
   //
@@ -216,9 +215,13 @@ TrPage.prototype._delegateResponseToJsfA
   {
     source = document.getElementById(source);
   }
-  var context = 
+  var context =
   {
-    "onevent" : null, "onerror" : null, "source" : source, "formid" : requestEvent.getFormId(), "render" : null
+    "onevent" : null,
+    "onerror" : null,
+    "source" : source,
+    "formid" : requestEvent.getFormId(),
+    "render" : null
   };
 
   jsf.ajax.response(request, context);
@@ -230,7 +233,6 @@ TrPage.prototype._handlePprResponse = fu
   {
     return this._delegateResponseToJsfAjax(requestEvent, document);
   }
-  console.log("_handlePprResponse");
   var documentElement = document.documentElement;
   var rootNodeName = TrPage._getNodeName(documentElement);
   if (rootNodeName == "partial-response")
@@ -285,7 +287,7 @@ TrPage.prototype._handlePprResponse = fu
       }
     }
   }
-  else 
+  else
   {
     // FIXME: log an error
     window.location.reload(true);
@@ -482,7 +484,7 @@ TrPage.prototype._handlePprResponseFragm
     tempDiv.innerHTML = "";
     bodyElement.removeChild(tempDiv);
   }
-  else 
+  else
   {
     // Convert the content of the fragment node into an HTML node that
     // we can insert into the document
@@ -525,7 +527,7 @@ TrPage.prototype._handlePprResponseFragm
       var currInstance = listeners[i + 1];
       if (currInstance != null)
         currListener.call(currInstance, targetNode, sourceNode);
-      else 
+      else
         currListener(targetNode, sourceNode);
     }
   }
@@ -648,7 +650,7 @@ TrPage.prototype._loadScript = function 
     {
       if (_agent.isIE)
         window.execScript(responseText);
-      else 
+      else
         window.eval(responseText);
     }
   }
@@ -665,14 +667,14 @@ TrPage.prototype._handlePprResponseScrip
   {
     this._loadScript(source);
   }
-  else 
+  else
   {
     var nodeText = TrPage._getTextContent(scriptNode);
     if (nodeText)
     {
       if (_agent.isIE)
         window.execScript(nodeText);
-      else 
+      else
         window.eval(nodeText);
     }
   }
@@ -726,7 +728,7 @@ TrPage._collectLoadedLibraries = functio
     // and firstChild) and it is not possible to implement this function.
     return null;
   }
-  else 
+  else
   {
     var loadedLibraries = new Object();
 
@@ -921,7 +923,7 @@ TrPage.prototype._notifyDomReplacementLi
       {
         currListener.call(currInstance, oldElem, newElem);
       }
-      else 
+      else
       {
         currListener(oldElem, newElem);
       }
@@ -968,7 +970,7 @@ TrPage.prototype._getDomToBeUpdated = fu
         "id" : null, "element" : document.body
       });
     }
-    else 
+    else
     {
       oldElements.push(
       {

Modified: myfaces/trinidad/branches/jsf2_ajax.3/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/IFrameXMLRequestEvent.js
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/jsf2_ajax.3/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/IFrameXMLRequestEvent.js?rev=929254&r1=929253&r2=929254&view=diff
==============================================================================
--- myfaces/trinidad/branches/jsf2_ajax.3/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/IFrameXMLRequestEvent.js (original)
+++ myfaces/trinidad/branches/jsf2_ajax.3/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/IFrameXMLRequestEvent.js Tue Mar 30 20:19:45 2010
@@ -58,13 +58,12 @@ TrIFrameXMLRequestEvent.prototype.getRes
 {
   var agentIsIE = _agent.isIE;
   var iframeDoc = this._iframeDoc;
-  if(agentIsIE && iframeDoc.XMLDocument)
+  if (agentIsIE && iframeDoc.XMLDocument)
     return iframeDoc.XMLDocument;
   else
     return iframeDoc;
 }
 
-
 /**
 * Returns the response of the Data Transfer Request as text.
 * NOTE: this method is valid only for TrXMLRequestEvent.STATUS_COMPLETE
@@ -103,9 +102,9 @@ TrIFrameXMLRequestEvent.prototype._isRes
   var agentIsIE = _agent.isIE;
   var iframeDoc = this._iframeDoc;
 
-  if(agentIsIE && iframeDoc.XMLDocument)
+  if (agentIsIE && iframeDoc.XMLDocument)
     return true;
-  else if(window.XMLDocument && (iframeDoc instanceof XMLDocument))
+  else if (window.XMLDocument && (iframeDoc instanceof XMLDocument))
     return true;
   else if (_agent.isSafari && iframeDoc.xmlVersion != null)
     return true;
@@ -137,14 +136,13 @@ TrIFrameXMLRequestEvent.prototype.isPprR
   if (agentIsIE && iframeDoc.XMLDocument)
   {
     var xmlDocument = iframeDoc.XMLDocument, childNodes = xmlDocument.childNodes;
-    console.log(xmlDocument);
     // In IE the xml PI is the first node
     if(childNodes.length >= 2 && childNodes[1].nodeName ==  "partial-response")
       pprResponse = true;
   }
   else
   {
-    if(iframeDoc.firstChild && iframeDoc.firstChild.nodeName ==  "partial-response")
+    if (iframeDoc.firstChild && iframeDoc.firstChild.nodeName ==  "partial-response")
       pprResponse = true;
   }
 

Modified: myfaces/trinidad/branches/jsf2_ajax.3/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/RequestQueue.js
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/jsf2_ajax.3/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/RequestQueue.js?rev=929254&r1=929253&r2=929254&view=diff
==============================================================================
--- myfaces/trinidad/branches/jsf2_ajax.3/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/RequestQueue.js (original)
+++ myfaces/trinidad/branches/jsf2_ajax.3/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/RequestQueue.js Tue Mar 30 20:19:45 2010
@@ -549,7 +549,7 @@ TrRequestQueue.prototype._doRequestThrou
 
   // store our context variables for later use
   this._source = requestItem.params ?
-    requestItem.params["javax.faces.source"] : null;
+    requestItem.params["javax.faces.source"] || requestItem.params["source"] : null;
   this._dtsContext = requestItem._context.context;
   this._dtsRequestMethod = requestItem._context.method;
   this._htmlForm = htmlForm;
@@ -566,7 +566,7 @@ TrRequestQueue.prototype._doRequestThrou
   htmlForm.target = frameName;
 
   this._appendParamNode(domDocument, htmlForm, "Tr-XHR-Message", "true");
-  
+
   // mstarets - not including jsf ajax parameter will let the server know that
   // this is a 'legacy' PPR request
   // this._appendParamNode(domDocument, htmlForm, "javax.faces.partial.ajax", "true");
@@ -576,8 +576,8 @@ TrRequestQueue.prototype._doRequestThrou
     if (params.source)
     {
       // Translate to JSF 2 payload
-      params["javax.faces.source"] = params.source;
-      delete params.source;
+      //params["javax.faces.source"] = params.source;
+      //delete params.source;
     }
     for (var key in params)
     {
@@ -633,6 +633,25 @@ TrRequestQueue.prototype._appendParamNod
     this._paramNodes = nodes;
   }
 
+  if (name == "source")
+  {
+    // The FormRenderer adds a source to the postscript element. As a result, the
+    // value needs to be set, not appended
+    var sourceElements = domDocument.getElementsByName("source");
+    if (sourceElements.length > 0)
+    {
+      for (var i = 0, size = sourceElements.length; i < size; ++i)
+      {
+        var element = sourceElements[i];
+        if (element.tagName == "INPUT")
+        {
+          element.value = value;
+          return;
+        }
+      }
+    }
+  }
+
   var node = domDocument.createElement("input");
   node.type = "hidden";
   node.name = name;