Repository: wicket
Updated Branches:
  refs/heads/master 0dd706949 -> 06a0f4a9a


WICKET-6303 renderHead method of a Behavior added to a Border body is
not called

Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/06a0f4a9
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/06a0f4a9
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/06a0f4a9

Branch: refs/heads/master
Commit: 06a0f4a9a73c7d5b6d50a88a0d8003557a460f83
Parents: 0dd7069
Author: Andrea Del Bene <[email protected]>
Authored: Mon Jan 16 12:39:32 2017 +0100
Committer: Andrea Del Bene <[email protected]>
Committed: Mon Jan 16 12:39:32 2017 +0100

----------------------------------------------------------------------
 .../java/org/apache/wicket/MarkupContainer.java | 20 ++++++++++++--
 .../wicket/markup/html/border/Border.java       | 29 ++++++--------------
 2 files changed, 26 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/06a0f4a9/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java 
b/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java
index 346821a..c2d5042 100644
--- a/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java
+++ b/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java
@@ -2030,14 +2030,21 @@ public abstract class MarkupContainer extends Component 
implements Iterable<Comp
                        ((IQueueRegion)child).dequeue();                        
                }
                
+               if (childType == ChildToDequeueType.BORDER) 
+               {
+                       Border childContainer = (Border)child;
+                       // propagate dequeuing to border's body
+            MarkupContainer body = childContainer.getBodyContainer();
+                       
+                       dequeueChildrenContainer(dequeue, body);
+               }
+               
                if (childType == ChildToDequeueType.MARKUP_CONTAINER)
                {
                        // propagate dequeuing to containers
                        MarkupContainer childContainer = (MarkupContainer)child;
                        
-                       dequeue.pushContainer(childContainer);
-                       childContainer.dequeue(dequeue);
-                       dequeue.popContainer();                 
+                       dequeueChildrenContainer(dequeue, childContainer);      
                
                }
                
                if (childType == ChildToDequeueType.NULL || 
@@ -2059,6 +2066,13 @@ public abstract class MarkupContainer extends Component 
implements Iterable<Comp
                throw new IllegalStateException(String.format("Could not find 
the closing tag for '%s'", tag));
        }
 
+       private void dequeueChildrenContainer(DequeueContext dequeue, 
MarkupContainer child) 
+       {
+               dequeue.pushContainer(child);
+               child.dequeue(dequeue);
+               dequeue.popContainer();
+       }
+
     /** @see IQueueRegion#newDequeueContext() */
        public DequeueContext newDequeueContext()
        {

http://git-wip-us.apache.org/repos/asf/wicket/blob/06a0f4a9/wicket-core/src/main/java/org/apache/wicket/markup/html/border/Border.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/markup/html/border/Border.java 
b/wicket-core/src/main/java/org/apache/wicket/markup/html/border/Border.java
index 15c9dbe..b11df1a 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/border/Border.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/border/Border.java
@@ -169,18 +169,7 @@ public abstract class Border extends WebMarkupContainer 
implements IComponentRes
                super(id, model);
 
                body = new BorderBodyContainer(id + "_" + BODY);
-       }
-       
-       @Override
-       protected void onInitialize()
-       {
-               super.onInitialize();
-               
-               //if body has not been assigned yet, we queue it
-               if (body.getParent() == null)
-               {
-                       dequeue();
-               }
+               queueToBorder(body);
        }
        
        /**
@@ -319,13 +308,6 @@ public abstract class Border extends WebMarkupContainer 
implements IComponentRes
        public Border addToBorder(final Component... children)
        {
                super.add(children);
-               
-               //if body has not been assigned yet, we queue it
-               if (body.getParent() == null)
-               {
-                       dequeue();
-               }
-               
                return this;
        }
 
@@ -336,6 +318,13 @@ public abstract class Border extends WebMarkupContainer 
implements IComponentRes
                return this;
        }
        
+       @Override
+       protected void onConfigure() 
+       {
+               super.onConfigure();
+               dequeue();
+       }
+       
        /**
         * Queues children components to the Border itself
         *
@@ -669,8 +658,8 @@ public abstract class Border extends WebMarkupContainer 
implements IComponentRes
                {
                        //synch the tag id with the one of the body component
                        tag.setId(body.getId());
-                       return body;
                }
+               
                return super.findComponentToDequeue(tag);
        }
 

Reply via email to