You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by de...@apache.org on 2017/09/17 12:29:59 UTC

[myfaces-trinidad] branch 1.2.12.3-branch created (now 6e078fe)

This is an automated email from the ASF dual-hosted git repository.

deki pushed a change to branch 1.2.12.3-branch
in repository https://gitbox.apache.org/repos/asf/myfaces-trinidad.git.


      at 6e078fe  TRINIDAD-2194 - Trinidad PPR blocking does not work with 2 clicks that post. Thanks, Venkata Guddanti, for the patch!

This branch includes the following new commits:

     new b6d2622  TRINIDAD-2011 RowKeySet Attribute Changes surprisingly change object identity
     new 70b9597  Oops, accidentally committed TRINIDAD-2011 RowKeySet Attribute Changes surprisingly change object identity on wrong branch
     new 19d0955  TRINIDAD-2194 - Trinidad PPR blocking does not work with 2 clicks that post. Thanks Venkata Guddanti for the patch!
     new 6e078fe  TRINIDAD-2194 - Trinidad PPR blocking does not work with 2 clicks that post. Thanks, Venkata Guddanti, for the patch!

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


-- 
To stop receiving notification emails like this one, please contact
['"commits@myfaces.apache.org" <co...@myfaces.apache.org>'].

[myfaces-trinidad] 04/04: TRINIDAD-2194 - Trinidad PPR blocking does not work with 2 clicks that post. Thanks, Venkata Guddanti, for the patch!

Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

deki pushed a commit to branch 1.2.12.3-branch
in repository https://gitbox.apache.org/repos/asf/myfaces-trinidad.git

commit 6e078fe91a392600cd6a619184ed8e05fdccb269
Author: Max Starets <ms...@apache.org>
AuthorDate: Mon Mar 12 15:54:18 2012 +0000

    TRINIDAD-2194 - Trinidad PPR blocking does not work with 2 clicks that post. Thanks, Venkata Guddanti, for the patch!
---
 .../src/main/javascript/META-INF/adf/jsLibs/Core.js    | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js b/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js
