Author: hlship
Date: Sat Jul  2 00:05:36 2011
New Revision: 1142123

URL: http://svn.apache.org/viewvc?rev=1142123&view=rev
Log:
TAP5-999: Add placeholders for additional T5 modules: ajax and func.

Added:
    
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-ajax.js
    
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-func.js
      - copied, changed from r1142122, 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-spi.js
Modified:
    
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/javascript/CoreJavaScriptStack.java
    
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-spi.js

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/javascript/CoreJavaScriptStack.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/javascript/CoreJavaScriptStack.java?rev=1142123&r1=1142122&r2=1142123&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/javascript/CoreJavaScriptStack.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/javascript/CoreJavaScriptStack.java
 Sat Jul  2 00:05:36 2011
@@ -70,6 +70,8 @@ public class CoreJavaScriptStack impleme
 
             ROOT + "/t5-core.js",
 
+            ROOT + "/t5-func.js",
+
             ROOT + "/t5-spi.js",
 
             ROOT + "/t5-prototype.js",
@@ -82,6 +84,8 @@ public class CoreJavaScriptStack impleme
 
             ROOT + "/t5-dom.js",
 
+            ROOT + "/t5-ajax.js",
+
             ROOT + "/tapestry.js",
 
             ROOT + "/tree.js" };

Added: 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-ajax.js
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-ajax.js?rev=1142123&view=auto
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-ajax.js
 (added)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-ajax.js
 Sat Jul  2 00:05:36 2011
@@ -0,0 +1,74 @@
+/* Copyright 2011 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * 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.
+ */
+
+/**
+ * Defines Tapestry Ajax support, which includes sending requests and receiving
+ * replies, but also includes default handlers for errors and failures, and
+ * processing of Tapestry's partial page render response (a common response for
+ * many types of Ajax requests).
+ */
+T5.define("ajax", function() {
+
+       var $ = T5.$;
+       var spi = T5.spi;
+
+       function defaultFailure(transport) {
+       }
+       
+       function defaultException(exception) {
+       }
+       
+       /**
+        * Performs an AJAX request. The options object is used to identify
+        * additional parameters to be encoded into the request, and to 
identify the
+        * handlers for success and failure.
+        * <p>
+        * Option keys:
+        * <dl>
+        * <dt>parameters
+        * <dd>object with string keys and string values, defines additional 
query
+        * parameters
+        * <dt>failure
+        * <dd>A function invoked if the Ajax request fails; the function is 
passed
+        * the transport
+        * <dt>exception
+        * <dd>A function invoked if there's an exception processing the Ajax
+        * request, the function is passed the exception
+        * <dt>success
+        * <dd>A function invoked when the Ajax response is returned 
succesfully.
+        * The function is passed the transport object.
+        * <dt>method
+        * <dd>The type of request, 'get' or 'post'. 'post' is the default.
+        * </dl>
+        * 
+        * @param url
+        *            the URL for the request
+        * @param options
+        *            an optional object that provides additional options.
+        * @return not defined
+        * 
+        */
+       function request(url, options) {
+               
+               return T5.spi.ajaxRequest(url, 
+       }
+
+       return {
+               defaultFailure : defaultFailure,
+               defaultException : defaultException,
+               defaultSuccess : T5.func.empty,
+               request : request
+       };
+});
\ No newline at end of file

Copied: 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-func.js
 (from r1142122, 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-spi.js)
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-func.js?p2=tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-func.js&p1=tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-spi.js&r1=1142122&r2=1142123&rev=1142123&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-spi.js
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-func.js
 Sat Jul  2 00:05:36 2011
@@ -14,16 +14,23 @@
  */
 
 /**
- * Defines the SPI (service provider interface). This represents an abstract
- * layer between Tapestry's JavaScript and an underlying framework (such as
- * Prototype and JQuery).
- * 
- * <p>
- * The SPI defines placeholders for functions whose implementations are 
provided
- * elsehwere. In some cases, an SPI may define a function in terms of other SPI
- * functions; a framework layer may leave such a function alone or re-implement
- * it.
+ * Define functions used to create or manipulate other functions, plus some
+ * extra utilities.
  */
-T5.define("spi", {
+T5.define("func", function() {
 
+       return {
+               /**
+                * The empty function does nothing.
+                */
+               empty : function() {
+               },
+
+               /**
+                * The identity function returns its first argument.
+                */
+               identity : function(x) {
+                       return x;
+               }
+       };
 });
\ No newline at end of file

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-spi.js
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-spi.js?rev=1142123&r1=1142122&r2=1142123&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-spi.js
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-spi.js
 Sat Jul  2 00:05:36 2011
@@ -26,4 +26,14 @@
  */
 T5.define("spi", {
 
+       /**
+        * Peforms an ajax request, as per T5.ajax.request(). Supplied by the 
SPI
+        * implementation.
+        * 
+        * @param url
+        *            URL for Ajax request
+        * @param options
+        *            additional options defined by T5.ajax.request().
+        */
+       ajaxRequest : undefined
 });
\ No newline at end of file


Reply via email to