Author: jdonnerstag
Date: Tue Jul 14 15:17:49 2009
New Revision: 793932

URL: http://svn.apache.org/viewvc?rev=793932&view=rev
Log:
fixed: Page.checkRendering fails after setting BorderBodyContainer visiblity to 
false
Issue: WICKET-2368

Added:
    
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/border/BoxBorderTestPage_11.html
    
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/border/BoxBorderTestPage_11.java
    
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/border/BoxBorderTestPage_ExpectedResult_11.html
    
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/border/TogglePanel.html
    
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/border/TogglePanel.java
Modified:
    wicket/trunk/wicket/src/main/java/org/apache/wicket/Page.java
    
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/border/BoxBorderTest.java

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/Page.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/Page.java?rev=793932&r1=793931&r2=793932&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/Page.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/Page.java Tue Jul 14 
15:17:49 2009
@@ -688,7 +688,7 @@
                        try
                        {
 
-                               if (getClass().getConstructor(new Class[] {}) 
!= null)
+                               if (getClass().getConstructor(new Class[] { }) 
!= null)
                                {
                                        bookmarkable = Boolean.TRUE;
                                }
@@ -1067,7 +1067,7 @@
                                        // If component never rendered
                                        if (renderedComponents == null || 
!renderedComponents.contains(component))
                                        {
-                                               // If auto component ...
+                                               // If not an auto component ...
                                                if (!component.isAuto() && 
component.isVisibleInHierarchy())
                                                {
                                                        // Increase number of 
unrendered components
@@ -1106,8 +1106,7 @@
                                renderedComponents = null;
 
                                Iterator<Component> iterator = 
unrenderedComponents.iterator();
-
-                               while (iterator.hasNext())
+                               outerWhile : while (iterator.hasNext())
                                {
                                        Component component = iterator.next();
                                        // Now first test if the component has 
a sibling that is a transparent resolver.
@@ -1129,7 +1128,7 @@
                                                                        
"Component {} wasn't rendered but most likely it has a transparent parent: {}",
                                                                        
component, sibling);
                                                                
iterator.remove();
-                                                               break;
+                                                               continue 
outerWhile;
                                                        }
                                                }
                                        }
@@ -1139,7 +1138,6 @@
                                        Border border = 
component.findParent(Border.class);
                                        if (border != null && 
!border.getBodyContainer().isVisibleInHierarchy())
                                        {
-
                                                // Suppose:
                                                //                              
                  
                                                // <div wicket:id="border"><div 
wicket:id="label"></div> suppose

Modified: 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/border/BoxBorderTest.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/border/BoxBorderTest.java?rev=793932&r1=793931&r2=793932&view=diff
==============================================================================
--- 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/border/BoxBorderTest.java
 (original)
+++ 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/border/BoxBorderTest.java
 Tue Jul 14 15:17:49 2009
@@ -208,4 +208,21 @@
                        "Expected a WicketRuntimeException. Border tag must be 
open tags. Open-close tags are not allowed",
                        e);
        }
+
+       /**
+        * Test a simply page containing the debug component
+        * 
+        * @throws Exception
+        */
+       public void test11() throws Exception
+       {
+               executeTest(BoxBorderTestPage_11.class, 
"BoxBorderTestPage_ExpectedResult_11.html");
+
+               Page page = tester.getLastRenderedPage();
+               tester.clickLink("border:title");
+
+               tester.clickLink("border:title");
+
+               tester.clickLink("border:title");
+       }
 }

Added: 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/border/BoxBorderTestPage_11.html
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/border/BoxBorderTestPage_11.html?rev=793932&view=auto
==============================================================================
--- 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/border/BoxBorderTestPage_11.html
 (added)
+++ 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/border/BoxBorderTestPage_11.html
 Tue Jul 14 15:17:49 2009
@@ -0,0 +1,21 @@
+<!--
+    ====================================================================
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<html>
+<body>
+  <span wicket:id="border">
+       <div wicket:id="label">label</div>
+  </span>
+</body>
+</html>