index 8aed47c..4d9121b 100644
--- a/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js
+++ b/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js
@@ -3544,7 +3544,10 @@ function _doPprStartBlocking (win)
 {
   // Clean up timeout set in _pprStartBlocking()
   if (win._pprTimeoutFunc)
+  {
     win.clearTimeout(win._pprTimeoutFunc);
+    win._pprTimeoutFunc = null;
+  }
 
   // In order to force the user to allow a PPR update to complete, we
   // block all mouse clicks between the start of a PPR update, and the end.
@@ -3587,7 +3590,14 @@ function _doPprStartBlocking (win)
 //
 function _pprStopBlocking(win)
 {
-
+  // see TRINIDAD-1833. If _pprStartBlocking() was delayed with setTimeout(),
+  // we need to clear it here. Otherwise _pprStartBlocking() will be called later,
+  // and will end up winning
+  if (win._pprTimeoutFunc)
+  {
+    win.clearTimeout(win._pprTimeoutFunc);
+    win._pprTimeoutFunc = null;
+  }
   // No blocking is performed on Nokia, PPC and BlackBerry devices
   if (_agent.isPIE || _agent.isNokiaPhone || _agent.isBlackBerry)
     return;
@@ -3817,6 +3827,12 @@ function _submitPartialChange(
   if (!form)
     return false;
 
+  // Prevent a submission if we are currently blocking or if we have a timeout set to do blocking
+  // In IE8 the JS engine is very slow and form submission takes time and if the user clicks a link again, the second
+  // click can sneek in before the timeout function is called
+  if(window._pprBlocking || window._pprTimeoutFunc)
+    return false;
+    
   // Tack on the "partial" event parameter parameter
   parameters = _addFormParameter(parameters, "partial", "true");
 

-- 
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <co...@myfaces.apache.org>.

[myfaces-trinidad] 02/04: Oops, accidentally committed TRINIDAD-2011 RowKeySet Attribute Changes surprisingly change object identity on wrong branch

Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

deki pushed a commit to branch 1.2.12.3-branch
in repository https://gitbox.apache.org/repos/asf/myfaces-trinidad.git

commit 70b9597a6a564cf03105661978b3f2a90d364113
Author: Blake Sullivan <bs...@apache.org>
AuthorDate: Thu Jan 27 00:52:00 2011 +0000

    Oops, accidentally committed TRINIDAD-2011 RowKeySet Attribute Changes surprisingly change object identity on wrong branch
---
 .../trinidad/change/RowKeySetAttributeChange.java  | 109 +++++++--------------
 1 file changed, 34 insertions(+), 75 deletions(-)

diff --git a/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/RowKeySetAttributeChange.java b/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/RowKeySetAttributeChange.java
index 85ba431..fa23ba6 100644
--- a/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/RowKeySetAttributeChange.java
+++ b/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/RowKeySetAttributeChange.java
@@ -11,11 +11,7 @@ import javax.faces.el.ValueBinding;
 
 import org.apache.myfaces.trinidad.model.RowKeySet;
 
-/**
- * Handles RowKeySetAttribute changes, which need to be handled specially because they are mutable
- * and programmers assume that the instances don't change
- */
-public final class RowKeySetAttributeChange extends AttributeComponentChange
+public class RowKeySetAttributeChange extends AttributeComponentChange
 {
   public RowKeySetAttributeChange(String clientId,  String propertyName, Object value)
   {
@@ -51,7 +47,9 @@ public final class RowKeySetAttributeChange extends AttributeComponentChange
       attributeMap.remove(attributeName);
     }
     else
-    {      
+    {
+      boolean putValue = true;
+      
       // Specially handle RowKeySet case by replacing the contents of the RowKeySet in-place
       // rather than replacing the entire object.  This keeps the mutable object instance from
       // changing
@@ -63,99 +61,60 @@ public final class RowKeySetAttributeChange extends AttributeComponentChange
         
         if (expression != null)
         {
-          //use EL to get the oldValue and then determine whether we need to update in place
           final FacesContext context = FacesContext.getCurrentInstance();
-                    
-          context.getViewRoot().invokeOnComponent(
-            context,
-            _clientId,
-            new GetOldValueAndUpdate(expression, (RowKeySet)attributeValue));
+          
+          RowKeySet[] outHolder = new RowKeySet[1];
+          
+          context.getViewRoot().invokeOnComponent(context,
+                                                 _clientId,
+                                                 new ExpressionEvaluator(expression, outHolder));
+          
+          oldValue = outHolder[0];
         }
         else
         {
           oldValue = attributeMap.get(attributeName);
-
-          if (oldValue instanceof RowKeySet)
+        }
+                
+        if (oldValue instanceof RowKeySet)
+        {
+          RowKeySet oldKeySet = (RowKeySet)oldValue;
+          
+          // check for equality because otherwise we would clear ourselves and end up empty
+          if (oldKeySet != attributeValue)
           {
-            _updateKeySet(_clientId, (RowKeySet)oldValue, (RowKeySet)attributeValue);
-            
-            // we updated in place, but we still need to set the attribute in order for partial
-            // state saving to work
+            oldKeySet.clear();
+            oldKeySet.addAll((RowKeySet)attributeValue);
           }
-        }      
+          
+          // don't replace the RowKeySet
+          putValue = false;
+        }
       }
       
       
-      attributeMap.put(attributeName, attributeValue);
-    }
-  }
-  
-  private static void _updateKeySet(String clientId, RowKeySet oldKeySet, RowKeySet newKeySet)
-  {
-    // check for equality because otherwise we would clear ourselves and end up empty
-    if (oldKeySet != newKeySet)
-    {
-      // no client id, so we're in context
-      if (clientId == null)
-      {
-        oldKeySet.clear();
-        oldKeySet.addAll(newKeySet);        
-      }
-      else
+      if (putValue)
       {
-        final FacesContext context = FacesContext.getCurrentInstance();
-        
-        context.getViewRoot().invokeOnComponent(
-           context,
-           clientId,
-           new RowKeySetUpdater(oldKeySet, newKeySet));
+        attributeMap.put(attributeName, attributeValue);
       }
-    }    
+    }
   }
   
-  /**
-   * Get the oldValue in context and update it in context
-   */
-  private static final class GetOldValueAndUpdate implements ContextCallback
+  private static final class ExpressionEvaluator implements ContextCallback
   {
-    public GetOldValueAndUpdate(ValueExpression expression, RowKeySet newKeySet)
+    public ExpressionEvaluator(ValueExpression expression, RowKeySet[] out)
     {
+      _out        = out;
       _expression = expression;
-      _newKeySet  = newKeySet;
     }
     public void invokeContextCallback(FacesContext context,
                                       UIComponent target)
     {
-      // update the KeySet with the old and new values
-      RowKeySetAttributeChange._updateKeySet(null,
-                                             (RowKeySet)_expression.getValue(context.getELContext()),
-                                             _newKeySet);
+      _out[0] = (RowKeySet)_expression.getValue(context.getELContext());
     }
     
+    private final RowKeySet[] _out;
     private final ValueExpression _expression;
-    private final RowKeySet _newKeySet;
-  }
-
-  /**
-   * Makes sure that we clear and add the RowKeySet in context
-   */
-  private static final class RowKeySetUpdater implements ContextCallback
-  {
-    public RowKeySetUpdater(RowKeySet oldKeySet, RowKeySet newKeySet)
-    {
-      _oldKeySet = oldKeySet;
-      _newKeySet = newKeySet;
-    }
-
-    public void invokeContextCallback(FacesContext context,
-                                      UIComponent target)
-    {
-      _oldKeySet.clear();
-      _oldKeySet.addAll(_newKeySet);
-    }
-    
-    private final RowKeySet _oldKeySet;
-    private final RowKeySet _newKeySet;
   }
 
   private static final long serialVersionUID = 1L;

-- 
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <co...@myfaces.apache.org>.

[myfaces-trinidad] 01/04: TRINIDAD-2011 RowKeySet Attribute Changes surprisingly change object identity

Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

deki pushed a commit to branch 1.2.12.3-branch
in repository https://gitbox.apache.org/repos/asf/myfaces-trinidad.git

commit b6d2622a1cd7849aa568fdb03275076f7244db1e
Author: Blake Sullivan <bs...@apache.org>
AuthorDate: Tue Jan 25 19:00:38 2011 +0000

    TRINIDAD-2011 RowKeySet Attribute Changes surprisingly change object identity
---
 .../trinidad/change/RowKeySetAttributeChange.java  | 109 ++++++++++++++-------
 1 file changed, 75 insertions(+), 34 deletions(-)

diff --git a/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/RowKeySetAttributeChange.java b/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/RowKeySetAttributeChange.java
index fa23ba6..85ba431 100644
--- a/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/RowKeySetAttributeChange.java
+++ b/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/RowKeySetAttributeChange.java
@@ -11,7 +11,11 @@ import javax.faces.el.ValueBinding;
 
 import org.apache.myfaces.trinidad.model.RowKeySet;
 
-public class RowKeySetAttributeChange extends AttributeComponentChange
+/**
+ * Handles RowKeySetAttribute changes, which need to be handled specially because they are mutable
+ * and programmers assume that the instances don't change
+ */
+public final class RowKeySetAttributeChange extends AttributeComponentChange
 {
   public RowKeySetAttributeChange(String clientId,  String propertyName, Object value)
   {
@@ -47,9 +51,7 @@ public class RowKeySetAttributeChange extends AttributeComponentChange
       attributeMap.remove(attributeName);
     }
     else
-    {
-      boolean putValue = true;
-      
+    {      
       // Specially handle RowKeySet case by replacing the contents of the RowKeySet in-place
       // rather than replacing the entire object.  This keeps the mutable object instance from
       // changing
@@ -61,60 +63,99 @@ public class RowKeySetAttributeChange extends AttributeComponentChange
         
         if (expression != null)
         {
+          //use EL to get the oldValue and then determine whether we need to update in place
           final FacesContext context = FacesContext.getCurrentInstance();
-          
-          RowKeySet[] outHolder = new RowKeySet[1];
-          
-          context.getViewRoot().invokeOnComponent(context,
-                                                 _clientId,
-                                                 new ExpressionEvaluator(expression, outHolder));
-          
-          oldValue = outHolder[0];
+                    
+          context.getViewRoot().invokeOnComponent(
+            context,
+            _clientId,
+            new GetOldValueAndUpdate(expression, (RowKeySet)attributeValue));
         }
         else
         {
           oldValue = attributeMap.get(attributeName);
-        }
-                
-        if (oldValue instanceof RowKeySet)
-        {
-          RowKeySet oldKeySet = (RowKeySet)oldValue;
-          
-          // check for equality because otherwise we would clear ourselves and end up empty
-          if (oldKeySet != attributeValue)
+
+          if (oldValue instanceof RowKeySet)
           {
-            oldKeySet.clear();
-            oldKeySet.addAll((RowKeySet)attributeValue);
+            _updateKeySet(_clientId, (RowKeySet)oldValue, (RowKeySet)attributeValue);
+            
+            // we updated in place, but we still need to set the attribute in order for partial
+            // state saving to work
           }
-          
-          // don't replace the RowKeySet
-          putValue = false;
-        }
+        }      
       }
       
       
-      if (putValue)
+      attributeMap.put(attributeName, attributeValue);
+    }
+  }
+  
+  private static void _updateKeySet(String clientId, RowKeySet oldKeySet, RowKeySet newKeySet)
+  {
+    // check for equality because otherwise we would clear ourselves and end up empty
+    if (oldKeySet != newKeySet)
+    {
+      // no client id, so we're in context
+      if (clientId == null)
       {
-        attributeMap.put(attributeName, attributeValue);
+        oldKeySet.clear();
+        oldKeySet.addAll(newKeySet);        
       }
-    }
+      else
+      {
+        final FacesContext context = FacesContext.getCurrentInstance();
+        
+        context.getViewRoot().invokeOnComponent(
+           context,
+           clientId,
+           new RowKeySetUpdater(oldKeySet, newKeySet));
+      }
+    }    
   }
   
