You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by jk...@apache.org on 2006/11/25 21:38:53 UTC

svn commit: r479190 - /tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/JSONResponseBuilder.java

Author: jkuhnert
Date: Sat Nov 25 12:38:52 2006
New Revision: 479190

URL: http://svn.apache.org/viewvc?view=rev&rev=479190
Log:
Implemented better clientId handling with JSON responses.

Modified:
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/JSONResponseBuilder.java

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/JSONResponseBuilder.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/JSONResponseBuilder.java?view=diff&rev=479190&r1=479189&r2=479190
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/JSONResponseBuilder.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/JSONResponseBuilder.java Sat Nov 25 12:38:52 2006
@@ -154,7 +154,7 @@
             IJSONRender json = (IJSONRender) render;
             IComponent component = (IComponent) render;
             
-            if (!_parts.contains(component.getId()))
+            if (!contains(component, component.peekClientId()))
             {
                 render.render(_nullWriter, cycle);
                 return;
@@ -187,8 +187,13 @@
         if (target == null) 
             return false;
         
-        String id = getComponentId(target);
+        String id = target.getClientId();
         
+        return contains(target, id);
+    }
+    
+    boolean contains(IComponent target, String id)
+    {
         if (_parts.contains(id))
             return true;
         
@@ -196,7 +201,7 @@
         while (it.hasNext()) {
             
             IComponent comp = (IComponent)it.next();
-            String compId = getComponentId(comp);
+            String compId = comp.getClientId();
             
             if (comp != target && _parts.contains(compId))
                 return true;
@@ -213,18 +218,7 @@
         if (target == null)
             return false;
         
-        return _parts.contains(target.getClientId());
-    }
-    
-    /**
-     * Gets the id of the specified component, choosing the "id" element
-     * binding over any other id.
-     * @param comp
-     * @return The id of the component.
-     */
-    String getComponentId(IComponent comp)
-    {
-        return comp.getClientId();
+        return _parts.contains(target.getId());
     }
     
     /**