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/05/07 14:45:56 UTC

svn commit: r535869 - /myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/ajax/api/AjaxUtils.java

Author: weber
Date: Mon May  7 05:45:55 2007
New Revision: 535869

URL: http://svn.apache.org/viewvc?view=rev&rev=535869
Log:
TOBAGO-312 (Integrate handling of ajax requests into standard lifecycle)
  util methods: ensureDecoded()

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

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/ajax/api/AjaxUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/ajax/api/AjaxUtils.java?view=diff&rev=535869&r1=535868&r2=535869
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/ajax/api/AjaxUtils.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/ajax/api/AjaxUtils.java Mon May  7 05:45:55 2007
@@ -161,4 +161,24 @@
     return (List<UIComponent>)
         facesContext.getExternalContext().getRequestMap().get(AJAX_COMPONENTS);
   }
+
+  public static void ensureDecoded(FacesContext facesContext, String clientId) {
+    ensureDecoded(facesContext, facesContext.getViewRoot().findComponent(clientId));
+  }
+
+  public static void ensureDecoded(FacesContext facesContext, UIComponent component) {
+    List<UIComponent> ajaxComponents = getAjaxComponents(facesContext);
+    if (ajaxComponents != null) {
+      for (UIComponent uiComponent : ajaxComponents) {
+        UIComponent currentComponent = component;
+        while (currentComponent != null) {
+          if (component == uiComponent) {
+            return;
+          }
+          currentComponent = currentComponent.getParent();
+        }
+      }
+      component.processDecodes(facesContext);
+    }
+  }
 }