<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>STUQ.nl &#187; Featured</title>
	<atom:link href="http://stuq.nl/category/featured/feed" rel="self" type="application/rss+xml" />
	<link>http://stuq.nl</link>
	<description></description>
	<lastBuildDate>Thu, 30 Dec 2010 10:23:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>3 risks with Agile decision making</title>
		<link>http://stuq.nl/weblog/2010-06-22/3-risks-with-agile-decision-making</link>
		<comments>http://stuq.nl/weblog/2010-06-22/3-risks-with-agile-decision-making#comments</comments>
		<pubDate>Tue, 22 Jun 2010 20:37:30 +0000</pubDate>
		<dc:creator>Daan</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Headline]]></category>
		<category><![CDATA[Productivity]]></category>
		<category><![CDATA[Scrum]]></category>

		<guid isPermaLink="false">http://stuq.nl/?p=565</guid>
		<description><![CDATA[Agile teams are generally cohesive and are empowered and expected to make day-to-day decisions. A large part of empowerment in Agile methods is that the team makes the decisions, not the project manager. However, there are some risks involved with this type of decision making. In this article I describe some possible risks. Group think [...]<p>Read the original at <a href="http://stuq.nl/weblog/2010-06-22/3-risks-with-agile-decision-making">3 risks with Agile decision making</a> or go to the homepage of <a href="http://stuq.nl">STUQ.nl</a></p>


<br/><br/>
Related posts:<ul><li><a href='http://stuq.nl/weblog/2010-06-01/it%e2%80%99s-not-about-the-features' rel='bookmark' title='It’s not about the features!'>It’s not about the features!</a></li>
<li><a href='http://stuq.nl/weblog/2009-02-11/interaction-design-and-extreme-programming' rel='bookmark' title='Interaction Design and Extreme Programming'>Interaction Design and Extreme Programming</a></li>
<li><a href='http://stuq.nl/weblog/2008-12-10/6-reasons-to-create-user-interface-mockups' rel='bookmark' title='6 reasons to create user interface mockups'>6 reasons to create user interface mockups</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p><img class="size-thumbnail wp-image-576 alignright" style="margin-left: 10px;" title="Warning" src="http://stuq.nl/media/warning1-150x150.jpg" alt="" width="150" height="150" />Agile teams are generally cohesive and are empowered and expected to make day-to-day decisions. A large part of empowerment in Agile methods is that the team makes the decisions, not the project manager. However, there are some risks involved with this type of decision making. In this article I describe some possible risks.</p>
<h3>Group think</h3>
<p>The first risk in decision making is <strong>group think</strong>.</p>
<p>Group think has the following symptoms:</p>
<ul>
<li>Little or no consideration of alternate plans</li>
<li>Risk is not assessed</li>
<li>No review is taken of rejected plans</li>
<li>Advice from outsiders is not sought</li>
<li>Facts that support the plan are acknowledged, facts that do not support the plan are ignored</li>
<li>Contingency plans are not created</li>
</ul>
<p>Surprisingly, synergy and loyalty to each other and to the team leader are a team’s greatest qualities, however, they are the same factors that lead to group think.</p>
<h3>Abilene Paradox symptom</h3>
<p>The second risk in decision making is the <strong>Abilene Paradox symptom</strong>.</p>
<p>The Abilene Paradox symptom has the following symptoms:</p>
<ul>
<li>Members, as individuals, privately agree on the correct decision to make. This is not shared with the group.</li>
<li>Members, as individuals, privately agree on how the problem or situation being addressed can be resolved. This is not shared with the group.</li>
<li>Instead of communicating their views, members keep their views and reservations to themselves, agreeing with views they are opposed to. As the individuals have not presented their views and reservations, a collective decision is made that is actually contrary to the views of all members.</li>
<li>Members feel frustration, even anger, at this and find someone, or some people, to blame.</li>
</ul>
<p>The Abilene Paradox is real. How often have you agreed to a suboptimal solution? What if every other team member felt the same way about this solution?</p>
<h3>Decision hijacking</h3>
<p>The third risk in decision making is <strong>decision hijacking</strong>. This happens when for example a developer implements features that are not needed right now. The developer hijacks the decision to implement these features.</p>
<p>Example during daily stand-up:<br />
Developer: The customer databases will be used by several applications, so I have implemented support for dealing with various technologies, including Oracle. It took a lot of time. Scrum master: Did we not agree on postponing this? Developer: We need this later and now it is done.”</p>
<p>Decision hijacking is a big problem because the decision making itself is removed from the team as a whole. This behavior has a big impact on trust within the team.</p>
<h3>Solutions</h3>
<p><strong>Conflict in Agile software development projects</strong> can be beneficial to both process and product.</p>
<p>The literature proposes some solutions to the problems with decision making described above. These solutions are based on the existence or stimulation of intra-group conflict:</p>
<ul>
<li>Separate groups should be formed, under different leaders, to propose solutions to the same problem (groupthink)</li>
<li>A devil’s advocate should be appointed (groupthink, Abilene paradox)</li>
</ul>
<p>For the decision hijacking risk, make sure that developers are on the same page. Working together as a team means taking decisions together.</p>
<p><strong>Sources</strong>:</p>
<ol>
<li>McAvoy, John, en Tom Butler. “The role of project management in ineffective decision making within Agile software development projects.” European Journal of Information Systems 18.4 (2009): 372-383. Web.</li>
<li>Moe, Nils Brede, Torgeir Dingsøyr, en Tore Dybå. “A teamwork model for understanding an agile team: A case study of a Scrum project.” Information and Software Technology 52.5 (2010): 480-491. Web.</li>
</ol>
<p>Read the original at <a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3N0dXEubmwvd2VibG9nLzIwMTAtMDYtMjIvMy1yaXNrcy13aXRoLWFnaWxlLWRlY2lzaW9uLW1ha2luZw==">3 risks with Agile decision making</a> or go to the homepage of <a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3N0dXEubmw=">STUQ.nl</a></p>
 <img src="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=565" width="1" height="1" style="display: none;" /><div id="simple_socialmedia"><ul class="ssm_row"><li class="sharetext">Share:</li><li class="twitter"><a target="_blank" href="http://twitter.com/share?url=http://stuq.nl/weblog/2010-06-22/3-risks-with-agile-decision-making&amp;text=3 risks with Agile decision making&amp;via=daanvanetten">Tweet</a></li><li class="facebook"><a target="_blank" title="Share on Facebook" rel="nofollow" href="http://www.facebook.com/sharer.php?u=http://stuq.nl/weblog/2010-06-22/3-risks-with-agile-decision-making&amp;t=3 risks with Agile decision making">Facebook</a></li><li class="linkedin"><a target="_blank" title="Share on LinkedIn" rel="nofollow" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://stuq.nl/weblog/2010-06-22/3-risks-with-agile-decision-making&amp;title=3 risks with Agile decision making&amp;source=STUQ.nl">LinkedIn</a></li><li class="tumblr"><a target="_blank" title="Share on Tumblr" rel="nofollow" href="http://www.tumblr.com/share/link?url=http%3A%2F%2Fstuq.nl%2Fweblog%2F2010-06-22%2F3-risks-with-agile-decision-making&name=STUQ.nl&description=3+risks+with+Agile+decision+making" title="Share on Tumblr">Tumblr</a></li><li class="stumble"><a target="_blank" title="Share on StumbleUpon" rel="nofollow" href="http://www.stumbleupon.com/submit?url=http://stuq.nl/weblog/2010-06-22/3-risks-with-agile-decision-making">Stumble</a></li><li class="digg"><a target="_blank" title="Share on Digg" rel="nofollow" href="http://www.digg.com/submit?phase=2&amp;url=http://stuq.nl/weblog/2010-06-22/3-risks-with-agile-decision-making">Digg</a></li><li class="delicious"><a target="_blank" title="Share on Delicious" rel="nofollow" href="http://del.icio.us/post?url=http://stuq.nl/weblog/2010-06-22/3-risks-with-agile-decision-making&amp;title=INSERT_TITLE">Delicious</a></li></ul></div>

<br/><br/><p>Related posts:<ul><li><a href='http://stuq.nl/weblog/2010-06-01/it%e2%80%99s-not-about-the-features' rel='bookmark' title='It’s not about the features!'>It’s not about the features!</a></li>
<li><a href='http://stuq.nl/weblog/2009-02-11/interaction-design-and-extreme-programming' rel='bookmark' title='Interaction Design and Extreme Programming'>Interaction Design and Extreme Programming</a></li>
<li><a href='http://stuq.nl/weblog/2008-12-10/6-reasons-to-create-user-interface-mockups' rel='bookmark' title='6 reasons to create user interface mockups'>6 reasons to create user interface mockups</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://stuq.nl/weblog/2010-06-22/3-risks-with-agile-decision-making/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>It’s not about the features!</title>
		<link>http://stuq.nl/weblog/2010-06-01/it%e2%80%99s-not-about-the-features</link>
		<comments>http://stuq.nl/weblog/2010-06-01/it%e2%80%99s-not-about-the-features#comments</comments>
		<pubDate>Tue, 01 Jun 2010 21:47:31 +0000</pubDate>
		<dc:creator>Daan</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Headline]]></category>
		<category><![CDATA[Productivity]]></category>
		<category><![CDATA[Scrum]]></category>

		<guid isPermaLink="false">http://stuq.nl/?p=559</guid>
		<description><![CDATA[I believe that any software developing company that wants to have a competitive advantage needs to stop focusing on just building features, but instead focus on the users.<p>Read the original at <a href="http://stuq.nl/weblog/2010-06-01/it%e2%80%99s-not-about-the-features">It’s not about the features!</a> or go to the homepage of <a href="http://stuq.nl">STUQ.nl</a></p>


<br/><br/>
Related posts:<ul><li><a href='http://stuq.nl/weblog/2010-06-22/3-risks-with-agile-decision-making' rel='bookmark' title='3 risks with Agile decision making'>3 risks with Agile decision making</a></li>
<li><a href='http://stuq.nl/weblog/2009-02-11/interaction-design-and-extreme-programming' rel='bookmark' title='Interaction Design and Extreme Programming'>Interaction Design and Extreme Programming</a></li>
<li><a href='http://stuq.nl/weblog/2008-06-20/create-restful-urls-with-wicket' rel='bookmark' title='Create RESTful URLs with Wicket'>Create RESTful URLs with Wicket</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p><img class="size-thumbnail wp-image-560 alignleft" title="Struktable Strukt multi touch table" src="http://stuq.nl/media/struktable-03-23-09-150x150.jpg" alt="" width="150" height="150" /></p>
<p>I believe that any software developing company that wants to have a competitive advantage needs to stop focusing on just building features, but instead focus on the users.</p>
<p>Many companies seem to focus on the checklist of features that are dreamed up by marketing. Most of these checklists result from doing ‘competitive analysis’, just look at what the competitors, and do that too. Development teams have to copy all the software features of the competition, just to keep up. That is mediocrity at its best.</p>
<p>Developing software is not a unique trait. It’s not that hard as it used to be, the lab coats are long since gone. Coding can be outsourced to China or India at a fraction of the cost, as can many other aspects of software development.</p>
<p>Shipping a huge amount of features became relatively cheap. The time of industrialization has come for software development. Lines of code are becoming cheaper every minute. A lot of open source software (‘free software’) now has the same (or more) features as commercial available software.</p>
<p>So, it is not about building a huge amount of features.</p>
<p>It is about building clever software that works really well, in its context. Companies have to build revolutionary, groundbreaking, surprisingly good software to be noticed and successful. It has to be different and fresh, revolutionary perhaps.</p>
<p>How do you do that? Invest in interaction design. Do research to find out who your users really are. Talk to them. The <strong>real</strong> users.</p>
<p>Learn about them. Find out what they need. Find out what they like, what they don’t like.<br />
Learn where your software becomes part of their lives.</p>
<p>Learn how to improve. Improve your software, and learn more. Make your users happy. Never lose them out of sight.</p>
<p>Read the original at <a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3N0dXEubmwvd2VibG9nLzIwMTAtMDYtMDEvaXQlZTIlODAlOTlzLW5vdC1hYm91dC10aGUtZmVhdHVyZXM=">It’s not about the features!</a> or go to the homepage of <a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3N0dXEubmw=">STUQ.nl</a></p>
 <img src="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=559" width="1" height="1" style="display: none;" /><div id="simple_socialmedia"><ul class="ssm_row"><li class="sharetext">Share:</li><li class="twitter"><a target="_blank" href="http://twitter.com/share?url=http://stuq.nl/weblog/2010-06-01/it%e2%80%99s-not-about-the-features&amp;text=It’s not about the features!&amp;via=daanvanetten">Tweet</a></li><li class="facebook"><a target="_blank" title="Share on Facebook" rel="nofollow" href="http://www.facebook.com/sharer.php?u=http://stuq.nl/weblog/2010-06-01/it%e2%80%99s-not-about-the-features&amp;t=It’s not about the features!">Facebook</a></li><li class="linkedin"><a target="_blank" title="Share on LinkedIn" rel="nofollow" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://stuq.nl/weblog/2010-06-01/it%e2%80%99s-not-about-the-features&amp;title=It’s not about the features!&amp;source=STUQ.nl">LinkedIn</a></li><li class="tumblr"><a target="_blank" title="Share on Tumblr" rel="nofollow" href="http://www.tumblr.com/share/link?url=http%3A%2F%2Fstuq.nl%2Fweblog%2F2010-06-01%2Fit%25e2%2580%2599s-not-about-the-features&name=STUQ.nl&description=It%E2%80%99s+not+about+the+features%21" title="Share on Tumblr">Tumblr</a></li><li class="stumble"><a target="_blank" title="Share on StumbleUpon" rel="nofollow" href="http://www.stumbleupon.com/submit?url=http://stuq.nl/weblog/2010-06-01/it%e2%80%99s-not-about-the-features">Stumble</a></li><li class="digg"><a target="_blank" title="Share on Digg" rel="nofollow" href="http://www.digg.com/submit?phase=2&amp;url=http://stuq.nl/weblog/2010-06-01/it%e2%80%99s-not-about-the-features">Digg</a></li><li class="delicious"><a target="_blank" title="Share on Delicious" rel="nofollow" href="http://del.icio.us/post?url=http://stuq.nl/weblog/2010-06-01/it%e2%80%99s-not-about-the-features&amp;title=INSERT_TITLE">Delicious</a></li></ul></div>

<br/><br/><p>Related posts:<ul><li><a href='http://stuq.nl/weblog/2010-06-22/3-risks-with-agile-decision-making' rel='bookmark' title='3 risks with Agile decision making'>3 risks with Agile decision making</a></li>
<li><a href='http://stuq.nl/weblog/2009-02-11/interaction-design-and-extreme-programming' rel='bookmark' title='Interaction Design and Extreme Programming'>Interaction Design and Extreme Programming</a></li>
<li><a href='http://stuq.nl/weblog/2008-06-20/create-restful-urls-with-wicket' rel='bookmark' title='Create RESTful URLs with Wicket'>Create RESTful URLs with Wicket</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://stuq.nl/weblog/2010-06-01/it%e2%80%99s-not-about-the-features/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Daily Scala</title>
		<link>http://stuq.nl/weblog/2009-12-19/daily-scala</link>
		<comments>http://stuq.nl/weblog/2009-12-19/daily-scala#comments</comments>
		<pubDate>Sat, 19 Dec 2009 22:07:27 +0000</pubDate>
		<dc:creator>Daan</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Scala]]></category>

		<guid isPermaLink="false">http://stuq.nl/weblog/2009-12-19/daily-scala</guid>
		<description><![CDATA[Jesse Eichar writes a daily blog about Scala.
"A short daily dose of Scala examples and occasionally explanations".

Everyday a nice read about Scala. I've added it to my newsreader and if you like Scala, you should do too!

http://daily-scala.blogspot.com/<p>Read the original at <a href="http://stuq.nl/weblog/2009-12-19/daily-scala">Daily Scala</a> or go to the homepage of <a href="http://stuq.nl">STUQ.nl</a></p>


<br/><br/>
Related posts:<ul><li><a href='http://stuq.nl/weblog/2009-02-04/6-scala-resources-for-java-programmers' rel='bookmark' title='6 Scala resources for Java programmers'>6 Scala resources for Java programmers</a></li>
<li><a href='http://stuq.nl/weblog/2008-11-24/scala-basics-what-is-scala' rel='bookmark' title='Scala basics: What is Scala?'>Scala basics: What is Scala?</a></li>
<li><a href='http://stuq.nl/weblog/2008-11-26/4-steps-to-add-scala-to-your-maven-java-projects' rel='bookmark' title='4 steps to add Scala to your Maven Java projects'>4 steps to add Scala to your Maven Java projects</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p style="clear: both;"><a class=\"image-link\" href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3N0dXEubmwvbWVkaWEvbmV3c2ZsYXNoX2xvZ28tZnVsbC5wbmc="><img class="linked-to-original" style="display: inline; margin-top: 0px; margin-right: 10px; margin-bottom: 10px; margin-left: 0px;" src="http://stuq.nl/media/newsflash_logo-thumb.png" alt="" width="190" height="54" align="left" /></a>Jesse Eichar writes a daily blog about Scala.<br />
&#8220;A short daily dose of Scala examples and occasionally explanations&#8221;.</p>
<p style="clear: both;">Everyday a nice read about Scala. I&#8217;ve added it to my newsreader and if you like Scala, you should do too!</p>
<p style="clear: both;"><a title=\"Daily Scala dose\" href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2RhaWx5LXNjYWxhLmJsb2dzcG90LmNvbS8=">http://daily-scala.blogspot.com/</a></p>
<p><br class="final-break" style="clear: both;" /></p>
<p>Read the original at <a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3N0dXEubmwvd2VibG9nLzIwMDktMTItMTkvZGFpbHktc2NhbGE=">Daily Scala</a> or go to the homepage of <a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3N0dXEubmw=">STUQ.nl</a></p>
 <img src="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=548" width="1" height="1" style="display: none;" /><div id="simple_socialmedia"><ul class="ssm_row"><li class="sharetext">Share:</li><li class="twitter"><a target="_blank" href="http://twitter.com/share?url=http://stuq.nl/weblog/2009-12-19/daily-scala&amp;text=Daily Scala&amp;via=daanvanetten">Tweet</a></li><li class="facebook"><a target="_blank" title="Share on Facebook" rel="nofollow" href="http://www.facebook.com/sharer.php?u=http://stuq.nl/weblog/2009-12-19/daily-scala&amp;t=Daily Scala">Facebook</a></li><li class="linkedin"><a target="_blank" title="Share on LinkedIn" rel="nofollow" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://stuq.nl/weblog/2009-12-19/daily-scala&amp;title=Daily Scala&amp;source=STUQ.nl">LinkedIn</a></li><li class="tumblr"><a target="_blank" title="Share on Tumblr" rel="nofollow" href="http://www.tumblr.com/share/link?url=http%3A%2F%2Fstuq.nl%2Fweblog%2F2009-12-19%2Fdaily-scala&name=STUQ.nl&description=Daily+Scala" title="Share on Tumblr">Tumblr</a></li><li class="stumble"><a target="_blank" title="Share on StumbleUpon" rel="nofollow" href="http://www.stumbleupon.com/submit?url=http://stuq.nl/weblog/2009-12-19/daily-scala">Stumble</a></li><li class="digg"><a target="_blank" title="Share on Digg" rel="nofollow" href="http://www.digg.com/submit?phase=2&amp;url=http://stuq.nl/weblog/2009-12-19/daily-scala">Digg</a></li><li class="delicious"><a target="_blank" title="Share on Delicious" rel="nofollow" href="http://del.icio.us/post?url=http://stuq.nl/weblog/2009-12-19/daily-scala&amp;title=INSERT_TITLE">Delicious</a></li></ul></div>

<br/><br/><p>Related posts:<ul><li><a href='http://stuq.nl/weblog/2009-02-04/6-scala-resources-for-java-programmers' rel='bookmark' title='6 Scala resources for Java programmers'>6 Scala resources for Java programmers</a></li>
<li><a href='http://stuq.nl/weblog/2008-11-24/scala-basics-what-is-scala' rel='bookmark' title='Scala basics: What is Scala?'>Scala basics: What is Scala?</a></li>
<li><a href='http://stuq.nl/weblog/2008-11-26/4-steps-to-add-scala-to-your-maven-java-projects' rel='bookmark' title='4 steps to add Scala to your Maven Java projects'>4 steps to add Scala to your Maven Java projects</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://stuq.nl/weblog/2009-12-19/daily-scala/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>London Wicket Meetup: Wicket 1.5, WiQuery, Brix and more..</title>
		<link>http://stuq.nl/weblog/2009-11-27/london-wicket-meetup-wicket-1-5-wiquery-brix-and-more</link>
		<comments>http://stuq.nl/weblog/2009-11-27/london-wicket-meetup-wicket-1-5-wiquery-brix-and-more#comments</comments>
		<pubDate>Thu, 26 Nov 2009 23:05:45 +0000</pubDate>
		<dc:creator>Daan</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Wicket]]></category>
		<category><![CDATA[London]]></category>
		<category><![CDATA[Meetup]]></category>

		<guid isPermaLink="false">http://stuq.nl/?p=507</guid>
		<description><![CDATA[On November 21st the London Wicket meetup took place in "The Gallery" at the central London Foyles Bookshop. At the venue some well-known Wicket-related speakers made their entrance and held talks about Brix, Wicket 1.5, WiQuery, and how having a baby compares to writing a book.<p>Read the original at <a href="http://stuq.nl/weblog/2009-11-27/london-wicket-meetup-wicket-1-5-wiquery-brix-and-more">London Wicket Meetup: Wicket 1.5, WiQuery, Brix and more..</a> or go to the homepage of <a href="http://stuq.nl">STUQ.nl</a></p>


<br/><br/>
Related posts:<ul><li><a href='http://stuq.nl/weblog/2009-11-01/automatically-test-your-wicket-panel-html-markup' rel='bookmark' title='Automatically test your Wicket panel HTML markup'>Automatically test your Wicket panel HTML markup</a></li>
<li><a href='http://stuq.nl/weblog/2008-12-02/847-is-a-resource-statistics-about-wicket' rel='bookmark' title='8.47% is a Resource: statistics about Wicket'>8.47% is a Resource: statistics about Wicket</a></li>
<li><a href='http://stuq.nl/weblog/2008-09-03/user-friendly-form-validation-with-wicket' rel='bookmark' title='User friendly form validation with Wicket'>User friendly form validation with Wicket</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p><img style="float: right; clear: both; margin-top: 10px; margin-left: 10px" class="alignright size-full wp-image-534" title="London Wicket Meetup" src="http://stuq.nl/media/london-wicket-meetup.png" alt="London Wicket Meetup" width="300" />On November 21st the London Wicket meetup took place in &#8220;The Gallery&#8221; at the central London Foyles Bookshop. At the venue some well-known Wicket-related speakers made their entrance and held talks about Brix, Wicket 1.5, WiQuery, and how having a baby compares to writing a book.</p>
<p>This is the summary of that afternoon. You should have been there&#8230;</p>
<p>Keep an eye <a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2p3ZWVrZW5kLmNvLnVrL2Rldi9MV1VHUmVnLw==" target=\"_blank\">on this page</a> for when the next London Wicket event is scheduled.</p>
<h3>Overview</h3>
<p>Click on an item to jump down (same page) to the notes from that presentation.</p>
<ul>
<li><a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=I2ludHJvZHVjdGlvbg==">Cemal Bayramoglu: Introduction</a></li>
<li><a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=I2plcmVteV90aG9tZXJzb24=">Jeremy Thomerson (USA): Custom JavaScript Integrations with Wicket + Auto Resolvers</a></li>
<li><a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=I2xpb25lbF9hcm1hbmV0">Lionel Armanet (FR): Announcing WiQuery 1.0: Introduction &amp; Demo</a></li>
<li><a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=I21hdGVqX2tub3Bw">Matej Knopp (SK): BRIX CMS + Wicket 1.5 Developments Q&amp;A</a></li>
<li><a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=I3N2ZW5fbWVpZXI=">Sven Meier (DE): Trees, Drag&amp;Drop and more:</a></li>
<li><a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=I21hcnRpam5fZGFzaG9yc3Q=">Martijn Dashorst (NL): Writing Books vs Making Babies</a></li>
<li><a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=I3FfYW5kX2E=">Wicket Q&amp;A</a></li>
</ul>
<p>(Unfortunately Alastair Maw couldn&#8217;t make it as he was sick. Hope you will soon be better!)</p>
<div id="attachment_512" class="wp-caption alignright" style="width: 160px"><a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3N0dXEubmwvbWVkaWEvY2VtYWxfYmF5cmFtb2dsdS5qcGc="><img class="size-thumbnail wp-image-512" title="Cemal Bayramoglu of jWeekend giving the introductory talk for the London Wicket meetup." src="http://stuq.nl/media/cemal_bayramoglu-150x150.jpg" alt="Cemal Bayramoglu of jWeekend giving the introductory talk for the London Wicket meetup." width="150" height="150" /></a><p class="wp-caption-text">Cemal giving the introductory talk</p></div>
<h3><a name="introduction"></a>Cemal Bayramoglu: Introduction</h3>
<p>As usual, the London Wicket Meetup is kindly hosted by Cemal Bayramoglu of <a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2p3ZWVrZW5kLmNvLnVrLw==">jWeekend</a>. Thanks Cemal!<br />
<br style="clear: both" /></p>
<div id="attachment_519" class="wp-caption alignright" style="width: 160px"><a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3N0dXEubmwvbWVkaWEvamVyZW15X3Rob21lcnNvbi5qcGc="><img class="size-thumbnail wp-image-519 " title="Jeremy Thomerson showing some code at the London Wicket meetup." src="http://stuq.nl/media/jeremy_thomerson-150x150.jpg" alt="Jeremy Thomerson showing some code at the London Wicket meetup." width="150" height="150" /></a><p class="wp-caption-text">Jeremy Thomerson showing some code</p></div>
<h3><a name="jeremy_thomerson"></a>Jeremy Thomerson (USA): Custom JavaScript Integrations with Wicket + Auto Resolvers</h3>
<p>Jeremy Thomerson started his talk with an example of how to do client side validation in Wicket. He showed abstract validation behaviors that validated form input with jQuery.</p>
<p>The remarkable thing was that by adding just one behavior to a component, validation was added for both the server side and the client side. This makes it very easy to keep client and server side validation in sync.</p>
<p>The Javascript behavior is added by letting the behavior implement iHeaderContributor and adding the script in the onRenderHead method call.</p>
<h4>Auto component resolution</h4>
<p>The next part of Jeremy&#8217;s presentation was about the AutoComponentResolver. The AutoComponentResolver makes it possible to wire components directly in HTML, without adding the component explicitly in Java. His demo showed how to use an AutoComponentResolver.</p>
<p>Matej Knopp commented that it is not really recommended to use automatic component resolving, because it has a limited use. The main purpose of auto component resolvers is for simple components that do not have a long lifetime on the page. For example the &lt;wicket:message&gt; tag is handled by automatic component resolving and is replaced by a Label with a ResourceModel. More complicated use cases are not supported nor recommended.</p>
<p>Components added via auto-resolving are not serialized or stored in the session and lose all state.</p>
<div id="attachment_521" class="wp-caption alignright" style="width: 160px"><a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3N0dXEubmwvbWVkaWEvbGlvbmVsX2FybWFuZXQuanBn"><img class="size-thumbnail wp-image-521" title="Lionel Armanet showing us the WiQuery goodness at the London Wicket meetup." src="http://stuq.nl/media/lionel_armanet-150x150.jpg" alt="Lionel Armanet showing us the WiQuery goodness at the London Wicket meetup." width="150" height="150" /></a><p class="wp-caption-text">Lionel Armanet showing us the WiQuery goodness he and his fellow Frenchmen created.</p></div>
<h3><a name="lionel_armanet"></a>Lionel Armanet (FR): Announcing WiQuery 1.0: Introduction &amp; Demo</h3>
<p>The presentation of Lionel Armanet was an impressive demo of what <a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2NvZGUuZ29vZ2xlLmNvbS9wL3dpcXVlcnk=">WiQuery</a> is capable of. WiQuery integrates jQuery with Wicket, with clever tricks that ease development. WickeXt was merged with jQuery4Wicket and changed its name to WiQuery. Last week was the 1.0 release, and the library is available under the MIT license.</p>
<p>The rationale behind WiQuery is that to build rich internet applications, you need rich behaviors and components. jQuery is simple, unobtrusive and powerful, there are tons of plugins and jQuery UI has fancy components. So, let&#8217;s get jQuery, integrate it with Wicket and have the best of both worlds!</p>
<p>WiQuery has standard components and behaviors like the resize behavior, drag and drop behavior, datepicker component, etcetera. By simply adding Java components, WiQuery generates the Javascript for you and imports the required libraries.</p>
<h4>Setting up WiQuery</h4>
<p>There are two ways to setup wiquery:</p>
<p>With a WiQueryCoreInstantiationListener:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">addComponentInstantiationListener<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> WiQueryInstantiationListener<span style="color: #009900;">&#41;</span></pre></div></div>

<p>Or by extending the Abstract class WiQueryWebApplication.</p>
<h4>Demo</h4>
<p>After the theory, Lionel showed an impressive demo with a drag-and-drop Scrum taskboard. The task board had three columns (new, in progress, done), from which task items could be dragged and dropped around. Double clicking an item showes the details for that task.</p>
<p>The double click action is easily added with:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">add<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> WiQueryAjaxEventBehavior<span style="color: #009900;">&#40;</span><span style="color: #003399;">MouseEvent</span>.<span style="color: #006633;">DBLCLICK</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
   ....
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>With the IThemableApplication interface you can make your application themable, like the themes that jQuery UI has.</p>
<div id="attachment_531" class="wp-caption alignright" style="width: 160px"><a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3N0dXEubmwvbWVkaWEvbWF0ZWpfa25vcHAuanBn"><img class="size-thumbnail wp-image-531" title="Matej Knopp talked about Brix and Wicket 1.5 on the London Wicket meetup" src="http://stuq.nl/media/matej_knopp-150x150.jpg" alt="Matej Knopp talked about Brix and Wicket 1.5 on the London Wicket meetup" width="150" height="150" /></a><p class="wp-caption-text">Matej Knopp talked about Brix and Wicket 1.5.</p></div>
<h3><a name="matej_knopp"></a>Matej Knopp (SK): BRIX CMS + Wicket 1.5 Developments Q&amp;A</h3>
<p>Matej Knopp showed what the content management system <a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2NvZGUuZ29vZ2xlLmNvbS9wL2JyaXgtY21zLw==">Brix</a> is all about. Brix is based on Wicket and is a component based content management system based on JCR for storage.</p>
<p>Brix is meant for integration with Wicket web applications and looks very interesting. The basic building blocks in Brix are Tiles, Pages, and Templates.</p>
<p>In Brix, Tiles are like a factory for embedding Wicket components. So any Wicket component can be added to a Page which is nearly impossible in &#8216;regular&#8217; CMS systems. More information about Brix can be found on <a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2NvZGUuZ29vZ2xlLmNvbS9wL2JyaXgtY21zLw==">the Brix website.</a></p>
<h4>Wicket 1.5</h4>
<p>Matej also talked about some new developments that can possibly be shipped in Wicket 1.5:</p>
<ul>
<li>New RequestCycle</li>
<li>New RequestMapper</li>
<li>New Ajax implementation</li>
</ul>
<p><strong>New RequestCycle and RequestMapper</strong></p>
<p><strong><span style="font-weight: normal;">One of the areas where improvements can be made is the RequestCycle. The RequestCycle in Wicket 1.4.x is big and complicated, and hard to step through while debugging. Matej worked on an improved RequestCycle.</span></strong></p>
<p>Matej talked about the drawbacks of the Wicket 1.4 code for handling requests and mapping requests to URL&#8217;s:</p>
<ul>
<li>Complicated, huge code base</li>
<li>Many abstractions, most of them on wrong level</li>
<li>Complicated class hierarchy, hard to find proper extension point</li>
</ul>
<p>He proposed a new RequestMapper that handles Request mapping in a different way.</p>
<p><strong>RequestMapper Interface</strong></p>
<p>The RequestMapper will get the following interface.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">interface</span> RequestMapper <span style="color: #009900;">&#123;</span>
<span style="color: #000066; font-weight: bold;">int</span> getCompatibilityScore<span style="color: #009900;">&#40;</span><span style="color: #003399;">Request</span> request<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
RequestHandler mapRequest<span style="color: #009900;">&#40;</span><span style="color: #003399;">Request</span> request<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
Url mapHandler<span style="color: #009900;">&#40;</span>RequestHandler requestHandler<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>With the RequestMapper interface you can implement your own Request Mapping behavior for various URL&#8217;s.<br />
There can be a hierarchy of RequestMappers. When there is more than one RequestMapper, the compatibility score can be used to choose which RequestMapper will be used.</p>
<p><strong>Calculating RequestMapper compatibility score</strong></p>
<p>The compatibility score is calculated by counting how many URL segments match the mount point.<br />
For example, having an application where two RequestMappers are defined with these URLs:</p>
<ol>
<li>/mounted/page</li>
<li>/mounted/page/that/is/different</li>
</ol>
<p>When there is a new Request on &#8220;/mounted/page/that/is/&#8221;, the second RequestMapper gets a higher compatibility score (4) than the RequestMapper matching only the first two parts of the URL (&#8220;/mounted/page/&#8221;).</p>
<p><strong>New AJAX implementation</strong></p>
<p>About a year ago, Matej created a new Ajax implementation for Wicket. The new Ajax implementation is way better than what is now in Wicket 1.4. It is faster, simpler to use and will be based on a standard library. There is only one problem, the new Ajax implementation Matej built uses YUI. It seems that the world prefers jQuery over YUI. Matej told that rewriting it to jQuery will be a lot of work.</p>
<p>The focus of the new Ajax implementation is removing browser inconsistency code. The custom-written Wicket Javascript will be swapped for more standard Javascript (like the YUI or jQuery libraries).</p>
<p>The API for working with Javascript will be different and much cleaner according to Matej. Also, the generated Javascript is nicer: code is not put directly in the onclick of a UI control, but separately. This looks like how WiQuery does stuff. This means that the Javascript handlers are much shorter, so the page loads faster.</p>
<p>There is an experimental branch in source control, so if you want to try it out or convert it to jQuery, you are welcome to check it out.</p>
<p><strong>Problems with implementation Wicket 1.5</strong></p>
<p>There are some challenges with the implementation of Wicket 1.5. Matej touched a few and gave some insight in what needs to be done. The big question is: how to build this without breaking anything? How can we undo the universe?</p>
<p>One point was the use of global state during the 1.4 Wicket RequestCycle. This makes it difficult to implement the new RequestCycle in core, because much code and unit tests rely on this global state.</p>
<p>Another challenge is keeping the WicketTester in a workable state. The new RequestCycle breaks WicketTester, which is problematic because many people are using WicketTester. Fixing WicketTester is not really easy, because it is a big class with much functionality. It can simulate a lot of actions, like file upload and form submission.</p>
<div id="attachment_527" class="wp-caption alignright" style="width: 160px"><a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3N0dXEubmwvbWVkaWEvc3Zlbl9tZWllci5qcGc="><img class="size-thumbnail wp-image-527" title="Sven Meier encouraged us to not refrain from writing custom Javascript on the London Wicket meetup" src="http://stuq.nl/media/sven_meier-150x150.jpg" alt="Sven Meier encouraged us to not refrain from writing custom Javascript on the London Wicket meetup" width="150" height="150" /></a><p class="wp-caption-text">Sven Meier encouraged us to not refrain from writing custom Javascript.</p></div>
<h3><a name="sven_meier"></a>Sven Meier (DE):</h3>
<p>Sven Meier showed us his implementation of a <a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2NvZGUuZ29vZ2xlLmNvbS9wL3dpY2tldC10cmVlLw==">TreeModel</a>. He argued that Swing&#8217;s TreeModel is not suitable for implementing a tree in Wicket: &#8220;The treemodel is ugly, and there are many methods you don&#8217;t need in Wicket.&#8221;</p>
<p>His implementation allows hierarchical markup in the tree. This makes it easier to use and extend. It uses simple and known patterns. Partial update is not there yet.</p>
<p>Google Code hosts the <a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2NvZGUuZ29vZ2xlLmNvbS9wL3dpY2tldC10cmVlLw==">Wicket Tree project</a>.</p>
<p><strong>Drag and drop</strong></p>
<p>Sven also created Wicket drag and drop functionality, which is also <a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2NvZGUuZ29vZ2xlLmNvbS9wL3dpY2tldC1kbmQv">hosted at Google Code</a>.</p>
<p>This project enables you to drag and drop between any Wicket component. It supports common desktop metaphors with &#8216;MOVE&#8217;, &#8216;COPY&#8217; and &#8216;LINK&#8217; operations and is fully themable.</p>
<p>Sven&#8217;s closing remarks were: &#8220;Don&#8217;t fret from developing custom Javascript. It&#8217;s really easy with Wicket!&#8221;</p>
<div id="attachment_524" class="wp-caption alignright" style="width: 160px"><a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3N0dXEubmwvbWVkaWEvbWFydGlqbl9kYXNob3JzdC5qcGc="><img class="size-thumbnail wp-image-524" title="Martijn Dashorst compared having a baby to writing a book on the London Wicket meetup" src="http://stuq.nl/media/martijn_dashorst-150x150.jpg" alt="Martijn Dashorst compared having a baby to writing a book on the London Wicket meetup" width="150" height="150" /></a><p class="wp-caption-text">Martijn Dashorst compared having a baby to writing a book.</p></div>
<h3><a name="martijn_dashorst"></a>Martijn Dashorst (NL):</h3>
<p>Martijn&#8217;s presentation was titled &#8220;Writing Books vs Making Babies&#8221; and was a hilarious story with good slides. We have been informed of all the gory details of writing a book (finding the publisher, writing, editing, checking, etcetera) and learned something about having a baby as well!</p>
<h3><a name="q_and_a"></a>Wicket Q&amp;A</h3>
<p>There were not many questions about Wicket, which is proof for the developer friendliness of Wicket <img src='http://stuq.nl/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<h3>Were you there?</h3>
<p>If you were at the London Wicket meetup (presenter or attendee) or plan to go there next time, please comment below!</p>
<p>If you send me links to the presentations, I will add them to the article.</p>
<p>Read the original at <a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3N0dXEubmwvd2VibG9nLzIwMDktMTEtMjcvbG9uZG9uLXdpY2tldC1tZWV0dXAtd2lja2V0LTEtNS13aXF1ZXJ5LWJyaXgtYW5kLW1vcmU=">London Wicket Meetup: Wicket 1.5, WiQuery, Brix and more..</a> or go to the homepage of <a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3N0dXEubmw=">STUQ.nl</a></p>
 <img src="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=507" width="1" height="1" style="display: none;" /><div id="simple_socialmedia"><ul class="ssm_row"><li class="sharetext">Share:</li><li class="twitter"><a target="_blank" href="http://twitter.com/share?url=http://stuq.nl/weblog/2009-11-27/london-wicket-meetup-wicket-1-5-wiquery-brix-and-more&amp;text=London Wicket Meetup: Wicket 1.5, WiQuery, Brix and more..&amp;via=daanvanetten">Tweet</a></li><li class="facebook"><a target="_blank" title="Share on Facebook" rel="nofollow" href="http://www.facebook.com/sharer.php?u=http://stuq.nl/weblog/2009-11-27/london-wicket-meetup-wicket-1-5-wiquery-brix-and-more&amp;t=London Wicket Meetup: Wicket 1.5, WiQuery, Brix and more..">Facebook</a></li><li class="linkedin"><a target="_blank" title="Share on LinkedIn" rel="nofollow" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://stuq.nl/weblog/2009-11-27/london-wicket-meetup-wicket-1-5-wiquery-brix-and-more&amp;title=London Wicket Meetup: Wicket 1.5, WiQuery, Brix and more..&amp;source=STUQ.nl">LinkedIn</a></li><li class="tumblr"><a target="_blank" title="Share on Tumblr" rel="nofollow" href="http://www.tumblr.com/share/link?url=http%3A%2F%2Fstuq.nl%2Fweblog%2F2009-11-27%2Flondon-wicket-meetup-wicket-1-5-wiquery-brix-and-more&name=STUQ.nl&description=London+Wicket+Meetup%3A+Wicket+1.5%2C+WiQuery%2C+Brix+and+more.." title="Share on Tumblr">Tumblr</a></li><li class="stumble"><a target="_blank" title="Share on StumbleUpon" rel="nofollow" href="http://www.stumbleupon.com/submit?url=http://stuq.nl/weblog/2009-11-27/london-wicket-meetup-wicket-1-5-wiquery-brix-and-more">Stumble</a></li><li class="digg"><a target="_blank" title="Share on Digg" rel="nofollow" href="http://www.digg.com/submit?phase=2&amp;url=http://stuq.nl/weblog/2009-11-27/london-wicket-meetup-wicket-1-5-wiquery-brix-and-more">Digg</a></li><li class="delicious"><a target="_blank" title="Share on Delicious" rel="nofollow" href="http://del.icio.us/post?url=http://stuq.nl/weblog/2009-11-27/london-wicket-meetup-wicket-1-5-wiquery-brix-and-more&amp;title=INSERT_TITLE">Delicious</a></li></ul></div>

<br/><br/><p>Related posts:<ul><li><a href='http://stuq.nl/weblog/2009-11-01/automatically-test-your-wicket-panel-html-markup' rel='bookmark' title='Automatically test your Wicket panel HTML markup'>Automatically test your Wicket panel HTML markup</a></li>
<li><a href='http://stuq.nl/weblog/2008-12-02/847-is-a-resource-statistics-about-wicket' rel='bookmark' title='8.47% is a Resource: statistics about Wicket'>8.47% is a Resource: statistics about Wicket</a></li>
<li><a href='http://stuq.nl/weblog/2008-09-03/user-friendly-form-validation-with-wicket' rel='bookmark' title='User friendly form validation with Wicket'>User friendly form validation with Wicket</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://stuq.nl/weblog/2009-11-27/london-wicket-meetup-wicket-1-5-wiquery-brix-and-more/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Automatically test your Wicket panel HTML markup</title>
		<link>http://stuq.nl/weblog/2009-11-01/automatically-test-your-wicket-panel-html-markup</link>
		<comments>http://stuq.nl/weblog/2009-11-01/automatically-test-your-wicket-panel-html-markup#comments</comments>
		<pubDate>Sun, 01 Nov 2009 20:03:04 +0000</pubDate>
		<dc:creator>Daan</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Productivity]]></category>
		<category><![CDATA[Scala]]></category>
		<category><![CDATA[Wicket Tutorials]]></category>
		<category><![CDATA[JUnit]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[Unit testing]]></category>
		<category><![CDATA[Wicket]]></category>

		<guid isPermaLink="false">http://stuq.nl/?p=471</guid>
		<description><![CDATA[Are you testing your HTML markup automatically yet? If your markup does not match the Java code, your Wicket panel does not work. It’s easy to get early feedback when your panels are broken: just unit test them!

In this blog post I describe a way of automatically verifying that the HTML markup of Wicket panels match the Java code. <strong>Scroll down to download the demo project!</strong><p>Read the original at <a href="http://stuq.nl/weblog/2009-11-01/automatically-test-your-wicket-panel-html-markup">Automatically test your Wicket panel HTML markup</a> or go to the homepage of <a href="http://stuq.nl">STUQ.nl</a></p>


<br/><br/>
Related posts:<ul><li><a href='http://stuq.nl/weblog/2008-06-05/wicket-how-to-write-a-reusable-modal-window-popup' rel='bookmark' title='Wicket: how to write a reusable modal window popup'>Wicket: how to write a reusable modal window popup</a></li>
<li><a href='http://stuq.nl/weblog/2008-06-20/create-restful-urls-with-wicket' rel='bookmark' title='Create RESTful URLs with Wicket'>Create RESTful URLs with Wicket</a></li>
<li><a href='http://stuq.nl/weblog/2008-09-03/user-friendly-form-validation-with-wicket' rel='bookmark' title='User friendly form validation with Wicket'>User friendly form validation with Wicket</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>Are you testing your HTML markup automatically yet? If your markup does not match the Java code, your Wicket panel does not work. It’s easy to get early feedback when your panels are broken: just unit test them!</p>
<p>In this blog post I describe a way of automatically verifying that the HTML markup of Wicket panels match the Java code. <strong>Scroll down to download the demo project!</strong></p>
<h3>Unit test</h3>
<p><img style="float: right; clear: right; padding: 5px;" title="Unit testing Wicket panels with Eclipse" src="http://stuq.nl/media/eclipse-unit-testing.png" alt="Unit testing Wicket panels with Eclipse" />I created a JUnit test that you can add to your project to <strong>automatically test as much Wicket Panels</strong> as possible. Automatic testing works by resolving all panels on the Java class path and feeding them to the WicketTester. When a panel has invalid markup, the WicketTester will give an error: early feedback!</p>
<h3>How does it work?</h3>
<p>The Wicket panels that can automatically be tested should have a ‘default’ Wicket constructor, like this:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> DemoPanel<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> id<span style="color: #009900;">&#41;</span></pre></div></div>

<p>Resolving all panels is done with Spring 2.5’s <a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3N0YXRpYy5zcHJpbmdzb3VyY2Uub3JnL3NwcmluZy9kb2NzLzIuNS54L2FwaS9vcmcvc3ByaW5nZnJhbWV3b3JrL2NvbnRleHQvYW5ub3RhdGlvbi9DbGFzc1BhdGhTY2FubmluZ0NhbmRpZGF0ZUNvbXBvbmVudFByb3ZpZGVyLmh0bWw=" target=\"_blank\">ClassPathScanningCandidateComponentProvider</a> (don’t you love those names! How can they stay below 120 characters per line?)</p>
<p>The <strong>ClassPathScanningCandidateComponentProvider</strong> is a component provider that scans the classpath from a base package. It then applies exclude and include filters to the resulting classes to find candidates.</p>
<h3>Testing panels</h3>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">@Test
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> testAllWicketPanels<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Exception</span> <span style="color: #009900;">&#123;</span>
        WicketTester wicketTester <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> WicketTester<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> WicketApplication<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    	ClassPathScanningCandidateComponentProvider provider <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ClassPathScanningCandidateComponentProvider<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        provider.<span style="color: #006633;">addIncludeFilter</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> AssignableTypeFilter<span style="color: #009900;">&#40;</span><span style="color: #003399;">Panel</span>.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #003399;">Set</span> components <span style="color: #339933;">=</span> provider.<span style="color: #006633;">findCandidateComponents</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;nl/stuq/demo&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>BeanDefinition component <span style="color: #339933;">:</span> components<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">Class</span> clazz <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">Class</span>.<span style="color: #006633;">forName</span><span style="color: #009900;">&#40;</span>component.<span style="color: #006633;">getBeanClassName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>hasDefaultConstructor<span style="color: #009900;">&#40;</span>clazz<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            	testWicketPanel<span style="color: #009900;">&#40;</span>wicketTester, clazz<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> testWicketPanel<span style="color: #009900;">&#40;</span>WicketTester wicketTester, <span style="color: #000000; font-weight: bold;">Class</span> clazz<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    	wicketTester.<span style="color: #006633;">startPanel</span><span style="color: #009900;">&#40;</span>clazz<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    	wicketTester.<span style="color: #006633;">assertNoErrorMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    	wicketTester.<span style="color: #006633;">assertNoInfoMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">boolean</span> hasDefaultConstructor<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">Class</span> clazz<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Constructor</span> constructor <span style="color: #339933;">:</span> clazz.<span style="color: #006633;">getConstructors</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>constructor.<span style="color: #006633;">getParameterTypes</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">length</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span>
               constructor.<span style="color: #006633;">getParameterTypes</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #006633;">getSimpleName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;String&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

<p>The test instantiates a new WicketTester. After that, the <strong>ClassPathScanningCandidateComponentProvider</strong> is created and configured to scan only for Panel classes in the <tt>nl.stuq.demo</tt> package and below.<br />
After that, the found components are all checked. If they have a default constructor, the test is executed.</p>
<p>The <strong>boolean hasDefaultConstructor(clazz)</strong> method checks if the class has a constructor with only one String argument, the Wicket id.</p>
<h3>Keep in mind</h3>
<ul>
<li>This is only for lazy people (good developers are lazy in some ways).</li>
<li>You need a dependency to Spring.</li>
<li>Only Panels with a certain constructor are tested.</li>
<li>Only instantiating the Panel is tested, so code coverage has no meaning for this test. <strong>Real testing is still needed.</strong></li>
</ul>
<h3>Download demo project</h3>
<p>The demo project is a Maven project based on the Wicket 1.4.3 quickstart that contains the test class and an example panel to be tested.<br />
<strong><a onclick=\"javascript: pageTracker._trackPageview('/downloads/media/code/demo-automatic-panel-testing.zip');\" href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=L21lZGlhL2NvZGUvZGVtby1hdXRvbWF0aWMtcGFuZWwtdGVzdGluZy56aXA=">Download demo project</a></strong>.</p>
<p>Extract the zip file and run <strong>mvn test</strong> to run the tests. Then fire up your IDE and check how it&#8217;s done.</p>
<p>You can change or adapt the given JUnit test to also automatically test classes extending from Page or Component.</p>
<p>Join in with your opinions and code! I’m curious to see what clever way you have of testing code.</p>
<p>Read the original at <a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3N0dXEubmwvd2VibG9nLzIwMDktMTEtMDEvYXV0b21hdGljYWxseS10ZXN0LXlvdXItd2lja2V0LXBhbmVsLWh0bWwtbWFya3Vw">Automatically test your Wicket panel HTML markup</a> or go to the homepage of <a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3N0dXEubmw=">STUQ.nl</a></p>
 <img src="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=471" width="1" height="1" style="display: none;" /><div id="simple_socialmedia"><ul class="ssm_row"><li class="sharetext">Share:</li><li class="twitter"><a target="_blank" href="http://twitter.com/share?url=http://stuq.nl/weblog/2009-11-01/automatically-test-your-wicket-panel-html-markup&amp;text=Automatically test your Wicket panel HTML markup&amp;via=daanvanetten">Tweet</a></li><li class="facebook"><a target="_blank" title="Share on Facebook" rel="nofollow" href="http://www.facebook.com/sharer.php?u=http://stuq.nl/weblog/2009-11-01/automatically-test-your-wicket-panel-html-markup&amp;t=Automatically test your Wicket panel HTML markup">Facebook</a></li><li class="linkedin"><a target="_blank" title="Share on LinkedIn" rel="nofollow" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://stuq.nl/weblog/2009-11-01/automatically-test-your-wicket-panel-html-markup&amp;title=Automatically test your Wicket panel HTML markup&amp;source=STUQ.nl">LinkedIn</a></li><li class="tumblr"><a target="_blank" title="Share on Tumblr" rel="nofollow" href="http://www.tumblr.com/share/link?url=http%3A%2F%2Fstuq.nl%2Fweblog%2F2009-11-01%2Fautomatically-test-your-wicket-panel-html-markup&name=STUQ.nl&description=Automatically+test+your+Wicket+panel+HTML+markup" title="Share on Tumblr">Tumblr</a></li><li class="stumble"><a target="_blank" title="Share on StumbleUpon" rel="nofollow" href="http://www.stumbleupon.com/submit?url=http://stuq.nl/weblog/2009-11-01/automatically-test-your-wicket-panel-html-markup">Stumble</a></li><li class="digg"><a target="_blank" title="Share on Digg" rel="nofollow" href="http://www.digg.com/submit?phase=2&amp;url=http://stuq.nl/weblog/2009-11-01/automatically-test-your-wicket-panel-html-markup">Digg</a></li><li class="delicious"><a target="_blank" title="Share on Delicious" rel="nofollow" href="http://del.icio.us/post?url=http://stuq.nl/weblog/2009-11-01/automatically-test-your-wicket-panel-html-markup&amp;title=INSERT_TITLE">Delicious</a></li></ul></div>

<br/><br/><p>Related posts:<ul><li><a href='http://stuq.nl/weblog/2008-06-05/wicket-how-to-write-a-reusable-modal-window-popup' rel='bookmark' title='Wicket: how to write a reusable modal window popup'>Wicket: how to write a reusable modal window popup</a></li>
<li><a href='http://stuq.nl/weblog/2008-06-20/create-restful-urls-with-wicket' rel='bookmark' title='Create RESTful URLs with Wicket'>Create RESTful URLs with Wicket</a></li>
<li><a href='http://stuq.nl/weblog/2008-09-03/user-friendly-form-validation-with-wicket' rel='bookmark' title='User friendly form validation with Wicket'>User friendly form validation with Wicket</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://stuq.nl/weblog/2009-11-01/automatically-test-your-wicket-panel-html-markup/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>User friendly form validation with Wicket</title>
		<link>http://stuq.nl/weblog/2008-09-03/user-friendly-form-validation-with-wicket</link>
		<comments>http://stuq.nl/weblog/2008-09-03/user-friendly-form-validation-with-wicket#comments</comments>
		<pubDate>Wed, 03 Sep 2008 21:12:21 +0000</pubDate>
		<dc:creator>Daan</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Productivity]]></category>
		<category><![CDATA[Scala]]></category>
		<category><![CDATA[Wicket Tutorials]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[<p>By default Wicket shows error messages together in a single place in the HTML form. This has some drawbacks to usability, especially if you have long forms with lots of fields. Read further for a tutorial exploring possibilities to improve the location of the error on the page, thereby improving usability.</p>
<p>Read the original at <a href="http://stuq.nl/weblog/2008-09-03/user-friendly-form-validation-with-wicket">User friendly form validation with Wicket</a> or go to the homepage of <a href="http://stuq.nl">STUQ.nl</a></p>


<br/><br/>
Related posts:<ul><li><a href='http://stuq.nl/weblog/2008-06-05/wicket-how-to-write-a-reusable-modal-window-popup' rel='bookmark' title='Wicket: how to write a reusable modal window popup'>Wicket: how to write a reusable modal window popup</a></li>
<li><a href='http://stuq.nl/weblog/2009-11-01/automatically-test-your-wicket-panel-html-markup' rel='bookmark' title='Automatically test your Wicket panel HTML markup'>Automatically test your Wicket panel HTML markup</a></li>
<li><a href='http://stuq.nl/weblog/2008-06-20/create-restful-urls-with-wicket' rel='bookmark' title='Create RESTful URLs with Wicket'>Create RESTful URLs with Wicket</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>By default Wicket shows error messages together in a single place in the HTML form. This has some drawbacks to usability, especially if you have long forms with lots of fields. Read further for a tutorial exploring possibilities to improve the location of the error on the page, thereby improving usability.</p>
<p>The default FeedbackPanel shows all errors in one place. When you enter a wrong value in an input field below the fold, the input field is a mile away from the error above the form. This makes it unclear which error message corresponds to which field.</p>
<p><img style="float: left;" src="http://stuq.nl/media/image/form-usability-scanning.png" border="0" alt="form-usability-scanning.png" height="242" /></p>
<p>The image on the left shows that a lot of page scanning is needed even with moderate sized forms.</p>
<p>With more than a few fields, the user is confused as which error corresponds to which field. It is a big problem when your e-commerce site scares away many potential clients who can&#8217;t complete your web forms!</p>
<h3 style="clear: both;">The default form</h3>
<p>Before I describe how to create a more user friendly form, first the &#8216;default&#8217; form. The following is an example of a standard Wicket form. This kind of form is the one you get without doing any &#8216;special&#8217; magic things. <strong>Place your mouse cursor over the image to see the default error messages above the form.</strong></p>
<p><img onmouseover="this.src='http://stuq.nl/media/image/form-usability-default-invalid.png'" onmouseout="this.src='http://stuq.nl/media/image/form-usability-default-valid.png'" src="http://stuq.nl/media/image/form-usability-default-valid.png" border="0" alt="Default Wicket form with FeedbackPanel at the top" height="150" /></p>
<p style="clear: both;">This form will be the starting point for our improvements.</p>
<h3>The improved form</h3>
<p>This is what we are going to make:</p>
<p><img src="http://stuq.nl/media/image/form-usability-tutorial-invalid.png" border="0" alt="Better and improved Wicket form with FeedbackLabels throughout" height="100" /></p>
<p style="clear: both;">As you can see, the error messages are directly next to the component that caused the error. This reduces the scanning of the page to link the error message to the right form component.</p>
<h3>Step 1: Introducing the FeedbackLabel</h3>
<p>The FeedbackLabel is a custom component I&#8217;ve written for this tutorial. With this custom label, you can show important feedback messages related to a FormComponent.</p>
<p>This has the advantage that you can place your Feedback messages in any place you want.</p>
<p>Add this to the Java part of the form:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// This shows feedback when the name input is not correct.</span>
FeedbackLabel nameFeedbackLabel <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> FeedbackLabel<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;name.feedback&quot;</span>, name<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
form.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>nameFeedbackLabel<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
FeedbackLabel colorFeedbackLabel <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> FeedbackLabel<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;color.feedback&quot;</span>, color, customText<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
form.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>colorFeedbackLabel<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Add another SPAN tag for every feedback label. You can place this near the relevant form component within the form.</p>
<h3>Step 2: Removing the FeedbackPanel completely? No, filtering!</h3>
<p>At first, it looks like you can remove the FeedbackPanel completely. But, then you will not be able to use the info() method to display text inside the FeedbackPanel! Therefore we need a way to filter the FeedbackMessages so error messages are not shown. I have written a FeedbackMessageFilter to accomplish that. It filters out the unwanted error messages.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// filteredErrorLevels will not be shown in the FeedbackPanel</span>
<span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> filteredErrorLevels <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#123;</span>FeedbackMessage.<span style="color: #006633;">ERROR</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
feedback.<span style="color: #006633;">setFilter</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> ErrorLevelsFeedbackMessageFilter<span style="color: #009900;">&#40;</span>filteredErrorLevels<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>I have included the ErrorLevelsFeedbackMessageFilter in the project files, so you can reuse this in your existing projects. Remember if you use the error() method, you cannot use this filter! Instead, create your own filter that filters based on components.</p>
<h3>Step 3: Adding some style, the ComponentVisualErrorBehavior™</h3>
<p>I always love extremely long class names, like the <em>BookmarkablePageRequestTargetUrlCodingStrategy</em> or the <em>SharedResourceRequestTargetUrlCodingStrategy</em>. It makes my day to introduce a class name consisting of four words, the <strong>ComponentVisualErrorBehavior™</strong>.</p>
<p>This behavior changes the CSS styles for components that are invalid according to the Wicket form validation. You see in the screenshot that the textfield has a red line around it. This is the result of the ComponentVisualErrorBehavior. You can easily change the styles that are applied.</p>
<p><img src="http://stuq.nl/media/image/form-usability-tutorial-namefield.png" border="0" alt="form-usability-tutorial-namefield.png" width="358" height="48" /></p>
<p>To add the ComponentVisualErrorBehavior to your component, just add one line in your Java code:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">name.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> ComponentVisualErrorBehavior<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;onblur&quot;</span>, nameFeedbackLabel<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>&#8220;onblur&#8221; stands for the event that triggers this Behavior. The nameFeedbackLabel will also be updated when this is triggered, so that it will show the relevant error (or nothing if the input is valid).</p>
<h3>Download</h3>
<p><a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3N0dXEubmwvbWVkaWEvY29kZS9kZW1vLWZvcm1zLnppcA==">Download the complete example project</a> and start experimenting! (run with mvn jetty:run and connect to http://localhost:8080/demo)</p>
<p>Let me know how and where you use it in the comments!</p>
<p>Read the original at <a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3N0dXEubmwvd2VibG9nLzIwMDgtMDktMDMvdXNlci1mcmllbmRseS1mb3JtLXZhbGlkYXRpb24td2l0aC13aWNrZXQ=">User friendly form validation with Wicket</a> or go to the homepage of <a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3N0dXEubmw=">STUQ.nl</a></p>
 <img src="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=77" width="1" height="1" style="display: none;" /><div id="simple_socialmedia"><ul class="ssm_row"><li class="sharetext">Share:</li><li class="twitter"><a target="_blank" href="http://twitter.com/share?url=http://stuq.nl/weblog/2008-09-03/user-friendly-form-validation-with-wicket&amp;text=User friendly form validation with Wicket&amp;via=daanvanetten">Tweet</a></li><li class="facebook"><a target="_blank" title="Share on Facebook" rel="nofollow" href="http://www.facebook.com/sharer.php?u=http://stuq.nl/weblog/2008-09-03/user-friendly-form-validation-with-wicket&amp;t=User friendly form validation with Wicket">Facebook</a></li><li class="linkedin"><a target="_blank" title="Share on LinkedIn" rel="nofollow" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://stuq.nl/weblog/2008-09-03/user-friendly-form-validation-with-wicket&amp;title=User friendly form validation with Wicket&amp;source=STUQ.nl">LinkedIn</a></li><li class="tumblr"><a target="_blank" title="Share on Tumblr" rel="nofollow" href="http://www.tumblr.com/share/link?url=http%3A%2F%2Fstuq.nl%2Fweblog%2F2008-09-03%2Fuser-friendly-form-validation-with-wicket&name=STUQ.nl&description=User+friendly+form+validation+with+Wicket" title="Share on Tumblr">Tumblr</a></li><li class="stumble"><a target="_blank" title="Share on StumbleUpon" rel="nofollow" href="http://www.stumbleupon.com/submit?url=http://stuq.nl/weblog/2008-09-03/user-friendly-form-validation-with-wicket">Stumble</a></li><li class="digg"><a target="_blank" title="Share on Digg" rel="nofollow" href="http://www.digg.com/submit?phase=2&amp;url=http://stuq.nl/weblog/2008-09-03/user-friendly-form-validation-with-wicket">Digg</a></li><li class="delicious"><a target="_blank" title="Share on Delicious" rel="nofollow" href="http://del.icio.us/post?url=http://stuq.nl/weblog/2008-09-03/user-friendly-form-validation-with-wicket&amp;title=INSERT_TITLE">Delicious</a></li></ul></div>

<br/><br/><p>Related posts:<ul><li><a href='http://stuq.nl/weblog/2008-06-05/wicket-how-to-write-a-reusable-modal-window-popup' rel='bookmark' title='Wicket: how to write a reusable modal window popup'>Wicket: how to write a reusable modal window popup</a></li>
<li><a href='http://stuq.nl/weblog/2009-11-01/automatically-test-your-wicket-panel-html-markup' rel='bookmark' title='Automatically test your Wicket panel HTML markup'>Automatically test your Wicket panel HTML markup</a></li>
<li><a href='http://stuq.nl/weblog/2008-06-20/create-restful-urls-with-wicket' rel='bookmark' title='Create RESTful URLs with Wicket'>Create RESTful URLs with Wicket</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://stuq.nl/weblog/2008-09-03/user-friendly-form-validation-with-wicket/feed</wfw:commentRss>
		<slash:comments>45</slash:comments>
		</item>
		<item>
		<title>Create RESTful URLs with Wicket</title>
		<link>http://stuq.nl/weblog/2008-06-20/create-restful-urls-with-wicket</link>
		<comments>http://stuq.nl/weblog/2008-06-20/create-restful-urls-with-wicket#comments</comments>
		<pubDate>Fri, 20 Jun 2008 22:32:12 +0000</pubDate>
		<dc:creator>Daan</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Productivity]]></category>
		<category><![CDATA[Scala]]></category>
		<category><![CDATA[Wicket Tutorials]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[<img style="float: right;" src="http://stuq.nl/media/image/wicket_logo.png" /><p>This is a tutorial on using Wicket with REST-style URLs. Normally, Wicket generates URLs that are a bit ugly. <br/>For example:<br/>
<i>http://www.example.com/wui/?wicket:bookmarkablePage=%3Anl.stuq.demo.SomePage</i>. </p><p>Uch!</p><p>RESTful URLs change that: they are more meaningful for the user, hide some of your implementation details, and are just beautiful. Plus, you're joining one of the latest hypes. Life couldn't be better...</p>
<p>Read the original at <a href="http://stuq.nl/weblog/2008-06-20/create-restful-urls-with-wicket">Create RESTful URLs with Wicket</a> or go to the homepage of <a href="http://stuq.nl">STUQ.nl</a></p>


<br/><br/>
Related posts:<ul><li><a href='http://stuq.nl/weblog/2008-09-03/user-friendly-form-validation-with-wicket' rel='bookmark' title='User friendly form validation with Wicket'>User friendly form validation with Wicket</a></li>
<li><a href='http://stuq.nl/weblog/2008-06-05/wicket-how-to-write-a-reusable-modal-window-popup' rel='bookmark' title='Wicket: how to write a reusable modal window popup'>Wicket: how to write a reusable modal window popup</a></li>
<li><a href='http://stuq.nl/weblog/2009-11-01/automatically-test-your-wicket-panel-html-markup' rel='bookmark' title='Automatically test your Wicket panel HTML markup'>Automatically test your Wicket panel HTML markup</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p><img style="float: left;" src="http://stuq.nl/media/image/wicket_logo.png" alt="" /></p>
<p>This is a tutorial on using Wicket with REST-style URLs. Normally, Wicket generates URLs that are a bit ugly.<br />
For example:</p>
<p><em>http://www.example.com/wui/?wicket:bookmarkablePage=%3Anl.stuq.demo.SomePage</em>.</p>
<p>Ugly!</p>
<p>RESTful URLs change that: they are more meaningful for the user, hide some of your implementation details, and are just beautiful. Plus, you&#8217;re joining one of the latest hypes. Life couldn&#8217;t be better&#8230;</p>
<p><a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5nb29nbGUuY29tL3NlYXJjaD9obD1lbiZhbXA7cT13aWNrZXQrcmVzdGZ1bCZhbXA7YnRuRz1Hb29nbGUrU2VhcmNo" target=\"_blank\">Looking around on the intertubes</a>, there is not much useful information about using RESTful URLs in Wicket. Because I need this for a project I&#8217;m currently working on, I decided to turn this into a small tutorial.</p>
<h3>What is REST?</h3>
<p><strong>Representational State Transfer (REST)</strong> is a software architectural style for distributed hypermedia systems like the world wide web. The best way to explain this, is an example. A REST application might define the following resources:</p>
<ul>
<li>http://example.com/users/</li>
<li>http://example.com/users/{user} (one for each user)</li>
<li>http://example.com/findUserForm</li>
<li>http://example.com/locations/</li>
<li>http://example.com/locations/{location} (one for each location)</li>
<li>http://example.com/findLocationForm</li>
</ul>
<p>This is a very, very short explanation of only a small part of what REST does. More information, as always, can be <a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9SZXByZXNlbnRhdGlvbmFsX1N0YXRlX1RyYW5zZmVy" target=\"_blank\">found on Wikipedia</a>.</p>
<p>When you use custom URLs, you effectively hide some of your internal structure behind more meaningful URLs. This means you can refactor more easily without breaking external links or bookmarks to a specific part of your site. This is also important for search engine optimization.</p>
<p><strong>Note:</strong> I&#8217;m not going to describe here when you should or should not use REST<br />
with Wicket. That&#8217;s an architectural discussion, which depends greatly<br />
on your project. I have discovered some limitations in the Wicket development model that prevent the full implementation of REST. Please read further for more information.</p>
<h3>First steps</h3>
<p>I suggest you <a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3N0dXEubmwvbWVkaWEvY29kZS9kZW1vLXJlc3RmdWwuemlw">download the code</a> first and read along during the rest of this post.</p>
<p>We are going to create a customer overview page and a products overview page, reachable on &#8220;http://example.com/customers/&#8221; and &#8220;http://example.com/products/&#8221;.</p>
<p>The HomePage has two links, to the customer list and the product list. The product and customer lists have links to each individual product (http://example.com/products/${ID}) and customer (http://example.com/customers/${ID}).</p>
<p>For the Wicket UI, I created a HomePage, which links to the CustomerOverviewPage and ProductOverviewPage, which link to the Customer and Product detail pages. To serve up the data, we have some simple services, a ProductService and a CustomerService.</p>
<p><img style="clear: both;" src="http://stuq.nl/media/image/demo-urls-structure.png" alt="" /></p>
<h3>The code</h3>
<p>Wicket has a nice built in method of declaring (mounting) custom URL schemes. Simply give a class which implements the <a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy53aWNrZXRmcmFtZXdvcmsub3JnL2FwaWRvY3Mvd2lja2V0L3JlcXVlc3QvdGFyZ2V0L2NvZGluZy9JUmVxdWVzdFRhcmdldFVybENvZGluZ1N0cmF0ZWd5Lmh0bWw=" target=\"_blank\">IRequestTargetUrlCodingStrategy</a> interface to a WebApplication.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">void</span> mount<span style="color: #009900;">&#40;</span>IRequestTargetUrlCodingStrategy encoder<span style="color: #009900;">&#41;</span></pre></div></div>

<p>Relatively new in Wicket is the <a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3dpY2tldC5hcGFjaGUub3JnL2FwaWRvY3MvMS40L29yZy9hcGFjaGUvd2lja2V0L3JlcXVlc3QvdGFyZ2V0L2NvZGluZy9NaXhlZFBhcmFtVXJsQ29kaW5nU3RyYXRlZ3kuaHRtbA==" target=\"_blank\">MixedParamUrlCodingStrategy</a>, which we will use in a minute.</p>
<p>This is an example of how to use the MixedParamUrlCodingStrategy in your WebApplication class:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">        <span style="color: #000000; font-weight: bold;">public</span> WicketApplication<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
        MixedParamUrlCodingStrategy productURLS <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> MixedParamUrlCodingStrategy<span style="color: #009900;">&#40;</span>
                <span style="color: #0000ff;">&quot;products&quot;</span>,
                ProductDetailPage.<span style="color: #000000; font-weight: bold;">class</span>,
                <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#123;</span><span style="color: #0000ff;">&quot;id&quot;</span><span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        mount<span style="color: #009900;">&#40;</span>productURLS<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This means:</p>
<ul>
<li>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&quot;products&quot;</pre></div></div>

<p><em>This is the part of the URL after the Wicket&#8217;s application URL. In this case: &#8220;http://www.example.com/<strong>products</strong>&#8220;</em></li>
<li>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">ProductDetailPage.<span style="color: #000000; font-weight: bold;">class</span></pre></div></div>

<p><em>This defines for which class this URL is meant. In our project, the ProductDetailPage shows a product&#8217;s details.</em></li>
<li>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#123;</span><span style="color: #0000ff;">&quot;id&quot;</span><span style="color: #009900;">&#125;</span></pre></div></div>

<p><em>This is a list of all the parameters that you want to pass to this page. This shows up in the URL like this: &#8220;http://www.example.com/products/<strong>23</strong>&#8221; for a product with ID 23. You can easily pass more parameters to this page by adding items to this String array.</em></li>
<li>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">mount<span style="color: #009900;">&#40;</span>productURLS<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><em>This passes this MixedParamUrlCodingStrategy to the WebApplication.</em></li>
</ul>
<h3>The Product detail page</h3>
<p>The ProductDetailPage receives these URL parameters in the following way:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> ProductDetailPage<span style="color: #009900;">&#40;</span>PageParameters parameters<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000066; font-weight: bold;">int</span> id <span style="color: #339933;">=</span> parameters.<span style="color: #006633;">getInt</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;id&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>After that, you can get the Product with this ID (the rest of the code can be downloaded below):</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">setModel<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> CompoundPropertyModel<span style="color: #009900;">&#40;</span>productService.<span style="color: #006633;">getProduct</span><span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
add<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Label</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;id&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
add<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Label</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;name&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
add<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> BookmarkablePageLink<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;backLink&quot;</span>, getApplication<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getHomePage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>Limitations of Wicket</h3>
<p>It is currently not possibly (without doing a workaround outside Wicket) to do HTTP PUT, DELETE and POSTs to arbitrary URLs. If you do know how to achieve this, you are very welcome to post it in the comments.</p>
<h3>Further steps</h3>
<p>In the above tutorial we configured the URL&#8217;s in the WebApplication init() method. This has the drawback that information about a single page is in muliple places. It is good from an architecture perspective to configure the URL&#8217;s from the Page itself. Look at the wicket-stuff annotation project for more information on how to do that. You can find <a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3dpY2tldHN0dWZmLm9yZy9jb25mbHVlbmNlL2Rpc3BsYXkvU1RVRkZXSUtJL3dpY2tldHN0dWZmLWFubm90YXRpb24=" target=\"_blank\">an excellent tutorial</a> there. The wicketstuff-annotation library is used to mount your pages declaratively via Java annotations.</p>
<h3>Further reading</h3>
<ul>
<li>Putting more variables in a URL, AJAX resistent: <a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3dpY2tldC5hcGFjaGUub3JnL2FwaWRvY3MvMS40L29yZy9hcGFjaGUvd2lja2V0L3JlcXVlc3QvdGFyZ2V0L2NvZGluZy9IeWJyaWRVcmxDb2RpbmdTdHJhdGVneS5QYWdlSW5mb0V4dHJhY3Rpb24uaHRtbA==" target=\"_blank\">HybridUrlCodingStrategy</a></li>
<li><a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5tYWlsLWFyY2hpdmUuY29tL3dpY2tldC11c2VyQGxpc3RzLnNvdXJjZWZvcmdlLm5ldC9tc2czMDczMS5odG1s" target=\"_blank\">Wicket mailing list: Can I get a &#8216;Nice URL&#8217; when form validation fails?</a></li>
</ul>
<h3>Download</h3>
<p><a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3N0dXEubmwvbWVkaWEvY29kZS9kZW1vLXJlc3RmdWwuemlw">Download the complete example project</a> and start experimenting! (run with mvn jetty:run and connect to http://localhost:8080/demo)</p>
<p>Let me know how and where you use it in the comments!</p>
<p>Read the original at <a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3N0dXEubmwvd2VibG9nLzIwMDgtMDYtMjAvY3JlYXRlLXJlc3RmdWwtdXJscy13aXRoLXdpY2tldA==">Create RESTful URLs with Wicket</a> or go to the homepage of <a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3N0dXEubmw=">STUQ.nl</a></p>
 <img src="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=72" width="1" height="1" style="display: none;" /><div id="simple_socialmedia"><ul class="ssm_row"><li class="sharetext">Share:</li><li class="twitter"><a target="_blank" href="http://twitter.com/share?url=http://stuq.nl/weblog/2008-06-20/create-restful-urls-with-wicket&amp;text=Create RESTful URLs with Wicket&amp;via=daanvanetten">Tweet</a></li><li class="facebook"><a target="_blank" title="Share on Facebook" rel="nofollow" href="http://www.facebook.com/sharer.php?u=http://stuq.nl/weblog/2008-06-20/create-restful-urls-with-wicket&amp;t=Create RESTful URLs with Wicket">Facebook</a></li><li class="linkedin"><a target="_blank" title="Share on LinkedIn" rel="nofollow" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://stuq.nl/weblog/2008-06-20/create-restful-urls-with-wicket&amp;title=Create RESTful URLs with Wicket&amp;source=STUQ.nl">LinkedIn</a></li><li class="tumblr"><a target="_blank" title="Share on Tumblr" rel="nofollow" href="http://www.tumblr.com/share/link?url=http%3A%2F%2Fstuq.nl%2Fweblog%2F2008-06-20%2Fcreate-restful-urls-with-wicket&name=STUQ.nl&description=Create+RESTful+URLs+with+Wicket" title="Share on Tumblr">Tumblr</a></li><li class="stumble"><a target="_blank" title="Share on StumbleUpon" rel="nofollow" href="http://www.stumbleupon.com/submit?url=http://stuq.nl/weblog/2008-06-20/create-restful-urls-with-wicket">Stumble</a></li><li class="digg"><a target="_blank" title="Share on Digg" rel="nofollow" href="http://www.digg.com/submit?phase=2&amp;url=http://stuq.nl/weblog/2008-06-20/create-restful-urls-with-wicket">Digg</a></li><li class="delicious"><a target="_blank" title="Share on Delicious" rel="nofollow" href="http://del.icio.us/post?url=http://stuq.nl/weblog/2008-06-20/create-restful-urls-with-wicket&amp;title=INSERT_TITLE">Delicious</a></li></ul></div>

<br/><br/><p>Related posts:<ul><li><a href='http://stuq.nl/weblog/2008-09-03/user-friendly-form-validation-with-wicket' rel='bookmark' title='User friendly form validation with Wicket'>User friendly form validation with Wicket</a></li>
<li><a href='http://stuq.nl/weblog/2008-06-05/wicket-how-to-write-a-reusable-modal-window-popup' rel='bookmark' title='Wicket: how to write a reusable modal window popup'>Wicket: how to write a reusable modal window popup</a></li>
<li><a href='http://stuq.nl/weblog/2009-11-01/automatically-test-your-wicket-panel-html-markup' rel='bookmark' title='Automatically test your Wicket panel HTML markup'>Automatically test your Wicket panel HTML markup</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://stuq.nl/weblog/2008-06-20/create-restful-urls-with-wicket/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Wicket: how to write a reusable modal window popup</title>
		<link>http://stuq.nl/weblog/2008-06-05/wicket-how-to-write-a-reusable-modal-window-popup</link>
		<comments>http://stuq.nl/weblog/2008-06-05/wicket-how-to-write-a-reusable-modal-window-popup#comments</comments>
		<pubDate>Wed, 04 Jun 2008 23:22:47 +0000</pubDate>
		<dc:creator>Daan</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Productivity]]></category>
		<category><![CDATA[Scala]]></category>
		<category><![CDATA[Wicket Tutorials]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[<p>Wicket is a Java framework for creating web frontends. It allows you to create a webpage in Java, combining all kinds of components into one page. <br/>
In many projects, a subset of user interface elements are repeated over the site. Depending on your project, you can have different selection panels or popups that are used multiple times.</p>

<p>In the following tutorial I describe a method to write your own application specific reusable modal window popup.</p>
<p>Read the original at <a href="http://stuq.nl/weblog/2008-06-05/wicket-how-to-write-a-reusable-modal-window-popup">Wicket: how to write a reusable modal window popup</a> or go to the homepage of <a href="http://stuq.nl">STUQ.nl</a></p>


<br/><br/>
Related posts:<ul><li><a href='http://stuq.nl/weblog/2009-11-01/automatically-test-your-wicket-panel-html-markup' rel='bookmark' title='Automatically test your Wicket panel HTML markup'>Automatically test your Wicket panel HTML markup</a></li>
<li><a href='http://stuq.nl/weblog/2008-06-20/create-restful-urls-with-wicket' rel='bookmark' title='Create RESTful URLs with Wicket'>Create RESTful URLs with Wicket</a></li>
<li><a href='http://stuq.nl/weblog/2008-09-03/user-friendly-form-validation-with-wicket' rel='bookmark' title='User friendly form validation with Wicket'>User friendly form validation with Wicket</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>Wicket is a Java framework for creating web frontends. It allows you to create a webpage in Java, combining all kinds of components into one page.</p>
<p>In many projects, a subset of user interface elements are repeated over the site. Depending on your project, you can have different selection panels or popups that are used multiple times.</p>
<p>In the following tutorial I describe a method to write your own application specific reusable modal window popup.</p>
<h3>Start!</h3>
<p>For this example, we use the <a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy53aWNrZXRmcmFtZXdvcmsub3JnL3dpY2tldC1leHRlbnNpb25zL2FwaWRvY3Mvd2lja2V0L2V4dGVuc2lvbnMvYWpheC9tYXJrdXAvaHRtbC9tb2RhbC9Nb2RhbFdpbmRvdy5odG1s" target=\"_blank\">ModalWindow</a> component from <a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3dpY2tldC5zb3VyY2Vmb3JnZS5uZXQvd2lja2V0LWV4dGVuc2lvbnMvaW5kZXguaHRtbA==" target=\"_blank\">Wicket Extensions</a>.If you don’t know what a ModalWindow looks like, you can <a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy53aWNrZXQtbGlicmFyeS5jb20vd2lja2V0LWV4YW1wbGVzL2FqYXgvbW9kYWwtd2luZG93LjE=" target=\"_blank\">see a demo</a>. (hint: try to drag and drop it or resize it)</p>
<h3>The example from Wicket extensions</h3>
<p>The <a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy53aWNrZXQtbGlicmFyeS5jb20vd2lja2V0LWV4YW1wbGVzL2FqYXgvbW9kYWwtd2luZG93LjE=" target=\"_blank\">default example from the Wicket Extensions site</a> contains no real reusable components, besides the ModalWindow itself. The Page inside the ModalWindow is tightly coupled to the ModalWindow. It closes its containing ModalWindow and sets a result parameter of the parent page. The components can only be reused in exactly the same way.</p>
<h3>How can we make this more reusable?</h3>
<p>We can make this more reusable by making the content of the ModalWindow not aware of the ModalWindow itself. The content does not know what will happen when the containing Form (or other data) is submitted. But how can we do that? The magic words are: <strong>abstract methods</strong>.</p>
<p><img style="float: right;" src="/media/image/demo-reusability-structure.jpg" alt="" />Before we start, you can <a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=L21lZGlhL2NvZGUvZGVtby1yZXVzYWJpbGl0eS56aXA=">download the code here</a>, so you can get the complete picture.</p>
<p>The image on the right contains the structure of the page and the components we are creating. The page contains a modal window, which in turn contains a content panel.</p>
<h3>The Content Panel</h3>
<p>Lets start with the content panel inside the ModalWindow popup. This panel contains a selection link, a selection button and a cancel button, created in the constructor:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> SelectContentPanel<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> id<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">super</span><span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Create the form, to use later for the buttons</span>
  Form form <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Form<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;form&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  add<span style="color: #009900;">&#40;</span>form<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Add some example 'selection' methods, to show as example</span>
  <span style="color: #666666; font-style: italic;">// You can also use a full fledged form, I left that as an</span>
  <span style="color: #666666; font-style: italic;">// exercise for the reader :-)</span>
  add<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> AjaxLink<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;selectionLink&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onClick<span style="color: #009900;">&#40;</span>AjaxRequestTarget target<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      onSelect<span style="color: #009900;">&#40;</span>target, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Selection using the link.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  form.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> AjaxButton<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;selectionButton&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> onSubmit<span style="color: #009900;">&#40;</span>AjaxRequestTarget target, Form form<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      onSelect<span style="color: #009900;">&#40;</span>target, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Selection using the button.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Add a cancel / close button.</span>
  form.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> AjaxButton<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;close&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onSubmit<span style="color: #009900;">&#40;</span>AjaxRequestTarget target, Form form<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      onCancel<span style="color: #009900;">&#40;</span>target<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#91;</span>..<span style="color: #009900;">&#93;</span></pre></div></div>

<p>HTML:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">  &lt;a&gt;Select something&lt;/a&gt; 
&lt;form&gt;
&lt;input type=&quot;button&quot; value=&quot;Select something else&quot; /&gt;
&lt;input type=&quot;button&quot; value=&quot;Close&quot; /&gt;
  &lt;/form&gt;</pre></div></div>

<p>You probably noticed the calls to onSelect() and onCancel(). These are the abstract methods we are declaring:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">abstract</span> <span style="color: #000066; font-weight: bold;">void</span> onCancel<span style="color: #009900;">&#40;</span>AjaxRequestTarget target<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">abstract</span> <span style="color: #000066; font-weight: bold;">void</span> onSelect<span style="color: #009900;">&#40;</span>AjaxRequestTarget target, <span style="color: #003399;">String</span> selection<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>These methods are abstract, that way the code that is calling this panel must implement these methods. Because we are calling these methods, this effectively gives the result to the consuming code, without ever knowing what will happen with it.</p>
<p>To use abstract methods, the class itself must be abstract:<br />
public abstract class SelectContentPanel extends Panel</p>
<h3>The Modal Window</h3>
<p>The Modal Window initializes itself with some values. You can just as easily set these values from the calling class, but for now we keep it local.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> SelectModalWindow<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> id<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">super</span><span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Set sizes of this ModalWindow. You can also do this from the HomePage</span>
    <span style="color: #666666; font-style: italic;">// but its not a bad idea to set some good default values.</span>
    setInitialWidth<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">450</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    setInitialHeight<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">300</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    setTitle<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Select something&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Set the content panel, implementing the abstract methods</span>
    setContent<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> SelectContentPanel<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">getContentId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">void</span> onCancel<span style="color: #009900;">&#40;</span>AjaxRequestTarget target<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            SelectModalWindow.<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">onCancel</span><span style="color: #009900;">&#40;</span>target<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #000066; font-weight: bold;">void</span> onSelect<span style="color: #009900;">&#40;</span>AjaxRequestTarget target, <span style="color: #003399;">String</span> selection<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            SelectModalWindow.<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">onSelect</span><span style="color: #009900;">&#40;</span>target, selection<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>HTML:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">  &lt;a&gt;Select something&lt;/a&gt; 
&lt;form&gt;
&lt;input type=&quot;button&quot; value=&quot;Select something else&quot; /&gt;
&lt;input type=&quot;button&quot; value=&quot;Close&quot; /&gt;
  &lt;/form&gt;</pre></div></div>

<p>The setContent() function call is interesting. Here we create a new SelectContentPanel and implement the methods onCancel() and onSelect(). It is possible to do some extra actions here, but here it is passed one-on-one to the abstract methods of the ModalWindow itself:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">abstract</span> <span style="color: #000066; font-weight: bold;">void</span> onCancel<span style="color: #009900;">&#40;</span>AjaxRequestTarget target<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">abstract</span> <span style="color: #000066; font-weight: bold;">void</span> onSelect<span style="color: #009900;">&#40;</span>AjaxRequestTarget target, <span style="color: #003399;">String</span> selection<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>The Home Page</h3>
<p>The Home Page itself can now instantiate the ModalWindow, override the methods and do something with the data. One big advantage is that you can see from the HomePage class directly what is going to happen after the user selects something or cancels the action:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">final</span> ModalWindow selectModalWindow <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> SelectModalWindow<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;modalwindow&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #000066; font-weight: bold;">void</span> onSelect<span style="color: #009900;">&#40;</span>AjaxRequestTarget target, <span style="color: #003399;">String</span> selection<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// Handle Select action</span>
    resultLabel.<span style="color: #006633;">setModelObject</span><span style="color: #009900;">&#40;</span>selection<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    target.<span style="color: #006633;">addComponent</span><span style="color: #009900;">&#40;</span>resultLabel<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    close<span style="color: #009900;">&#40;</span>target<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000066; font-weight: bold;">void</span> onCancel<span style="color: #009900;">&#40;</span>AjaxRequestTarget target<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// Handle Cancel action</span>
    resultLabel.<span style="color: #006633;">setModelObject</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;ModalWindow cancelled.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    target.<span style="color: #006633;">addComponent</span><span style="color: #009900;">&#40;</span>resultLabel<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    close<span style="color: #009900;">&#40;</span>target<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
add<span style="color: #009900;">&#40;</span>selectModalWindow<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>Further customization</h3>
<p>This example is just passing a String around, you can change it to a more specific class. You can change the onSelect to something more appropriate for your use case. You can even put a Form inside the panel and return the resulting object of the form.</p>
<h3>Download</h3>
<p><a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=L21lZGlhL2NvZGUvZGVtby1yZXVzYWJpbGl0eS56aXA=">Download the complete example project</a> and start experimenting!<br />
(run with mvn jetty:run and connect to http://localhost:8080/demo)</p>
<p>If you think this is useful, please let me know in the comments.</p>
<p>Read the original at <a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3N0dXEubmwvd2VibG9nLzIwMDgtMDYtMDUvd2lja2V0LWhvdy10by13cml0ZS1hLXJldXNhYmxlLW1vZGFsLXdpbmRvdy1wb3B1cA==">Wicket: how to write a reusable modal window popup</a> or go to the homepage of <a href="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3N0dXEubmw=">STUQ.nl</a></p>
 <img src="http://stuq.nl/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=68" width="1" height="1" style="display: none;" /><div id="simple_socialmedia"><ul class="ssm_row"><li class="sharetext">Share:</li><li class="twitter"><a target="_blank" href="http://twitter.com/share?url=http://stuq.nl/weblog/2008-06-05/wicket-how-to-write-a-reusable-modal-window-popup&amp;text=Wicket: how to write a reusable modal window popup&amp;via=daanvanetten">Tweet</a></li><li class="facebook"><a target="_blank" title="Share on Facebook" rel="nofollow" href="http://www.facebook.com/sharer.php?u=http://stuq.nl/weblog/2008-06-05/wicket-how-to-write-a-reusable-modal-window-popup&amp;t=Wicket: how to write a reusable modal window popup">Facebook</a></li><li class="linkedin"><a target="_blank" title="Share on LinkedIn" rel="nofollow" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://stuq.nl/weblog/2008-06-05/wicket-how-to-write-a-reusable-modal-window-popup&amp;title=Wicket: how to write a reusable modal window popup&amp;source=STUQ.nl">LinkedIn</a></li><li class="tumblr"><a target="_blank" title="Share on Tumblr" rel="nofollow" href="http://www.tumblr.com/share/link?url=http%3A%2F%2Fstuq.nl%2Fweblog%2F2008-06-05%2Fwicket-how-to-write-a-reusable-modal-window-popup&name=STUQ.nl&description=Wicket%3A+how+to+write+a+reusable+modal+window+popup" title="Share on Tumblr">Tumblr</a></li><li class="stumble"><a target="_blank" title="Share on StumbleUpon" rel="nofollow" href="http://www.stumbleupon.com/submit?url=http://stuq.nl/weblog/2008-06-05/wicket-how-to-write-a-reusable-modal-window-popup">Stumble</a></li><li class="digg"><a target="_blank" title="Share on Digg" rel="nofollow" href="http://www.digg.com/submit?phase=2&amp;url=http://stuq.nl/weblog/2008-06-05/wicket-how-to-write-a-reusable-modal-window-popup">Digg</a></li><li class="delicious"><a target="_blank" title="Share on Delicious" rel="nofollow" href="http://del.icio.us/post?url=http://stuq.nl/weblog/2008-06-05/wicket-how-to-write-a-reusable-modal-window-popup&amp;title=INSERT_TITLE">Delicious</a></li></ul></div>

<br/><br/><p>Related posts:<ul><li><a href='http://stuq.nl/weblog/2009-11-01/automatically-test-your-wicket-panel-html-markup' rel='bookmark' title='Automatically test your Wicket panel HTML markup'>Automatically test your Wicket panel HTML markup</a></li>
<li><a href='http://stuq.nl/weblog/2008-06-20/create-restful-urls-with-wicket' rel='bookmark' title='Create RESTful URLs with Wicket'>Create RESTful URLs with Wicket</a></li>
<li><a href='http://stuq.nl/weblog/2008-09-03/user-friendly-form-validation-with-wicket' rel='bookmark' title='User friendly form validation with Wicket'>User friendly form validation with Wicket</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://stuq.nl/weblog/2008-06-05/wicket-how-to-write-a-reusable-modal-window-popup/feed</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
	</channel>
</rss>

