You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2013/02/27 14:53:36 UTC

git commit: WICKET-5061 EnclosureHandler ignores wicket:xyz elements as children

Updated Branches:
  refs/heads/master 9182a8f6e -> 1a029c001


WICKET-5061 EnclosureHandler ignores wicket:xyz elements as children


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

Branch: refs/heads/master
Commit: 1a029c001b3254c711a8dfb2c9e9d9be2e08ab8c
Parents: 9182a8f
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Wed Feb 27 15:52:19 2013 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed Feb 27 15:52:19 2013 +0200

----------------------------------------------------------------------
 .../markup/parser/filter/EnclosureHandler.java     |   27 ++++++++------
 .../internal/EnclosurePageExpectedResult_1.html    |    5 +++
 .../markup/html/internal/EnclosurePage_1.html      |    5 +++
 .../markup/html/internal/EnclosurePage_1.java      |    1 +
 4 files changed, 26 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/1a029c00/wicket-core/src/main/java/org/apache/wicket/markup/parser/filter/EnclosureHandler.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/parser/filter/EnclosureHandler.java b/wicket-core/src/main/java/org/apache/wicket/markup/parser/filter/EnclosureHandler.java
index 55ce2da..3099c39 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/parser/filter/EnclosureHandler.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/parser/filter/EnclosureHandler.java
@@ -132,26 +132,29 @@ public final class EnclosureHandler extends AbstractMarkupFilter implements ICom
 			}
 		}
 		// Are we inside a wicket:enclosure tag?
-		else if ((tag.getId() != null) && (isWicketTag == false) && (stack != null) &&
-			(!tag.isAutoComponentTag()))
+		else if (stack != null)
 		{
 			ComponentTag lastEnclosure = stack.lastElement();
 
 			// If the enclosure tag has NO child attribute, then ...
 			if (lastEnclosure.getAttribute(CHILD_ATTRIBUTE) == null)
 			{
-				// We encountered more than one child component inside
-				// the enclosure and are not able to automatically
-				// determine the child component to delegate the
-				// isVisible() to => Exception
-				if (childId != null)
+				String id = tag.getAttribute(getWicketNamespace() + ":id");
+				if (id != null)
 				{
-					throw new WicketParseException(
-						"Use <wicket:enclosure child='xxx'> to name the child component:", tag);
+					// We encountered more than one child component inside
+					// the enclosure and are not able to automatically
+					// determine the child component to delegate the
+					// isVisible() to => Exception
+					if (childId != null)
+					{
+						throw new WicketParseException("Use <" + getWicketNamespace() +
+							":enclosure child='xxx'> to name the child component:", tag);
+					}
+					// Remember the child id. The open tag will be updated
+					// once the close tag is found. See above.
+					childId = id;
 				}
-				// Remember the child id. The open tag will be updated
-				// once the close tag is found. See above.
-				childId = tag.getId();
 			}
 		}
 

http://git-wip-us.apache.org/repos/asf/wicket/blob/1a029c00/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePageExpectedResult_1.html
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePageExpectedResult_1.html b/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePageExpectedResult_1.html
index 1d9b795..0982d7a 100644
--- a/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePageExpectedResult_1.html
+++ b/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePageExpectedResult_1.html
@@ -26,5 +26,10 @@
   <wicket:enclosure child="label9">
     <span wicket:id="label9">Test Label 2</span><p>
   </wicket:enclosure>
+
+  <wicket:enclosure child="label10">
+    <wicket:container wicket:id="label10">Test Label 3</wicket:container>
+  </wicket:enclosure>
+
 </body>
 </html>

http://git-wip-us.apache.org/repos/asf/wicket/blob/1a029c00/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePage_1.html
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePage_1.html b/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePage_1.html
index 77fe67f..bff0679 100644
--- a/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePage_1.html
+++ b/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePage_1.html
@@ -28,5 +28,10 @@
   <wicket:enclosure>
     <span wicket:id="label9">Test</span><p>
   </wicket:enclosure>
+
+  <wicket:enclosure>
+    <wicket:container wicket:id="label10">Test</wicket:container>
+  </wicket:enclosure>
+
 </body>
 </html>

http://git-wip-us.apache.org/repos/asf/wicket/blob/1a029c00/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePage_1.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePage_1.java b/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePage_1.java
index 1fa0f43..650bdbf 100644
--- a/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePage_1.java
+++ b/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/EnclosurePage_1.java
@@ -46,5 +46,6 @@ public class EnclosurePage_1 extends WebPage
 		add(container);
 		container.add(new Label("label8", "Test Label 2"));
 		add(new Label("label9", "Test Label 2"));
+		add(new Label("label10", "Test Label 3"));
 	}
 }