click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r962426 [1/3] - in /click/trunk/click/examples: src/org/apache/click/examples/page/ajax/ src/org/apache/click/examples/page/ajax/accordion/ src/org/apache/click/examples/page/ajax/compare/ src/org/apache/click/examples/page/ajax/form/ src/o...
Date Fri, 09 Jul 2010 06:42:29 GMT
Author: sabob
Date: Fri Jul  9 06:42:29 2010
New Revision: 962426

URL: http://svn.apache.org/viewvc?rev=962426&view=rev
Log:
updated to ajax 1.4.2

Added:
    click/trunk/click/examples/webapp/assets/js/jquery-1.4.2.js
      - copied, changed from r943406, click/trunk/click/examples/webapp/assets/js/jquery-1.3.2.js
Modified:
    click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AjaxDemoPage.java
    click/trunk/click/examples/src/org/apache/click/examples/page/ajax/accordion/AjaxAccordion.java
    click/trunk/click/examples/src/org/apache/click/examples/page/ajax/compare/JavascriptAjaxDemoPage.java
    click/trunk/click/examples/src/org/apache/click/examples/page/ajax/compare/JqueryAjaxDemoPage.java
    click/trunk/click/examples/src/org/apache/click/examples/page/ajax/compare/PrototypeAjaxDemoPage.java
    click/trunk/click/examples/src/org/apache/click/examples/page/ajax/form/FormAjaxDemoPage.java
    click/trunk/click/examples/src/org/apache/click/examples/page/ajax/scroller/AjaxLiveScroller.java
    click/trunk/click/examples/src/org/apache/click/examples/page/ajax/table/TableAjaxDemoPage.java
    click/trunk/click/examples/src/org/apache/click/examples/page/control/DisabledDemo.java
    click/trunk/click/examples/src/org/apache/click/examples/page/general/ControlHeadDemo.java
    click/trunk/click/examples/src/org/apache/click/examples/page/general/PageHeadDemo.java
    click/trunk/click/examples/webapp/ajax/ajax-demo.htm
    click/trunk/click/examples/webapp/ajax/compare/jquery-ajax-demo.htm
    click/trunk/click/examples/webapp/ajax/table/table-ajax-demo.htm
    click/trunk/click/examples/webapp/ajax/table/table-ajax-demo.js
    click/trunk/click/examples/webapp/assets/js/jquery.tools.min.js

