Author: jdonnerstag
Date: Sun Jan 17 09:49:35 2010
New Revision: 900077
URL: http://svn.apache.org/viewvc?rev=900077&view=rev
Log:
fixed: checkRendering() throws Exception if TransparentResolver is invisible
Issue: WICKET-2679
Added:
wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/page/
wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/page/HomePage.html
wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/page/HomePage.java
wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/page/SimplePanel.html
wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/page/SimplePanel.java
wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/page/TestHomePage.java
Modified:
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/Page.java
Modified:
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/Page.java
URL:
http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/Page.java?rev=900077&r1=900076&r2=900077&view=diff
==============================================================================
---
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/Page.java
(original)
+++
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/Page.java
Sun Jan 17 09:49:35 2010
@@ -688,7 +688,7 @@
try
{
- if (getClass().getConstructor(new Class[] {})
!= null)
+ if (getClass().getConstructor(new Class[] { })
!= null)
{
bookmarkable = Boolean.TRUE;
}
@@ -1105,12 +1105,30 @@
// Get rid of set
renderedComponents = null;
+ List<Component> transparentContainerChildren =
new ArrayList<Component>();
+
Iterator<Component> iterator =
unrenderedComponents.iterator();
outerWhile : while (iterator.hasNext())
{
Component component = iterator.next();
- // Now first test if the component has
a sibling that is a transparent resolver.
+ // If any of the
transparentContainerChildren is a parent to component, than
+ // ignore it.
+ for (Component
transparentContainerChild : transparentContainerChildren)
+ {
+ MarkupContainer parent =
component.getParent();
+ while (parent != null)
+ {
+ if (parent ==
transparentContainerChild)
+ {
+
iterator.remove();
+ continue
outerWhile;
+ }
+ parent =
parent.getParent();
+ }
+ }
+
+ // Now first test if the component has
a sibling that is a transparent resolver.
Iterator<? extends Component> iterator2
= component.getParent().iterator();
while (iterator2.hasNext())
{
@@ -1127,6 +1145,7 @@
log.debug(
"Component {} wasn't rendered but most likely it has a transparent parent: {}",
component, sibling);
+
transparentContainerChildren.add(component);
iterator.remove();
continue
outerWhile;
}
@@ -1155,6 +1174,7 @@
iterator.remove();
}
}
+
// if still > 0
if (unrenderedComponents.size() > 0)
{
Added:
wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/page/HomePage.html
URL:
http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/page/HomePage.html?rev=900077&view=auto
==============================================================================
---
wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/page/HomePage.html
(added)
+++
wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/page/HomePage.html
Sun Jan 17 09:49:35 2010
@@ -0,0 +1,17 @@
+<html
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" >
+ <head>
+ <title>Wicket Quickstart Archetype Homepage</title>
+ </head>
+ <body>
+ <strong>Wicket Quickstart Archetype Homepage</strong>
+ <br/><br/>
+ <span wicket:id="message">message will be here</span>
+
+ <div wicket:id="border">
+ <span wicket:id="childNoMarkup"></span>
+
+ <div wicket:id="childMarkup"></div>
+ <!-- wicket:container
wicket:id="childMarkup"></wicket:container -->
+ </div>
+ </body>
+</html>
Added:
wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/page/HomePage.java
URL:
http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/page/HomePage.java?rev=900077&view=auto
==============================================================================
---
wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/page/HomePage.java
(added)
+++
wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/page/HomePage.java
Sun Jan 17 09:49:35 2010
@@ -0,0 +1,63 @@
+/*
+ * 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.page;
+
+import org.apache.wicket.PageParameters;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.model.Model;
+
+/**
+ * Homepage
+ */
+public class HomePage extends WebPage
+{
+
+ private static final long serialVersionUID = 1L;
+
+ // TODO Add any page properties or variables here
+
+ /**
+ * Constructor that is invoked when page is invoked without a session.
+ *
+ * @param parameters
+ * Page parameters
+ */
+ public HomePage(final PageParameters parameters)
+ {
+
+ // Add the simplest type of label
+ add(new Label("message",
+ "If you see this message wicket is properly configured
and running"));
+
+ WebMarkupContainer border = new WebMarkupContainer("border")
+ {
+ @Override
+ public boolean isTransparentResolver()
+ {
+ return true;
+ }
+ };
+ border.setVisible(false);
+ add(border);
+
+ add(new Label("childNoMarkup", Model.of("No Markup")));
+
+ add(new SimplePanel("childMarkup"));
+ }
+}
Added:
wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/page/SimplePanel.html
URL:
http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/page/SimplePanel.html?rev=900077&view=auto
==============================================================================
---
wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/page/SimplePanel.html
(added)
+++
wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/page/SimplePanel.html
Sun Jan 17 09:49:35 2010
@@ -0,0 +1,3 @@
+<wicket:panel>
+ <span wicket:id="label"></span>
+</wicket:panel>
Added:
wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/page/SimplePanel.java
URL:
http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/page/SimplePanel.java?rev=900077&view=auto
==============================================================================
---
wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/page/SimplePanel.java
(added)
+++
wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/page/SimplePanel.java
Sun Jan 17 09:49:35 2010
@@ -0,0 +1,31 @@
+/*
+ * 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.page;
+
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.model.Model;
+
+public class SimplePanel extends Panel
+{
+ public SimplePanel(String id)
+ {
+ super(id);
+
+ add(new Label("label", Model.of("Label")));
+ }
+}
Added:
wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/page/TestHomePage.java
URL:
http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/page/TestHomePage.java?rev=900077&view=auto
==============================================================================
---
wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/page/TestHomePage.java
(added)
+++
wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/page/TestHomePage.java
Sun Jan 17 09:49:35 2010
@@ -0,0 +1,41 @@
+/*
+ * 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.page;
+
+import junit.framework.TestCase;
+
+import org.apache.wicket.util.tester.WicketTester;
+
+/**
+ * Simple test using the WicketTester
+ */
+public class TestHomePage extends TestCase
+{
+ private WicketTester tester;
+
+ @Override
+ public void setUp()
+ {
+ tester = new WicketTester();
+ }
+
+ public void testRenderMyPage()
+ {
+ // no exception should occur
+ tester.startPage(HomePage.class);
+ }
+}