-  private static final class ExpressionEvaluator implements ContextCallback
+  /**
+   * Get the oldValue in context and update it in context
+   */
+  private static final class GetOldValueAndUpdate implements ContextCallback
   {
-    public ExpressionEvaluator(ValueExpression expression, RowKeySet[] out)
+    public GetOldValueAndUpdate(ValueExpression expression, RowKeySet newKeySet)
     {
-      _out        = out;
       _expression = expression;
+      _newKeySet  = newKeySet;
     }
     public void invokeContextCallback(FacesContext context,
                                       UIComponent target)
     {
-      _out[0] = (RowKeySet)_expression.getValue(context.getELContext());
+      // update the KeySet with the old and new values
+      RowKeySetAttributeChange._updateKeySet(null,
+                                             (RowKeySet)_expression.getValue(context.getELContext()),
+                                             _newKeySet);
     }
     
-    private final RowKeySet[] _out;
     private final ValueExpression _expression;
+    private final RowKeySet _newKeySet;
+  }
+
+  /**
+   * Makes sure that we clear and add the RowKeySet in context
+   */
+  private static final class RowKeySetUpdater implements ContextCallback
+  {
+    public RowKeySetUpdater(RowKeySet oldKeySet, RowKeySet newKeySet)
+    {
+      _oldKeySet = oldKeySet;
+      _newKeySet = newKeySet;
+    }
+
+    public void invokeContextCallback(FacesContext context,
+                                      UIComponent target)
+    {
+      _oldKeySet.clear();
+      _oldKeySet.addAll(_newKeySet);
+    }
+    
+    private final RowKeySet _oldKeySet;
+    private final RowKeySet _newKeySet;
   }
 
   private static final long serialVersionUID = 1L;

