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

svn commit: r521512 - in /myfaces/tobago/trunk: core/src/main/java/org/apache/myfaces/tobago/renderkit/html/ theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ theme/standard/src/main/resources/org/apache...

Author: weber
Date: Thu Mar 22 15:45:07 2007
New Revision: 521512

URL: http://svn.apache.org/viewvc?view=rev&rev=521512
Log:
TOBAGO-333 ( a button with defaultCommand=true will never invoke the transition)

Modified:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRendererUtil.java
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.java
    myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRendererUtil.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRendererUtil.java?view=diff&rev=521512&r1=521511&r2=521512
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRendererUtil.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRendererUtil.java Thu Mar 22 15:45:07 2007
@@ -160,6 +160,11 @@
     }
   }
 
+  public static void setDefaultTransition(FacesContext facesContext, boolean transition)
+      throws IOException {
+    writeScriptLoader(facesContext, null, new String[]{"Tobago.transition = " + transition + ";"});
+  }
+
   public static void addClickAcceleratorKey(
       FacesContext facesContext, String clientId, char key)
       throws IOException {

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.java?view=diff&rev=521512&r1=521511&r2=521512
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.java Thu Mar 22 15:45:07 2007
@@ -29,6 +29,7 @@
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_IMAGE;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_STYLE;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TIP;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TRANSITION;
 import org.apache.myfaces.tobago.component.ComponentUtil;
 import org.apache.myfaces.tobago.context.ResourceManagerUtil;
 import org.apache.myfaces.tobago.renderkit.CommandRendererBase;
@@ -122,6 +123,11 @@
       HtmlRendererUtil.addClickAcceleratorKey(
           facesContext, clientId, label.getAccessKey());
     }
+    if ("submit".equals(buttonType)) {
+      boolean transition = ComponentUtil.getBooleanAttribute(component, ATTR_TRANSITION);
+      HtmlRendererUtil.setDefaultTransition(facesContext, transition);
+    }
+
   }
 
   public void encodeEnd(FacesContext facesContext,

Modified: myfaces/tobago/trunk/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/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?view=diff&rev=521512&r1=521511&r2=521512
==============================================================================
--- myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Thu Mar 22 15:45:07 2007
@@ -249,14 +249,16 @@
     var clientDimension = this.createInput("hidden", this.form.id + '-clientDimension');
     clientDimension.value = document.body.clientWidth + ";" + document.body.clientHeight;
     this.form.appendChild(clientDimension);
+    Tobago.onBeforeUnload();    
   },
 
-  onBeforeUnload: function(transition, target) {
-    if (transition && !target) {
+  onBeforeUnload: function() {
+    if (Tobago.transition) {
       Tobago.createOverlay(Tobago.page);
       setTimeout(Tobago.makeOverlaySemitransparent, 750);
       setTimeout(Tobago.makeOverlayWait, 2000);
     }
+    Tobago.transition = Tobago.oldTransition;
   },
 
   makeOverlaySemitransparent: function() {
@@ -412,7 +414,7 @@
     * Submitting the page with specified actionId.
     */
   submitAction: function(actionId, transition, target) {
-    if (transition == null) {
+    if (!transition) {
       transition = true;
     }
     LOG.info("transition =" + transition);
@@ -435,6 +437,8 @@
             return;
           }
         }
+        Tobago.oldTransition = Tobago.transition;
+        Tobago.transition = transition && !target;
         Tobago.onSubmit();
   //      LOG.debug("submit form with action: " + Tobago.action.value);
         Tobago.form.submit();
@@ -446,7 +450,6 @@
           this.isSubmit = false;
           Tobago.Transport.pageSubmited = false;
         }
-        Tobago.onBeforeUnload(transition, target);
       }
     }, true);
   },