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/10/04 21:07:48 UTC

svn commit: r1178909 - in /myfaces/tobago/trunk: tobago-core/src/main/java/org/apache/myfaces/tobago/ajax/AjaxUtils.java tobago-extension/tobago-deprecation/src/main/java/org/apache/myfaces/tobago/ajax/api/AjaxUtils.java

Author: bommel
Date: Tue Oct  4 19:07:47 2011
New Revision: 1178909

URL: http://svn.apache.org/viewvc?rev=1178909&view=rev
Log:
(TOBAGO-1035)
Unified access to partialComponentsId in AjaxUtils for 1.0.x and 1.5.x

Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/ajax/AjaxUtils.java
    myfaces/tobago/trunk/tobago-extension/tobago-deprecation/src/main/java/org/apache/myfaces/tobago/ajax/api/AjaxUtils.java

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/ajax/AjaxUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/ajax/AjaxUtils.java?rev=1178909&r1=1178908&r2=1178909&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/ajax/AjaxUtils.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/ajax/AjaxUtils.java Tue Oct  4 19:07:47 2011
@@ -30,9 +30,13 @@ import javax.servlet.http.HttpServletRes
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.io.Writer;
+import java.util.Collections;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
 
 public class AjaxUtils {
 
@@ -66,6 +70,21 @@ public class AjaxUtils {
     }
   }
 
+  public static Set<String> getRequestPartialIds(FacesContext facesContext) {
+    Map parameterMap = facesContext.getExternalContext().getRequestParameterMap();
+    String ajaxComponentIds = (String) parameterMap.get(AjaxInternalUtils.TOBAGO_PARTIAL_IDS);
+    if (ajaxComponentIds != null) {
+      StringTokenizer tokenizer = new StringTokenizer(ajaxComponentIds, ",");
+      Set<String> ajaxComponents = new HashSet<String>(tokenizer.countTokens());
+      while (tokenizer.hasMoreTokens()) {
+        String ajaxId = tokenizer.nextToken();
+        ajaxComponents.add(ajaxId);
+      }
+      return ajaxComponents;
+    }
+    return Collections.EMPTY_SET;
+  }
+
   /**
    *
    * @param context

Modified: myfaces/tobago/trunk/tobago-extension/tobago-deprecation/src/main/java/org/apache/myfaces/tobago/ajax/api/AjaxUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-extension/tobago-deprecation/src/main/java/org/apache/myfaces/tobago/ajax/api/AjaxUtils.java?rev=1178909&r1=1178908&r2=1178909&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-extension/tobago-deprecation/src/main/java/org/apache/myfaces/tobago/ajax/api/AjaxUtils.java (original)
+++ myfaces/tobago/trunk/tobago-extension/tobago-deprecation/src/main/java/org/apache/myfaces/tobago/ajax/api/AjaxUtils.java Tue Oct  4 19:07:47 2011
@@ -25,6 +25,7 @@ import javax.faces.context.FacesContext;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.util.Map;
+import java.util.Set;
 
 /**
  * @deprecated since 1.5.0. 
@@ -141,4 +142,12 @@ public class AjaxUtils {
   public static void redirect(HttpServletResponse response, String url) throws IOException {
     org.apache.myfaces.tobago.ajax.AjaxUtils.redirect(response, url);
   }
+
+  /**
+   * @deprecated Please use org.apache.myfaces.tobago.ajax.AjaxUtils.getRequestPartialIds
+   */
+  @Deprecated
+  public static Set<String> getRequestPartialIds(FacesContext context) {
+    return org.apache.myfaces.tobago.ajax.AjaxUtils.getRequestPartialIds(context);
+  }
 }