You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by iv...@apache.org on 2008/08/31 09:00:09 UTC

svn commit: r690648 - /wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/border/Border.java

Author: ivaynberg
Date: Sun Aug 31 00:00:09 2008
New Revision: 690648

URL: http://svn.apache.org/viewvc?rev=690648&view=rev
Log:
WICKET-1789: border rendering bug fix

Modified:
    wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/border/Border.java

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/border/Border.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/border/Border.java?rev=690648&r1=690647&r2=690648&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/border/Border.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/border/Border.java Sun Aug 31 00:00:09 2008
@@ -297,7 +297,7 @@
 
 		// body.isVisible(false) needs a little extra work. We must skip the
 		// markup between <span wicket:id="myBorder"> and </span>
-		if (body.isVisible() == false)
+		if (isBodyVisible() == false)
 		{
 			originalMarkupStream.skipToMatchingCloseTag(openTag);
 		}
@@ -403,4 +403,24 @@
 			return false;
 		}
 	}
+
+	/**
+	 * Determines whether or not the border body is visible.
+	 * 
+	 * @return true if body of the border is visible, false otherwise
+	 */
+	private boolean isBodyVisible()
+	{
+		// in order to determine this we have to visit all components between the border and the
+		// body because border body can be embedded inside other containers.
+
+		boolean bodyVisible = true;
+		Component cursor = body;
+		while (cursor != this && bodyVisible)
+		{
+			bodyVisible = cursor.determineVisibility();
+			cursor = cursor.getParent();
+		}
+		return bodyVisible;
+	}
 }