You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by ad...@apache.org on 2016/03/19 17:03:52 UTC

[1/2] wicket git commit: WICKET-6116 Exception 'A child already exists' when backing to a page with some markups in a Border

Repository: wicket
Updated Branches:
  refs/heads/master 823b30b5f -> a367d02e1


WICKET-6116 Exception 'A child already exists' when backing to a page with some markups in a Border

Now autocomponents are added to border and not to its body


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

Branch: refs/heads/master
Commit: d259cf389808e6ed52e9af2f905400fe2e53a70f
Parents: 823b30b
Author: Andrea Del Bene <ad...@apache.org>
Authored: Fri Mar 18 16:09:10 2016 +0100
Committer: Andrea Del Bene <ad...@apache.org>
Committed: Sat Mar 19 16:56:56 2016 +0100

----------------------------------------------------------------------
 .../wicket/markup/html/border/Border.java       |  2 +-
 .../autocomponent/AutoComponentsBorder.html     |  4 +++
 .../autocomponent/AutoComponentsBorder.java     | 29 +++++++++++++++++++
 .../AutocomponetsGenerationTest.java            | 30 ++++++++++++++++----
 4 files changed, 59 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/d259cf38/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 63da8f3..5ef0468 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
@@ -218,7 +218,7 @@ public abstract class Border extends WebMarkupContainer implements IComponentRes
 	{
 		for (Component component : children)
 		{
-			if (component == body)
+			if (component == body || component.isAuto())
 			{
 				addToBorder(component);
 			}

http://git-wip-us.apache.org/repos/asf/wicket/blob/d259cf38/wicket-core/src/test/java/org/apache/wicket/markup/html/autocomponent/AutoComponentsBorder.html
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/html/autocomponent/AutoComponentsBorder.html b/wicket-core/src/test/java/org/apache/wicket/markup/html/autocomponent/AutoComponentsBorder.html
new file mode 100644
index 0000000..5c3706e
--- /dev/null
+++ b/wicket-core/src/test/java/org/apache/wicket/markup/html/autocomponent/AutoComponentsBorder.html
@@ -0,0 +1,4 @@
+<wicket:border>
+    <img src="img/relative_path_autocomponent.png">
+    <wicket:body/>
+</wicket:border>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/wicket/blob/d259cf38/wicket-core/src/test/java/org/apache/wicket/markup/html/autocomponent/AutoComponentsBorder.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/html/autocomponent/AutoComponentsBorder.java b/wicket-core/src/test/java/org/apache/wicket/markup/html/autocomponent/AutoComponentsBorder.java
new file mode 100644
index 0000000..baafdce
--- /dev/null
+++ b/wicket-core/src/test/java/org/apache/wicket/markup/html/autocomponent/AutoComponentsBorder.java
@@ -0,0 +1,29 @@
+/**
+ *  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.autocomponent;
+
+import org.apache.wicket.markup.html.border.Border;
+
+public class AutoComponentsBorder extends Border
+{
+
+	public AutoComponentsBorder(String id)
+	{
+		super(id);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/d259cf38/wicket-core/src/test/java/org/apache/wicket/markup/html/autocomponent/AutocomponetsGenerationTest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/html/autocomponent/AutocomponetsGenerationTest.java b/wicket-core/src/test/java/org/apache/wicket/markup/html/autocomponent/AutocomponetsGenerationTest.java
index ba36883..7c0f45d 100644
--- a/wicket-core/src/test/java/org/apache/wicket/markup/html/autocomponent/AutocomponetsGenerationTest.java
+++ b/wicket-core/src/test/java/org/apache/wicket/markup/html/autocomponent/AutocomponetsGenerationTest.java
@@ -16,18 +16,18 @@
  */
 package org.apache.wicket.markup.html.autocomponent;
 
+import org.apache.wicket.core.util.string.ComponentRenderer;
 import org.apache.wicket.markup.IMarkupCache;
-import org.apache.wicket.markup.html.internal.HtmlHeaderContainer;
 import org.apache.wicket.util.tester.WicketTestCase;
 import org.junit.Test;
 
-/*
- * Test case for https://issues.apache.org/jira/browse/WICKET-5904
- * and for https://issues.apache.org/jira/browse/WICKET-5908
- */
 public class AutocomponetsGenerationTest extends WicketTestCase
 {
 
+	/*
+	 * Test for https://issues.apache.org/jira/browse/WICKET-5904
+	 * and for https://issues.apache.org/jira/browse/WICKET-5908
+	 */
 	@Test
 	public void autocomponetsNumberDoesntChange()
 	{
@@ -45,4 +45,24 @@ public class AutocomponetsGenerationTest extends WicketTestCase
 		//the number of child components must not have been changed
 		assertEquals(childrenNumber, tester.getLastRenderedPage().size());
 	}
+	
+	/*
+	 * Test for https://issues.apache.org/jira/browse/WICKET-6116
+	 */
+	@Test
+	public void borderResolvesAutocomponents() throws Exception
+	{
+		AutoComponentsBorder border = new AutoComponentsBorder("id");
+		
+		ComponentRenderer.renderComponent(border);
+		
+		//we expect to have a body container and an autocomponent for <img> tag
+		assertEquals(2, border.size());
+		
+		//let's render the same border again
+		ComponentRenderer.renderComponent(border);
+		
+		//the number of child components must not have been changed
+		assertEquals(2, border.size());
+	}
 }


[2/2] wicket git commit: WICKET-6116 Added missing license file

Posted by ad...@apache.org.
WICKET-6116 Added missing license file


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

Branch: refs/heads/master
Commit: a367d02e1205f016b6ce63a8f01397161b302900
Parents: d259cf3
Author: Andrea Del Bene <ad...@apache.org>
Authored: Fri Mar 18 18:00:20 2016 +0100
Committer: Andrea Del Bene <ad...@apache.org>
Committed: Sat Mar 19 16:57:02 2016 +0100

----------------------------------------------------------------------
 .../autocomponent/AutoComponentsBorder.java     | 26 ++++++++++----------
 1 file changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/a367d02e/wicket-core/src/test/java/org/apache/wicket/markup/html/autocomponent/AutoComponentsBorder.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/html/autocomponent/AutoComponentsBorder.java b/wicket-core/src/test/java/org/apache/wicket/markup/html/autocomponent/AutoComponentsBorder.java
index baafdce..98bc3d9 100644
--- a/wicket-core/src/test/java/org/apache/wicket/markup/html/autocomponent/AutoComponentsBorder.java
+++ b/wicket-core/src/test/java/org/apache/wicket/markup/html/autocomponent/AutoComponentsBorder.java
@@ -1,18 +1,18 @@
-/**
- *  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
+/*
+ * 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
+ *      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.
+ * 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.autocomponent;