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 2007/06/23 22:12:30 UTC

svn commit: r550096 - in /incubator/wicket/trunk/jdk-1.4/wicket/src: main/java/org/apache/wicket/markup/html/ test/java/org/apache/wicket/markup/html/basic/ test/java/org/apache/wicket/util/io/

Author: jdonnerstag
Date: Sat Jun 23 13:12:29 2007
New Revision: 550096

URL: http://svn.apache.org/viewvc?view=rev&rev=550096
Log:
prevent that attribute modifiers are attached to web pages. Such a modifier will not be called anyway. But users are attaching e.g. HeaderContributor.forCss to the page and don't understand why nothing gets added to the header.

Added:
    incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/BasePage.css   (with props)
Modified:
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/WebPage.java
    incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageExpectedResult_13.html
    incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/util/io/PageA.java
    incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/util/io/PageB.java

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/WebPage.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/WebPage.java?view=diff&rev=550096&r1=550095&r2=550096
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/WebPage.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/WebPage.java Sat Jun 23 13:12:29 2007
@@ -26,7 +26,9 @@
 import org.apache.wicket.ResourceReference;
 import org.apache.wicket.Response;
 import org.apache.wicket.Session;
+import org.apache.wicket.WicketRuntimeException;
 import org.apache.wicket.behavior.AbstractBehavior;
+import org.apache.wicket.behavior.IBehavior;
 import org.apache.wicket.markup.ComponentTag;
 import org.apache.wicket.markup.MarkupElement;
 import org.apache.wicket.markup.MarkupStream;
@@ -161,8 +163,8 @@
 				}
 				JavascriptUtils.writeOpenTag(response);
 				response
-						.write("if (window.name=='' || (window.name.indexOf('wicket') > -1 && window.name!='"
-								+ name + "')) { window.location=\"");
+						.write("if (window.name=='' || (window.name.indexOf('wicket') > -1 && window.name!='" +
+								name + "')) { window.location=\"");
 				response.write(url);
 				response.write("\"; }");
 				JavascriptUtils.writeCloseTag(response);
@@ -409,5 +411,18 @@
 			this.remove(header);
 		}
 		super.onDetach();
+	}
+
+	/**
+	 * 
+	 * @see org.apache.wicket.Component#add(org.apache.wicket.behavior.IBehavior)
+	 */
+	public Component add(final IBehavior behavior)
+	{
+		throw new WicketRuntimeException(
+				"You can not attach behaviors onto WebPages. Web pages do require a markup "
+						+ "file but no specific tag to attach the page to. "
+						+ "This is why behaviors such as HeaderContributor for example don't work if "
+						+ "attached to a WebPage. Please attach the behavior to any other of your components.");
 	}
 }

Added: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/BasePage.css
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/BasePage.css?view=auto&rev=550096
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/BasePage.css (added)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/BasePage.css Sat Jun 23 13:12:29 2007
@@ -0,0 +1,3 @@
+body {
+  background-color: yellow;
+}
\ No newline at end of file

Propchange: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/BasePage.css
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageExpectedResult_13.html
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageExpectedResult_13.html?view=diff&rev=550096&r1=550095&r2=550096
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageExpectedResult_13.html (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageExpectedResult_13.html Sat Jun 23 13:12:29 2007
@@ -9,6 +9,7 @@
 /*-->]]>*/</script>
 
 <script type="text/javascript" src="resources/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug.js"></script>
+<link rel="stylesheet" type="text/css" href="../BasePage.css" />
 </head><body>
   </body>
 </html> 

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/util/io/PageA.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/util/io/PageA.java?view=diff&rev=550096&r1=550095&r2=550096
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/util/io/PageA.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/util/io/PageA.java Sat Jun 23 13:12:29 2007
@@ -16,9 +16,7 @@
  */
 package org.apache.wicket.util.io;
 
-import org.apache.wicket.AttributeModifier;
 import org.apache.wicket.markup.html.WebPage;
-import org.apache.wicket.model.Model;
 
 /**
  * @author jcompagner
@@ -32,10 +30,14 @@
 
 	private PageB page;
 
+	/**
+	 * 
+	 * Construct.
+	 * @param page
+	 */
 	public PageA(PageB page)
 	{
 		this.page = page;
-		add(new AttributeModifier("test",new Model(page)));
 	}
 
 	/**

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/util/io/PageB.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/util/io/PageB.java?view=diff&rev=550096&r1=550095&r2=550096
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/util/io/PageB.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/util/io/PageB.java Sat Jun 23 13:12:29 2007
@@ -16,9 +16,7 @@
  */
 package org.apache.wicket.util.io;
 
-import org.apache.wicket.AttributeModifier;
 import org.apache.wicket.markup.html.WebPage;
-import org.apache.wicket.model.Model;
 
 /**
  * @author jcompagner
@@ -34,7 +32,7 @@
 	
 	/**
 	 * Construct.
-	 * @param t
+	 * @param test
 	 */
 	public PageB(String test)
 	{
@@ -57,7 +55,6 @@
 	public void setA(PageA a)
 	{
 		this.a = a;
-		add(new AttributeModifier("test",new Model(a)));
 	}
 
 	/**