You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by jr...@apache.org on 2010/05/24 08:45:04 UTC

svn commit: r947547 - in /wicket/branches/wicket-1.4.x/wicket/src: main/java/org/apache/wicket/markup/html/internal/ test/java/org/apache/wicket/markup/html/internal/

Author: jrthomerson
Date: Mon May 24 06:45:04 2010
New Revision: 947547

URL: http://svn.apache.org/viewvc?rev=947547&view=rev
Log:
Fixes WICKET-2882


Added:
    wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePageExpectedResult_11.html
    wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePage_11.html
    wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePage_11.java
    wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/SimplePanel.html
    wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/SimplePanel.java
Modified:
    wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/internal/Enclosure.java
    wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/EnclosureTest.java

Modified: wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/internal/Enclosure.java
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/internal/Enclosure.java?rev=947547&r1=947546&r2=947547&view=diff
==============================================================================
--- wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/internal/Enclosure.java (original)
+++ wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/internal/Enclosure.java Mon May 24 06:45:04 2010
@@ -240,10 +240,6 @@ public class Enclosure extends WebMarkup
 				Component child = container.get(tag.getId());
 				if (child == null)
 				{
-					// component does not yet exist in the container, attempt to resolve it using
-					// resolvers
-					final int tagIndex = it.getCurrentIndex();
-
 					// because the resolvers can auto-add and therefore immediately render the
 					// component we have to buffer the output since we do not yet know the
 					// visibility of the enclosure
@@ -252,7 +248,9 @@ public class Enclosure extends WebMarkup
 						@Override
 						protected void executeInsideBufferedZone()
 						{
-							markupStream.setCurrentIndex(tagIndex);
+							final int ind = markupStream.findComponentIndex(tag.getPath(),
+								tag.getId());
+							markupStream.setCurrentIndex(ind);
 							ComponentResolvers.resolve(getApplication(), container, markupStream,
 								tag);
 						}

Added: wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePageExpectedResult_11.html
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePageExpectedResult_11.html?rev=947547&view=auto
==============================================================================
--- wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePageExpectedResult_11.html (added)
+++ wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePageExpectedResult_11.html Mon May 24 06:45:04 2010
@@ -0,0 +1,12 @@
+<html xmlns:wicket>
+<body>
+	<wicket:enclosure child="autoCreatedPanel">
+		<div>
+			<span wicket:id="autoCreatedPanel"><span wicket:id="autoCreatedPanel"><wicket:panel>
+	This is a simple test panel.
+	With this component: <span wicket:id="label">hello world</span>
+</wicket:panel></span></span>
+		</div>
+	</wicket:enclosure>
+</body>
+</html>

Added: wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePage_11.html
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePage_11.html?rev=947547&view=auto
==============================================================================
--- wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePage_11.html (added)
+++ wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePage_11.html Mon May 24 06:45:04 2010
@@ -0,0 +1,9 @@
+<html xmlns:wicket>
+<body>
+	<wicket:enclosure>
+		<div>
+			<span wicket:id="autoCreatedPanel"></span>
+		</div>
+	</wicket:enclosure>
+</body>
+</html>

Added: wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePage_11.java
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePage_11.java?rev=947547&view=auto
==============================================================================
--- wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePage_11.java (added)
+++ wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePage_11.java Mon May 24 06:45:04 2010
@@ -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.internal;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.MarkupContainer;
+import org.apache.wicket.markup.ComponentTag;
+import org.apache.wicket.markup.MarkupStream;
+import org.apache.wicket.markup.WicketTag;
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.markup.resolver.IComponentResolver;
+
+
+/**
+ * Mock page for testing (see WICKET-2882).
+ * 
+ * @author Jeremy Thomerson
+ */
+public class EnclosurePage_11 extends WebPage implements IComponentResolver
+{
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * Construct.
+	 */
+	public EnclosurePage_11()
+	{
+	}
+
+	public boolean resolve(MarkupContainer container, MarkupStream markupStream, ComponentTag tag)
+	{
+		if (tag instanceof WicketTag)
+		{
+			// this resolver does not handle wicket tags
+			return false;
+		}
+
+		if ("autoCreatedPanel".equals(tag.getId()))
+		{
+			final Component component = new SimplePanel(tag.getId());
+			container.autoAdd(component);
+			return true;
+		}
+		return false;
+	}
+}

Modified: wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/EnclosureTest.java
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/EnclosureTest.java?rev=947547&r1=947546&r2=947547&view=diff
==============================================================================
--- wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/EnclosureTest.java (original)
+++ wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/EnclosureTest.java Mon May 24 06:45:04 2010
@@ -322,4 +322,14 @@ public class EnclosureTest extends Wicke
 		tester.assertRenderedPage(clazz);
 		tester.assertResultPage(getClass(), "EnclosurePageExpectedResult_10.html");
 	}
+
+	/**
+	 * @throws Exception
+	 */
+	public void testRenderPage11() throws Exception
+	{
+		executeTest(EnclosurePage_11.class, "EnclosurePageExpectedResult_11.html");
+	}
+
+
 }

Added: wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/SimplePanel.html
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/SimplePanel.html?rev=947547&view=auto
==============================================================================
--- wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/SimplePanel.html (added)
+++ wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/SimplePanel.html Mon May 24 06:45:04 2010
@@ -0,0 +1,4 @@
+<wicket:panel>
+	This is a simple test panel.
+	With this component: <span wicket:id="label">[some label]</span>
+</wicket:panel>
\ No newline at end of file

Added: wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/SimplePanel.java
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/SimplePanel.java?rev=947547&view=auto
==============================================================================
--- wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/SimplePanel.java (added)
+++ wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/SimplePanel.java Mon May 24 06:45:04 2010
@@ -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.internal;
+
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.model.Model;
+
+/**
+ * Just a simple panel for testing purposes.
+ * 
+ * @author Jeremy Thomerson
+ */
+public class SimplePanel extends Panel
+{
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * simple constructor.
+	 * 
+	 * @param id
+	 */
+	public SimplePanel(String id)
+	{
+		super(id);
+		add(new Label("label", new Model<String>("hello world")));
+	}
+
+}