-- 
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <co...@myfaces.apache.org>.

[myfaces-trinidad] 03/04: TRINIDAD-2194 - Trinidad PPR blocking does not work with 2 clicks that post. Thanks Venkata Guddanti for the patch!

Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

deki pushed a commit to branch 1.2.12.3-branch
in repository https://gitbox.apache.org/repos/asf/myfaces-trinidad.git

commit 19d09556a2ff314cac4b4f7b2dd158f7ff9cbf56
Author: Max Starets <ms...@apache.org>
AuthorDate: Tue Jan 17 21:51:42 2012 +0000

    TRINIDAD-2194 - Trinidad PPR blocking does not work with 2 clicks that post. Thanks Venkata Guddanti for the patch!
---
 .../main/javascript/META-INF/adf/jsLibs/Core.js    | 71 ++++------------------
 1 file changed, 12 insertions(+), 59 deletions(-)

diff --git a/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js b/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js
index 236323c..8aed47c 100644
--- a/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js
+++ b/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js
@@ -3472,40 +3472,9 @@ function _pprInstallBlockingHandlers(win, install)
     return;
   }
 
-  if (doc.attachEvent) // IE
+  if (_agent.isIE) // IE
   {
-    var el = win._pprConsumeFirstClick;
-    if (install)
-    {
-      // See comment in _pprConsumeFirstClick().
-      // If the event that started this PPR chain was an onChange or onBlur,
-      // AND the event location is the element on which the change happened
-      // (i.e. the user didn't click somewhere outside the element)
-      // then we want to make sure that the blocking starts immediately.
-      var ev = win.event;
-      if (ev != (void 0))
-      {
-        var destElt = document.elementFromPoint(ev.x, ev.y);
-        if (!win._pprFirstClickPass // never attach unless passing first click
-            || (((ev.type == 'change') || (ev.type == 'blur'))
-                && (ev.srcElement == destElt))
-            || (!_isSubmittingElement(destElt)))
-        {
-          _pprControlCapture(win, true);
-          return;
-        }
-      }
-
-      // If we're here, we didn't set up a capture.
-      // For an onClick, we have to pass on the first click,
-      // then we'll capture every subsequent event.
-      doc.attachEvent('onclick', el);
-    }
-    else
-    {
-      doc.detachEvent('onclick', el);
-      _pprControlCapture(win, false);
-    }
+    _pprControlCapture(win, install);
   }
   else // Gecko or other standards based browser
   {
@@ -3723,32 +3692,6 @@ function _pprConsumeBlockedEvent(evt)
   return rv;
 }
 