Added: 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/border/BoxBorderTestPage_11.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/border/BoxBorderTestPage_11.java?rev=793932&view=auto
==============================================================================
--- 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/border/BoxBorderTestPage_11.java
 (added)
+++ 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/border/BoxBorderTestPage_11.java
 Tue Jul 14 15:17:49 2009
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.markup.html.border;
+
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.model.Model;
+
+
+/**
+ * Mock page for testing.
+ * 
+ * @author Chris Turner
+ */
+public class BoxBorderTestPage_11 extends WebPage
+{
+       private static final long serialVersionUID = 1L;
+
+       /**
+        * Construct.
+        * 
+        */
+       public BoxBorderTestPage_11()
+       {
+               Border border = new TogglePanel("border", new 
Model<String>("model"));
+               add(border);
+
+               border.add(new Label("label", "my test"));
+       }
+}

Added: 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/border/BoxBorderTestPage_ExpectedResult_11.html
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/border/BoxBorderTestPage_ExpectedResult_11.html?rev=793932&view=auto
==============================================================================
--- 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/border/BoxBorderTestPage_ExpectedResult_11.html
 (added)
+++ 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/border/BoxBorderTestPage_ExpectedResult_11.html
 Tue Jul 14 15:17:49 2009
@@ -0,0 +1,27 @@
+<!--
+    ====================================================================
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<html>
+<body>
+  <span wicket:id="border"><wicket:border>
+  <h3 class="collapse" wicket:id="title" onclick="var win = 
this.ownerDocument.defaultView || this.ownerDocument.parentWindow; if (win == 
window) { 
window.location.href='?wicket:interface=:0:border:title::ILinkListener::'; } 
;return false">
+    <span class="label" wicket:id="titleLabel">model</span>
+    <a class="foldicon">&nbsp;</a>
+  </h3>
+  <wicket:body>
+       <div wicket:id="label">my test</div>
+  </wicket:body>
+</wicket:border></span>
+</body>
+</html>

Added: 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/border/TogglePanel.html
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/border/TogglePanel.html?rev=793932&view=auto
==============================================================================
--- 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/border/TogglePanel.html
 (added)
+++ 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/border/TogglePanel.html
 Tue Jul 14 15:17:49 2009
@@ -0,0 +1,8 @@
+
+<wicket:border>
+  <h3 class="collapse" wicket:id="title">
+    <span class="label" wicket:id="titleLabel">Panel Title</span>
+    <a class="foldicon">&nbsp;</a>
+  </h3>
+  <wicket:body />
+</wicket:border> 
\ No newline at end of file

Added: 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/border/TogglePanel.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/border/TogglePanel.java?rev=793932&view=auto
==============================================================================
--- 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/border/TogglePanel.java
 (added)
+++ 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/border/TogglePanel.java
 Tue Jul 14 15:17:49 2009
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.markup.html.border;
+
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.link.Link;
+import org.apache.wicket.model.IModel;
+
+
+/**
+ * Test the component: PageView
+ * 
+ * @author Juergen Donnerstag
+ */
+public class TogglePanel extends Border
+{
+       private static final long serialVersionUID = 1L;
+
+       private boolean expanded = true;
+
+       /**
+        * Construct.
+        * 
+        * @param id
+        * @param titleModel
+        */
+       public TogglePanel(String id, IModel<String> titleModel)
+       {
+               super(id, titleModel);
+
+               Link<Void> link = new Link<Void>("title")
+               {
+                       private static final long serialVersionUID = 1L;
+
+                       @Override
+                       public void onClick()
+                       {
+                               expanded = !expanded;
+                               getBodyContainer().setVisible(expanded);
+                       }
+               };
+               link.add(new Label("titleLabel", titleModel));
+
+               add(link);
+       }
+}
\ No newline at end of file


Reply via email to