Modified: click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AjaxDemoPage.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AjaxDemoPage.java?rev=962426&r1=962425&r2=962426&view=diff
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AjaxDemoPage.java (original)
+++ click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AjaxDemoPage.java Fri
Jul  9 06:42:29 2010
@@ -43,6 +43,7 @@ public class AjaxDemoPage extends Border
         // Ajax code
         link.addBehavior(new AjaxBehavior() {
 
+            @Override
             public Partial onAction(Control source) {
                 // Formatted date instance that will be added to the
                 String now = format.currentDate("MMM, yyyy dd HH:MM:ss");

Modified: click/trunk/click/examples/src/org/apache/click/examples/page/ajax/accordion/AjaxAccordion.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/accordion/AjaxAccordion.java?rev=962426&r1=962425&r2=962426&view=diff
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/page/ajax/accordion/AjaxAccordion.java
(original)
+++ click/trunk/click/examples/src/org/apache/click/examples/page/ajax/accordion/AjaxAccordion.java
Fri Jul  9 06:42:29 2010
@@ -41,7 +41,7 @@ public class AjaxAccordion extends Borde
         if (headElements == null) {
             headElements = super.getHeadElements();
 
-            headElements.add(new JsImport("/assets/js/jquery-1.3.2.js"));
+            headElements.add(new JsImport("/assets/js/jquery-1.4.2.js"));
             headElements.add(new JsImport("/assets/js/jquery.tools.min.js"));
             headElements.add(new CssImport("/assets/css/tabs-accordion.css"));
 

Modified: click/trunk/click/examples/src/org/apache/click/examples/page/ajax/compare/JavascriptAjaxDemoPage.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/compare/JavascriptAjaxDemoPage.java?rev=962426&r1=962425&r2=962426&view=diff
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/page/ajax/compare/JavascriptAjaxDemoPage.java
(original)
+++ click/trunk/click/examples/src/org/apache/click/examples/page/ajax/compare/JavascriptAjaxDemoPage.java
Fri Jul  9 06:42:29 2010
@@ -43,6 +43,7 @@ public class JavascriptAjaxDemoPage exte
         // Ajax code
         link.addBehavior(new AjaxBehavior() {
 
+            @Override
             public Partial onAction(Control source) {
                 // Formatted date instance that will be added to the
                 String now = format.currentDate("MMM, yyyy dd HH:MM:ss");

Modified: click/trunk/click/examples/src/org/apache/click/examples/page/ajax/compare/JqueryAjaxDemoPage.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/compare/JqueryAjaxDemoPage.java?rev=962426&r1=962425&r2=962426&view=diff
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/page/ajax/compare/JqueryAjaxDemoPage.java
(original)
+++ click/trunk/click/examples/src/org/apache/click/examples/page/ajax/compare/JqueryAjaxDemoPage.java
Fri Jul  9 06:42:29 2010
@@ -43,6 +43,7 @@ public class JqueryAjaxDemoPage extends 
         // Ajax code
         link.addBehavior(new AjaxBehavior() {
 
+            @Override
             public Partial onAction(Control source) {
                 // Formatted date instance that will be added to the
                 String now = format.currentDate("MMM, yyyy dd HH:MM:ss");

Modified: click/trunk/click/examples/src/org/apache/click/examples/page/ajax/compare/PrototypeAjaxDemoPage.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/compare/PrototypeAjaxDemoPage.java?rev=962426&r1=962425&r2=962426&view=diff
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/page/ajax/compare/PrototypeAjaxDemoPage.java
(original)
+++ click/trunk/click/examples/src/org/apache/click/examples/page/ajax/compare/PrototypeAjaxDemoPage.java
Fri Jul  9 06:42:29 2010
@@ -43,6 +43,7 @@ public class PrototypeAjaxDemoPage exten
         // Ajax code
         link.addBehavior(new AjaxBehavior() {
 
+            @Override
             public Partial onAction(Control source) {
                 // Formatted date instance that will be added to the
                 String now = format.currentDate("MMM, yyyy dd HH:MM:ss");

Modified: click/trunk/click/examples/src/org/apache/click/examples/page/ajax/form/FormAjaxDemoPage.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/form/FormAjaxDemoPage.java?rev=962426&r1=962425&r2=962426&view=diff
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/page/ajax/form/FormAjaxDemoPage.java
(original)
+++ click/trunk/click/examples/src/org/apache/click/examples/page/ajax/form/FormAjaxDemoPage.java
Fri Jul  9 06:42:29 2010
@@ -87,7 +87,7 @@ public class FormAjaxDemoPage extends Bo
     public List<Element> getHeadElements() {
         if (headElements == null) {
             headElements = super.getHeadElements();
-            headElements.add(new JsImport("/assets/js/jquery-1.3.2.js"));
+            headElements.add(new JsImport("/assets/js/jquery-1.4.2.js"));
             headElements.add(new JsScript("/ajax/form/form-ajax-demo.js", new HashMap()));
         }
         return headElements;

Modified: click/trunk/click/examples/src/org/apache/click/examples/page/ajax/scroller/AjaxLiveScroller.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/scroller/AjaxLiveScroller.java?rev=962426&r1=962425&r2=962426&view=diff
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/page/ajax/scroller/AjaxLiveScroller.java
(original)
+++ click/trunk/click/examples/src/org/apache/click/examples/page/ajax/scroller/AjaxLiveScroller.java
Fri Jul  9 06:42:29 2010
@@ -85,7 +85,7 @@ public class AjaxLiveScroller extends Bo
             headElements = super.getHeadElements();
 
             // Add the jQuery library
-            headElements.add(new JsImport("/assets/js/jquery-1.3.2.js"));
+            headElements.add(new JsImport("/assets/js/jquery-1.4.2.js"));
 
             // Create a default model and add the pageSize variable to pass to
             // the JavaScript template: ajax-live-scroller.js

Modified: click/trunk/click/examples/src/org/apache/click/examples/page/ajax/table/TableAjaxDemoPage.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/table/TableAjaxDemoPage.java?rev=962426&r1=962425&r2=962426&view=diff
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/page/ajax/table/TableAjaxDemoPage.java
(original)
+++ click/trunk/click/examples/src/org/apache/click/examples/page/ajax/table/TableAjaxDemoPage.java
Fri Jul  9 06:42:29 2010
@@ -74,6 +74,19 @@ public class TableAjaxDemoPage extends B
             }
         });
 
+        table.getControlLink().addBehavior(new AjaxBehavior() {
+
+            @Override
+            public Partial onAction(Control source) {
+
+                // NOTE: Ajax requests only process the target Control. Here we
+                // process the table in order to update paging and sorting state
+                table.onProcess();
+
+                return new Partial(table.toString(), Partial.HTML);
+            }
+        });
+
         addControl(table);
 
         // Setup customers table
@@ -119,7 +132,7 @@ public class TableAjaxDemoPage extends B
     public List<Element> getHeadElements() {
         if (headElements == null) {
             headElements = super.getHeadElements();
-            headElements.add(new JsImport("/assets/js/jquery-1.3.2.js"));
+            headElements.add(new JsImport("/assets/js/jquery-1.4.2.js"));
             headElements.add(new JsScript("/ajax/table/table-ajax-demo.js", new HashMap()));
         }
         return headElements;

Modified: click/trunk/click/examples/src/org/apache/click/examples/page/control/DisabledDemo.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/control/DisabledDemo.java?rev=962426&r1=962425&r2=962426&view=diff
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/page/control/DisabledDemo.java
(original)
+++ click/trunk/click/examples/src/org/apache/click/examples/page/control/DisabledDemo.java
Fri Jul  9 06:42:29 2010
@@ -118,7 +118,7 @@ public class DisabledDemo extends Border
     public List<Element> getHeadElements() {
         if (headElements == null) {
             headElements = super.getHeadElements();
-            headElements.add(new JsImport("/assets/js/jquery-1.3.2.js"));
+            headElements.add(new JsImport("/assets/js/jquery-1.4.2.js"));
 
             Map<String, Object> jsModel = new HashMap<String, Object>();
             headElements.add(new JsScript("/control/disabled-demo.js", jsModel));

Modified: click/trunk/click/examples/src/org/apache/click/examples/page/general/ControlHeadDemo.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/general/ControlHeadDemo.java?rev=962426&r1=962425&r2=962426&view=diff
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/page/general/ControlHeadDemo.java
(original)
+++ click/trunk/click/examples/src/org/apache/click/examples/page/general/ControlHeadDemo.java
Fri Jul  9 06:42:29 2010
@@ -75,7 +75,7 @@ public class ControlHeadDemo extends Bor
                 headElements = super.getHeadElements();
 
                 // Add the JQuery library to the control
-                headElements.add(new JsImport("/assets/js/jquery-1.3.2.js"));
+                headElements.add(new JsImport("/assets/js/jquery-1.4.2.js"));
 
                 // Add the Rating JavaScript library to the control
                 headElements.add(new JsImport("/assets/rating/jquery.rating.js"));

Modified: click/trunk/click/examples/src/org/apache/click/examples/page/general/PageHeadDemo.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/general/PageHeadDemo.java?rev=962426&r1=962425&r2=962426&view=diff
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/page/general/PageHeadDemo.java
(original)
+++ click/trunk/click/examples/src/org/apache/click/examples/page/general/PageHeadDemo.java
Fri Jul  9 06:42:29 2010
@@ -76,7 +76,7 @@ public class PageHeadDemo extends Border
             headElements.add(new CssStyle("#" + field.getId() + " { font-size: 18px; }"));
 
             // Add the JQuery library to the Page
-            headElements.add(new JsImport("/assets/js/jquery-1.3.2.js"));
+            headElements.add(new JsImport("/assets/js/jquery-1.4.2.js"));
 
             // Add a JQuery template which adds a 'click' listener to the link
             // that will show/hide the field

Modified: click/trunk/click/examples/webapp/ajax/ajax-demo.htm
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/webapp/ajax/ajax-demo.htm?rev=962426&r1=962425&r2=962426&view=diff
==============================================================================
--- click/trunk/click/examples/webapp/ajax/ajax-demo.htm (original)
+++ click/trunk/click/examples/webapp/ajax/ajax-demo.htm Fri Jul  9 06:42:29 2010
@@ -1,4 +1,4 @@
-<script type="text/javascript" src="$context/assets/js/jquery-1.3.2.js"></script>
+<script type="text/javascript" src="$context/assets/js/jquery-1.4.2.js"></script>
 
 <script type="text/javascript">
     // This example uses jQuery for making Ajax requests:

Modified: click/trunk/click/examples/webapp/ajax/compare/jquery-ajax-demo.htm
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/webapp/ajax/compare/jquery-ajax-demo.htm?rev=962426&r1=962425&r2=962426&view=diff
==============================================================================
--- click/trunk/click/examples/webapp/ajax/compare/jquery-ajax-demo.htm (original)
+++ click/trunk/click/examples/webapp/ajax/compare/jquery-ajax-demo.htm Fri Jul  9 06:42:29
2010
@@ -10,7 +10,7 @@ $link
 <!-- Ajax response will be set here -->
 </div>
 
-<script type="text/javascript" src="$context/assets/js/jquery-1.3.2.js"></script>
+<script type="text/javascript" src="$context/assets/js/jquery-1.4.2.js"></script>
 
 <script type="text/javascript">
     // This example uses jQuery for making Ajax requests:

Modified: click/trunk/click/examples/webapp/ajax/table/table-ajax-demo.htm
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/webapp/ajax/table/table-ajax-demo.htm?rev=962426&r1=962425&r2=962426&view=diff
==============================================================================
--- click/trunk/click/examples/webapp/ajax/table/table-ajax-demo.htm (original)
+++ click/trunk/click/examples/webapp/ajax/table/table-ajax-demo.htm Fri Jul  9 06:42:29 2010
@@ -1,4 +1,6 @@
+<div id="tableContainer">
 $table
+</div>
 
 <div id="result">
     

Modified: click/trunk/click/examples/webapp/ajax/table/table-ajax-demo.js
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/webapp/ajax/table/table-ajax-demo.js?rev=962426&r1=962425&r2=962426&view=diff
==============================================================================
--- click/trunk/click/examples/webapp/ajax/table/table-ajax-demo.js (original)
+++ click/trunk/click/examples/webapp/ajax/table/table-ajax-demo.js Fri Jul  9 06:42:29 2010
@@ -20,8 +20,10 @@
 // Register a function that is invoked as soon as the DOM is loaded
 jQuery(document).ready(function() {
 
-    // Register a 'click' handler on every link inside the table
-    jQuery("#table a").click(function(event){
+    // Register a 'live' click handler on every link inside the table.
+    // Note: the 'live' binding is a jQuery function that keeps the event bound even if the
Table DOM is replaced
+    // http://api.jquery.com/live/
+    jQuery("#table td a").live('click', function(event){
         // Prevent the default browser behavior of navigating to the link
         event.preventDefault();
 
@@ -32,16 +34,36 @@ jQuery(document).ready(function() {
 
         if (callServer) {
             // Make ajax request
-            makeRequest(event);
+            editCustomer(event);
         }
     })
+
+    // Register a 'live' click handler on the sorting links of the table header (<th>),
+    // as well as the paging links on the <div> banner.
+    // Note: the 'live' binding is a jQuery function that keeps the event bound even if the
Table DOM is replaced
+    // http://api.jquery.com/live/
+    jQuery("#table th a, .pagelinks a").live('click', function(event){
+        // Prevent the default browser behavior of navigating to the link
+        event.preventDefault();
+        // Make ajax request
+        sortTable(event);
+    })
 })
 
-function makeRequest(event) {
+function editCustomer(event) {
     var link = jQuery(event.target);
     var url = link.attr('href');
     jQuery.get(url, function(data) {
         // Update the result div with the server response
         jQuery("#result").html("<p class='infoMsg'>" + data + "</p>");
     });
+}
+
+function sortTable(event) {
+    var link = jQuery(event.target);
+    var url = link.attr('href');
+    jQuery.get(url, function(data) {
+        // Update the table container with the new table
+        jQuery("#tableContainer").html(data);
+    });
 }
\ No newline at end of file



Mime
View raw message