-
-//
-// _pprConsumeFirstClick: Helps implement blocking.
-//
-// On IE, the capture doesn't allow us to hand off the first click - we can
-// only eat it, but attachEvent only allows us to do something with the event
-// AFTER it's been delivered to the element. There's no way to make a decision
-// whether or not to deliver a particular event. Therefore, since we want to
-// deliver the first click, and block everything else, we attachEvent using
-// this handler. This handler then just immediately switches over the the
-// capture. This function is only used on IE.
-//
-function _pprConsumeFirstClick(event)
-{
-  // This is an IE only function
-  if (_agent.isIE)
-  {
-    // switch over to capture
-    _pprControlCapture(window, true);
-    // and remove this one-time function
-    window.document.detachEvent('onclick', _pprConsumeFirstClick);
-  }
-  return false;
-}
-
-
 //
 // _pprControlCapture: Set up the pprDivElement to capture all
 //                     mouse events. It will then ignore them.
@@ -3769,7 +3712,17 @@ function _pprControlCapture(win, set)
         // If we've got an element to return focus to,
         // then capture keyboard events also.
         if (win._pprEventElement)
+        {
+          // save and restore the scroll location before and after setting focus on the div
+          var docElement = win.document.documentElement;
+          var oldLeft = docElement.scrollLeft;
+          var oldTop = docElement.scrollTop;
+          
           divElement.focus();
+          
+          docElement.scrollLeft = oldLeft;
+          docElement.scrollTop = oldTop;
+        }
         // save current cursor and display a wait cursor
         win._pprSavedCursor = body.style.cursor;
         body.style.cursor = "wait";

-- 
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <co...@myfaces.apache.org>.