You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by jd...@apache.org on 2009/10/05 21:26:13 UTC

svn commit: r821981 - 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: jdonnerstag
Date: Mon Oct  5 19:26:12 2009
New Revision: 821981

URL: http://svn.apache.org/viewvc?rev=821981&view=rev
Log:
fixed 
Issue: WICKET-2506

Added:
    wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePage_7.html
    wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePage_7.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=821981&r1=821980&r2=821981&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 Oct  5 19:26:12 2009
@@ -195,10 +195,13 @@
 		while (it.hasNext())
 		{
 			final ComponentTag tag = it.next();
-			final Component child = container.get(tag.getId());
-			// record original visiblity allowed value, will restore later
-			changes.put(child, child.isVisibilityAllowed());
-			child.setVisibilityAllowed(isVisible());
+			if (tag.isAutoComponentTag() == false)
+			{
+				final Component child = container.get(tag.getId());
+				// record original visiblity allowed value, will restore later
+				changes.put(child, child.isVisibilityAllowed());
+				child.setVisibilityAllowed(isVisible());
+			}
 		}
 		it.rewind();
 	}
@@ -225,43 +228,49 @@
 		{
 			final ComponentTag tag = it.next();
 
-			Component child = container.get(tag.getId());
-			if (child == null)
+			if (tag.isAutoComponentTag() == false)
 			{
-				// 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
-				CharSequence buffer = new ResponseBufferZone(getRequestCycle(), markupStream)
+				Component child = container.get(tag.getId());
+				if (child == null)
 				{
-					@Override
-					protected void executeInsideBufferedZone()
+					// 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
+					CharSequence buffer = new ResponseBufferZone(getRequestCycle(), markupStream)
 					{
-						markupStream.setCurrentIndex(tagIndex);
-						ComponentResolvers.resolve(getApplication(), container, markupStream, tag);
-					}
-				}.execute();
+						@Override
+						protected void executeInsideBufferedZone()
+						{
+							markupStream.setCurrentIndex(tagIndex);
+							ComponentResolvers.resolve(getApplication(), container, markupStream,
+								tag);
+						}
+					}.execute();
 
-				child = container.get(tag.getId());
-				checkChildComponent(child);
+					child = container.get(tag.getId());
+					checkChildComponent(child);
 
-				if (buffer.length() > 0)
-				{
-					// we have already rendered this child component, insert a stub component that
-					// will dump the markup during the normal render process if the enclosure is
-					// visible
-					final Component stub = new AutoMarkupLabel(child.getId(), buffer);
-					container.replace(stub); // ok here because we are replacing auto with auto
+					if (buffer.length() > 0)
+					{
+						// we have already rendered this child component, insert a stub component
+						// that will dump the markup during the normal render process if the
+						// enclosure is visible
+						final Component stub = new AutoMarkupLabel(child.getId(), buffer);
+						container.replace(stub); // ok here because we are replacing auto with auto
+					}
 				}
 			}
 		}
 		it.rewind();
 	}
 
-
+	/**
+	 * @see org.apache.wicket.Component#onDetach()
+	 */
 	@Override
 	protected void onDetach()
 	{
@@ -269,6 +278,9 @@
 		super.onDetach();
 	}
 
+	/**
+	 * 
+	 */
 	private void restoreOriginalChildVisibility()
 	{
 		if (changes != null)

Added: wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePage_7.html
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePage_7.html?rev=821981&view=auto
==============================================================================
--- wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePage_7.html (added)
+++ wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePage_7.html Mon Oct  5 19:26:12 2009
@@ -0,0 +1,14 @@
+<html>
+  <div wicket:id="group">
+    <table>
+      <wicket:enclosure child="radio">
+        <tr>
+          <td><input type="radio" wicket:id="radio" /> radio</td>
+        </tr>
+        <tr>
+          <td><a href="woops" class="linkhint">woops</a></td>
+        </tr>
+      </wicket:enclosure>
+    </table>
+  </div>
+</html>

Added: wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePage_7.java
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePage_7.java?rev=821981&view=auto
==============================================================================
--- wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePage_7.java (added)
+++ wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePage_7.java Mon Oct  5 19:26:12 2009
@@ -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.internal;
+
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.markup.html.form.Radio;
+import org.apache.wicket.markup.html.form.RadioGroup;
+
+public class EnclosurePage_7 extends WebPage
+{
+	public EnclosurePage_7()
+	{
+		this.add(new RadioGroup("group").add(new Radio<Void>("radio")));
+	}
+}

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=821981&r1=821980&r2=821981&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 Oct  5 19:26:12 2009
@@ -136,4 +136,13 @@
 		assertTrue(doc.contains("content1"));
 		assertTrue(doc.contains("content2"));
 	}
+
+	/**
+	 * 
+	 */
+	public void testRender()
+	{
+		tester = new WicketTester(EnclosurePage_7.class);
+		tester.startPage(EnclosurePage_7.class);
+	}
 }