You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2011/04/23 19:21:54 UTC

svn commit: r1096184 - in /myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main: java/org/apache/myfaces/tobago/renderkit/html/util/ resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/

Author: bommel
Date: Sat Apr 23 17:21:54 2011
New Revision: 1096184

URL: http://svn.apache.org/viewvc?rev=1096184&view=rev
Log:
(TOBAGO-992) Move transition, target, focus of Tobago.submitAction to a set of optional options

Modified:
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/CommandRendererHelper.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-sheet.js
    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-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/CommandRendererHelper.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/CommandRendererHelper.java?rev=1096184&r1=1096183&r2=1096184&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/CommandRendererHelper.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/CommandRendererHelper.java Sat Apr 23 17:21:54 2011
@@ -109,9 +109,9 @@ public class CommandRendererHelper {
         String clientId = command.getClientId(facesContext);
         String target = ComponentUtils.getStringAttribute(command, Attributes.TARGET);
         if (target == null) {
-          onclick = "Tobago.submitAction(this, '" + clientId + "', " + transition + ");";
+          onclick = "Tobago.submitAction(this, '" + clientId + "', { transition:" + transition + "});";
         } else {
-          onclick = "Tobago.submitAction(this, '" + clientId + "', " + transition + ", '" + target + "');";
+          onclick = "Tobago.submitAction(this, '" + clientId + "', { transition:" + transition + ", target:'" + target + "'});";
         }
       }
 

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java?rev=1096184&r1=1096183&r2=1096184&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java Sat Apr 23 17:21:54 2011
@@ -633,11 +633,11 @@ public final class HtmlRendererUtils {
       } else {
         writer.write("Tobago.submitAction(this, '");
         writer.write(facetComponent.getClientId(facesContext));
-        writer.write("', ");
+        writer.write("', { transition:");
         writer.write(Boolean.toString(ComponentUtils.getBooleanAttribute(facetComponent, Attributes.TRANSITION)));
-        writer.write(", null, '");
+        writer.write(", focus:'");
         writer.write(clientId);
-        writer.write("')");
+        writer.write("'})");
       }
       writer.write("});\n}");
       writer.endJavascript();

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-sheet.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-sheet.js?rev=1096184&r1=1096183&r2=1096184&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-sheet.js (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-sheet.js Sat Apr 23 17:21:54 2011
@@ -477,7 +477,7 @@ Tobago.Sheet.prototype.doSelection = fun
         if (this.clickReloadComponentId && this.clickReloadComponentId.length > 0) {
           Tobago.reloadComponent(srcElement, this.clickReloadComponentId[0], action)
         } else {
-          Tobago.submitAction(srcElement, action, true, null);
+          Tobago.submitAction(srcElement, action);
         }
       }
     }
@@ -512,7 +512,7 @@ Tobago.Sheet.prototype.doDblClick = func
         if (this.dblClickReloadComponentId && this.dblClickReloadComponentId.length > 0) {
           Tobago.reloadComponent(srcElement, this.dblClickReloadComponentId[0], action)
         } else {
-          Tobago.submitAction(srcElement, action, true, null);
+          Tobago.submitAction(srcElement, action);
         }
       }
     }

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=1096184&r1=1096183&r2=1096184&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 Sat Apr 23 17:21:54 2011
@@ -492,14 +492,20 @@ var Tobago = {
 
   /**
    * Submitting the page with specified actionId.
-   */
-  submitAction: function(source, actionId, transition, target, focus) {
-    if (transition === undefined || transition == null) {
+   * options.transition
+   * options.focus
+   * options.target
+   */
+  submitAction: function(source, actionId, options) {
+    options = options || {};
+    if (options.transition === undefined || options.transition == null) {
       transition = true;
+    } else {
+      transition = options.transition;
     }
 
-    if (focus) {
-      var lastFocusId = this.createInput('hidden', this.page.id + this.SUB_COMPONENT_SEP + 'lastFocusId', focus);
+    if (options.focus) {
+      var lastFocusId = this.createInput('hidden', this.page.id + this.SUB_COMPONENT_SEP + 'lastFocusId', options.focus);
       this.form.appendChild(lastFocusId);
     }
 
@@ -515,11 +521,11 @@ var Tobago = {
         var oldAction = Tobago.action.value;
         var oldTarget = Tobago.form.target;
         Tobago.action.value = actionId;
-        if (target) {
-          Tobago.form.target = target;
+        if (options.target) {
+          Tobago.form.target = options.target;
         }
         Tobago.oldTransition = Tobago.transition;
-        Tobago.transition = transition && !target;
+        Tobago.transition = transition && !options.target;
 // new
         var onSubmitResult = Tobago.onSubmit();
         if (onSubmitResult) {
@@ -533,10 +539,10 @@ var Tobago = {
           }
         }
         Tobago.action.value = oldAction;
-        if (target) {
+        if (options.target) {
           Tobago.form.target = oldTarget;
         }
-        if (target || !transition || !onSubmitResult) {
+        if (options.target || !transition || !onSubmitResult) {
           this.isSubmit = false;
           Tobago.Transport.pageSubmited = false;
         }