Author: ivaynberg
Date: Mon Apr 16 20:48:51 2007
New Revision: 529478

URL: http://svn.apache.org/viewvc?view=rev&rev=529478
Log:
fixed bug: ifeedback components were never attached if they were added to ajax 
request indirectly

Modified:
    
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java

Modified: 
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java
URL: 
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java?view=diff&rev=529478&r1=529477&r2=529478
==============================================================================
--- 
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java
 (original)
+++ 
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java
 Mon Apr 16 20:48:51 2007
@@ -546,10 +546,13 @@
                Iterator it;
 
                // process feedback
-               it = markupIdToComponent.entrySet().iterator();
+
+               // TODO do we need these special pre-attach feedback traversals 
all over
+               // the place?
+               it = markupIdToComponent.values().iterator();
                while (it.hasNext())
                {
-                       final Component component = 
(Component)((Entry)it.next()).getValue();
+                       final Component component = (Component)it.next();
 
                        if (component instanceof MarkupContainer)
                        {
@@ -571,6 +574,36 @@
                                ((IFeedback)component).updateFeedback();
                        }
                }
+
+               // we need to attach feedback components here because they are 
not
+               // attached in MarkupContainer#attachChildren()
+               it = markupIdToComponent.values().iterator();
+               while (it.hasNext())
+               {
+                       final Component component = (Component)it.next();
+
+                       if (component instanceof IFeedback)
+                       {
+                               component.attach();
+                       }
+
+                       if (component instanceof MarkupContainer)
+                       {
+                               MarkupContainer container = 
(MarkupContainer)component;
+
+                               // collect feedback
+                               container.visitChildren(IFeedback.class, new 
IVisitor()
+                               {
+                                       public Object component(Component 
component)
+                                       {
+                                               component.attach();
+                                               return 
IVisitor.CONTINUE_TRAVERSAL;
+                                       }
+                               });
+                       }
+
+               }
+
 
                // attach components
                it = markupIdToComponent.values().iterator();


Reply via email to