myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r1768042 - in /myfaces/tobago/trunk: tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/30-event/ tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standar...
Date Fri, 04 Nov 2016 14:35:29 GMT
Author: lofwyr
Date: Fri Nov  4 14:35:29 2016
New Revision: 1768042

URL: http://svn.apache.org/viewvc?rev=1768042&view=rev
Log:
TOBAGO-1617: New tag <tc:event> to be similar to <f:ajax> and to replace <tc:command>
in facets
* implement dblclick

Modified:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/30-event/sheet-event.xhtml
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/30-event/sheet-event.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/30-event/sheet-event.xhtml?rev=1768042&r1=1768041&r2=1768042&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/30-event/sheet-event.xhtml
(original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/30-event/sheet-event.xhtml
Fri Nov  4 14:35:29 2016
@@ -17,7 +17,7 @@
  * limitations under the License.
 -->
 
-<ui:composition template="/main.xhtml"
+<ui:composition template="/plain.xhtml"
                 xmlns="http://www.w3.org/1999/xhtml"
                 xmlns:tc="http://myfaces.apache.org/tobago/component"
                 xmlns:ui="http://java.sun.com/jsf/facelets"
@@ -45,7 +45,6 @@
             <tc:out value="#{object.name}" id="t_name" labelLayout="skip"/>
           </tc:column>
           <tc:row id="sample0" rendered="#{sheetController.columnEventSample == 0}">
-            <!-- todo: immediate? -->
             <f:ajax render=":::detail" listener="#{sheetController.selectSolarObject}"
id="columnEventAjax"/>
           </tc:row>
           <tc:row id="sample1" rendered="#{sheetController.columnEventSample == 1}">

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=1768042&r1=1768041&r2=1768042&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
(original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
Fri Nov  4 14:35:29 2016
@@ -389,45 +389,55 @@ var Tobago = {
     Tobago.reloadTimer[id] = setTimeout(func, time);
   },
 
-  initCommand: function(command) {
+  initCommand: function(element) {
     // command is jQuery object
     // setupInputFacetCommand
-    var commands = command.data("tobago-commands");
+    var commands = element.data("tobago-commands");
 
+    var normalEvents = [];
     if (commands.click) {
-      command.click(function (event) {
-        var confirmation = commands.click.confirmation;
+      normalEvents.push({event: "click", command: commands.click});
+    }
+    if (commands.dblclick) {
+      normalEvents.push({event: "dblclick", command: commands.dblclick});
+    }
+
+    for (var i in normalEvents) {
+
+      element.on(normalEvents[i].event, {command: normalEvents[i].command}, function (event)
{
+        var command = event.data.command;
+        var confirmation = command.confirmation;
         if (confirmation != null) {
           if (!confirm(confirmation)) {
             event.preventDefault();
             return;
           }
         }
-        var collapse = commands.click.collapse;
+        var collapse = command.collapse;
         if (collapse) {
           Tobago.Collapse.execute(collapse);
         }
 
-        if (commands.click.omit != true) {
-          var popup = commands.click.popup;
+        if (command.omit != true) {
+          var popup = command.popup;
           if (popup && popup.command == "close" && popup.immediate) {
             Tobago.Popup.close(this);
           } else {
-            var action = commands.click.action ? commands.click.action : jQuery(this).attr("id");
-            if (commands.click.execute || commands.click.render) {
-              Tobago.preparePartialOverlay(commands.click);
+            var action = command.action ? command.action : jQuery(this).attr("id");
+            if (command.execute || command.render) {
+              Tobago.preparePartialOverlay(command);
               jsf.ajax.request(
                   jQuery(this).attr("id"),
                   event,
                   {
-                    "javax.faces.behavior.event": "click",
-                    execute: commands.click.execute,
-                    render: commands.click.render
+                    "javax.faces.behavior.event": event.type,
+                    execute: command.execute,
+                    render: command.render
                   });
               event.preventDefault();
               event.stopPropagation();
             } else {
-              Tobago.submitAction(this, action, commands.click);
+              Tobago.submitAction(this, action, command);
             }
             if (popup && popup.command == "close") {
               Tobago.Popup.close(this);
@@ -437,7 +447,7 @@ var Tobago = {
       });
     }
     if (commands.change) {
-      command.change(function(event) {
+      element.change(function(event) {
         if (commands.change.execute || commands.change.render) {
           jsf.ajax.request(
               jQuery(this).attr("name"),
@@ -453,7 +463,7 @@ var Tobago = {
       });
     }
     if (commands.complete) {
-      if (command.val() >= parseFloat(command.attr("max"))) {
+      if (element.val() >= parseFloat(element.attr("max"))) {
         if (commands.complete.execute || commands.complete.render) {
           jsf.ajax.request(
               jQuery(this).attr("id"),



Mime
View raw message