Author: adelbene
Date: Sat Dec 14 21:13:09 2013
New Revision: 1550971
URL: http://svn.apache.org/r1550971
Log:
Additional format checking
Modified:
wicket/common/site/trunk/_site/guide/gapi/DefaultPackage/BootStrap.html
wicket/common/site/trunk/_site/guide/gapi/DefaultPackage/UrlMappings.html
wicket/common/site/trunk/_site/guide/gapi/deprecated-list.html
wicket/common/site/trunk/_site/guide/gapi/help-doc.html
wicket/common/site/trunk/_site/guide/gapi/index-all.html
wicket/common/site/trunk/_site/guide/gapi/spring/resources.html
wicket/common/site/trunk/_site/guide/guide/chapter10.html
wicket/common/site/trunk/_site/guide/guide/chapter11.html
wicket/common/site/trunk/_site/guide/guide/chapter12.html
wicket/common/site/trunk/_site/guide/guide/chapter13.html
wicket/common/site/trunk/_site/guide/guide/chapter14.html
wicket/common/site/trunk/_site/guide/guide/chapter15.html
wicket/common/site/trunk/_site/guide/guide/chapter16.html
wicket/common/site/trunk/_site/guide/guide/chapter17.html
wicket/common/site/trunk/_site/guide/guide/chapter18.html
wicket/common/site/trunk/_site/guide/guide/chapter19.html
wicket/common/site/trunk/_site/guide/guide/chapter20.html
wicket/common/site/trunk/_site/guide/guide/chapter21.html
wicket/common/site/trunk/_site/guide/guide/chapter26.html
wicket/common/site/trunk/_site/guide/guide/chapter6.html
wicket/common/site/trunk/_site/guide/guide/chapter7.html
wicket/common/site/trunk/_site/guide/guide/chapter8.html
wicket/common/site/trunk/_site/guide/guide/chapter9.html
wicket/common/site/trunk/_site/guide/guide/index.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter10_1.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter10_2.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter10_3.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter10_4.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter10_5.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter11_10.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter11_11.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter11_2.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter11_3.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter11_4.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter11_6.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter11_8.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter12_1.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter12_2.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter12_3.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter12_4.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter12_5.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter13_1.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter13_2.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter13_3.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter13_4.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter13_5.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter14_1.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter14_2.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter14_3.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter14_4.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter14_5.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter14_6.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter14_7.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter14_8.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter14_9.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter15_2.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter16_1.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter16_2.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter16_3.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter16_4.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter16_5.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter17_1.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter17_2.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter17_3.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter17_4.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter17_5.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter17_6.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter18_1.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter18_2.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter18_4.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter19_1.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter19_2.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter19_3.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter19_4.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter19_5.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter20_1.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter20_3.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter21_2.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter6_4.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter7_2.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter7_3.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter8_2.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter8_3.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter8_4.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter9_1.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter9_2.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter9_4.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter9_5.html
wicket/common/site/trunk/_site/guide/guide/pages/chapter9_6.html
wicket/common/site/trunk/_site/guide/guide/single.html
wicket/common/site/trunk/_site/guide/guide/single.pdf
wicket/common/site/trunk/_site/guide/guide/src/docs/guide/chapter14/chapter14_3.gdoc
wicket/common/site/trunk/_site/guide/guide/src/docs/guide/chapter14/chapter14_5.gdoc
wicket/common/site/trunk/_site/guide/guide/src/docs/guide/chapter14/chapter14_7.gdoc
wicket/common/site/trunk/_site/guide/guide/src/docs/guide/chapter14/chapter14_8.gdoc
wicket/common/site/trunk/_site/guide/guide/src/docs/guide/chapter14/chapter14_9.gdoc
wicket/common/site/trunk/_site/guide/guide/src/docs/guide/chapter15/chapter15_2.gdoc
wicket/common/site/trunk/_site/guide/guide/src/docs/guide/chapter16/chapter16_1.gdoc
wicket/common/site/trunk/_site/guide/guide/src/docs/guide/chapter16/chapter16_2.gdoc
wicket/common/site/trunk/_site/guide/guide/src/docs/guide/chapter16/chapter16_3.gdoc
wicket/common/site/trunk/_site/guide/guide/src/docs/guide/chapter16/chapter16_4.gdoc
wicket/common/site/trunk/_site/guide/guide/src/docs/guide/chapter16/chapter16_5.gdoc
wicket/common/site/trunk/_site/guide/guide/src/docs/guide/chapter17/chapter17_1.gdoc
wicket/common/site/trunk/_site/guide/guide/src/docs/guide/chapter17/chapter17_2.gdoc
wicket/common/site/trunk/_site/guide/guide/src/docs/guide/chapter17/chapter17_3.gdoc
wicket/common/site/trunk/_site/guide/guide/src/docs/guide/chapter17/chapter17_4.gdoc
wicket/common/site/trunk/_site/guide/guide/src/docs/guide/chapter17/chapter17_5.gdoc
wicket/common/site/trunk/_site/guide/guide/src/docs/guide/chapter17/chapter17_6.gdoc
wicket/common/site/trunk/_site/guide/guide/src/docs/guide/chapter18/chapter18_1.gdoc
wicket/common/site/trunk/_site/guide/guide/src/docs/guide/chapter18/chapter18_2.gdoc
wicket/common/site/trunk/_site/guide/guide/src/docs/guide/chapter19/chapter19_1.gdoc
wicket/common/site/trunk/_site/guide/guide/src/docs/guide/chapter19/chapter19_2.gdoc
wicket/common/site/trunk/_site/guide/guide/src/docs/guide/chapter19/chapter19_3.gdoc
wicket/common/site/trunk/_site/guide/guide/src/docs/guide/chapter19/chapter19_4.gdoc
wicket/common/site/trunk/_site/guide/index.html
Modified:
wicket/common/site/trunk/_site/guide/gapi/DefaultPackage/BootStrap.html
URL:
http://svn.apache.org/viewvc/wicket/common/site/trunk/_site/guide/gapi/DefaultPackage/BootStrap.html?rev=1550971&r1=1550970&r2=1550971&view=diff
==============================================================================
--- wicket/common/site/trunk/_site/guide/gapi/DefaultPackage/BootStrap.html
(original)
+++ wicket/common/site/trunk/_site/guide/gapi/DefaultPackage/BootStrap.html Sat
Dec 14 21:13:09 2013
@@ -6,9 +6,9 @@
<html>
<head>
-<!-- Generated by groovydoc (2.0.5) on Wed Dec 11 16:50:58 CET 2013 -->
+<!-- Generated by groovydoc (2.0.8) on Sat Dec 14 22:03:19 CET 2013 -->
<title>BootStrap (Groovy Documentation)</title>
-<meta name="date" content="2013-12-11">
+<meta name="date" content="2013-12-14">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="../groovy.ico" type="image/x-icon" rel="shortcut icon">
<link href="../groovy.ico" type="image/x-icon" rel="icon">
Modified:
wicket/common/site/trunk/_site/guide/gapi/DefaultPackage/UrlMappings.html
URL:
http://svn.apache.org/viewvc/wicket/common/site/trunk/_site/guide/gapi/DefaultPackage/UrlMappings.html?rev=1550971&r1=1550970&r2=1550971&view=diff
==============================================================================
--- wicket/common/site/trunk/_site/guide/gapi/DefaultPackage/UrlMappings.html
(original)
+++ wicket/common/site/trunk/_site/guide/gapi/DefaultPackage/UrlMappings.html
Sat Dec 14 21:13:09 2013
@@ -6,9 +6,9 @@
<html>
<head>
-<!-- Generated by groovydoc (2.0.5) on Wed Dec 11 16:50:58 CET 2013 -->
+<!-- Generated by groovydoc (2.0.8) on Sat Dec 14 22:03:19 CET 2013 -->
<title>UrlMappings (Groovy Documentation)</title>
-<meta name="date" content="2013-12-11">
+<meta name="date" content="2013-12-14">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="../groovy.ico" type="image/x-icon" rel="shortcut icon">
<link href="../groovy.ico" type="image/x-icon" rel="icon">
Modified: wicket/common/site/trunk/_site/guide/gapi/deprecated-list.html
URL:
http://svn.apache.org/viewvc/wicket/common/site/trunk/_site/guide/gapi/deprecated-list.html?rev=1550971&r1=1550970&r2=1550971&view=diff
==============================================================================
--- wicket/common/site/trunk/_site/guide/gapi/deprecated-list.html (original)
+++ wicket/common/site/trunk/_site/guide/gapi/deprecated-list.html Sat Dec 14
21:13:09 2013
@@ -2,9 +2,9 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<!-- Generated by groovydoc (2.0.5) on -->
+<!-- Generated by groovydoc (2.0.8) on -->
<title>Deprecated API (wicket-userguide)</title>
-<meta name="date" content="2013-12-11">
+<meta name="date" content="2013-12-14">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<link href="groovy.ico" type="image/x-icon" rel="shortcut icon">
<link href="groovy.ico" type="image/x-icon" rel="icon">
Modified: wicket/common/site/trunk/_site/guide/gapi/help-doc.html
URL:
http://svn.apache.org/viewvc/wicket/common/site/trunk/_site/guide/gapi/help-doc.html?rev=1550971&r1=1550970&r2=1550971&view=diff
==============================================================================
--- wicket/common/site/trunk/_site/guide/gapi/help-doc.html (original)
+++ wicket/common/site/trunk/_site/guide/gapi/help-doc.html Sat Dec 14 21:13:09
2013
@@ -3,11 +3,11 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<!-- Generated by groovydoc (2.0.5) on -->
+<!-- Generated by groovydoc (2.0.8) on -->
<title>API Help (wicket-userguide)</title>
<link href="groovy.ico" type="image/x-icon" rel="shortcut icon">
<link href="groovy.ico" type="image/x-icon" rel="icon">
-<meta name="date" content="2013-12-11">
+<meta name="date" content="2013-12-14">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script type="text/javascript">
Modified: wicket/common/site/trunk/_site/guide/gapi/index-all.html
URL:
http://svn.apache.org/viewvc/wicket/common/site/trunk/_site/guide/gapi/index-all.html?rev=1550971&r1=1550970&r2=1550971&view=diff
==============================================================================
--- wicket/common/site/trunk/_site/guide/gapi/index-all.html (original)
+++ wicket/common/site/trunk/_site/guide/gapi/index-all.html Sat Dec 14
21:13:09 2013
@@ -2,9 +2,9 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<!-- Generated by groovydoc (2.0.5) on -->
+<!-- Generated by groovydoc (2.0.8) on -->
<title>Index (wicket-userguide)</title>
-<meta name="date" content="2013-12-11">
+<meta name="date" content="2013-12-14">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<link href="groovy.ico" type="image/x-icon" rel="shortcut icon">
<link href="groovy.ico" type="image/x-icon" rel="icon">
Modified: wicket/common/site/trunk/_site/guide/gapi/spring/resources.html
URL:
http://svn.apache.org/viewvc/wicket/common/site/trunk/_site/guide/gapi/spring/resources.html?rev=1550971&r1=1550970&r2=1550971&view=diff
==============================================================================
--- wicket/common/site/trunk/_site/guide/gapi/spring/resources.html (original)
+++ wicket/common/site/trunk/_site/guide/gapi/spring/resources.html Sat Dec 14
21:13:09 2013
@@ -6,9 +6,9 @@
<html>
<head>
-<!-- Generated by groovydoc (2.0.5) on Wed Dec 11 16:50:58 CET 2013 -->
+<!-- Generated by groovydoc (2.0.8) on Sat Dec 14 22:03:19 CET 2013 -->
<title>resources (Groovy Documentation)</title>
-<meta name="date" content="2013-12-11">
+<meta name="date" content="2013-12-14">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="../groovy.ico" type="image/x-icon" rel="shortcut icon">
<link href="../groovy.ico" type="image/x-icon" rel="icon">
Modified: wicket/common/site/trunk/_site/guide/guide/chapter10.html
URL:
http://svn.apache.org/viewvc/wicket/common/site/trunk/_site/guide/guide/chapter10.html?rev=1550971&r1=1550970&r2=1550971&view=diff
==============================================================================
--- wicket/common/site/trunk/_site/guide/guide/chapter10.html (original)
+++ wicket/common/site/trunk/_site/guide/guide/chapter10.html Sat Dec 14
21:13:09 2013
@@ -193,9 +193,9 @@ In Wicket the concept of âmodelâ
<h2 id="chapter10_1">11.1 What is a model?</h2>
-<p class="paragraph"/>Model is essentially a <a
href="http://en.wikipedia.org/wiki/Facade_pattern" target="blank">facade</a>
interface which allows components to access and modify their data without
knowing any detail about how they are managed or persisted. Every component has
at most one related model, while a model can be shared among different
components. In Wicket a model is any implementation of the interface
org.apache.wicket.model.IModel:<p class="paragraph"/><img border="0"
class="center" src="../img/uml-imodel.png"></img><p class="paragraph"/>The
IModel interface defines just the methods needed to get and set a data object
(getObject() and setObject()), decoupling components from concrete details
about the persistence strategy adopted for data. In addition, the level of
indirection introduced by models allows access data object only when it is
really needed (for example during the rendering phase) and not earlier when it
may not be ready to be used.<p class="paragraph"/>An
y component can get/set its model as well as its data object using the 4
public shortcut methods listed in the class diagram above. The two methods
onModelChanged() and onModelChanging() are triggered by Wicket each time a
model is modified: the first one is called after the model has been changed,
the second one just before the change occurs. In the examples seen so far we
have worked with Label component using its constructor which takes as input two
string parameters, the component id and the text to display:<p
class="paragraph"/><div class="code"><pre>add(<span
class="java-keyword">new</span> Label(<span
class="java-quote">"helloMessage"</span>, <span
class="java-quote">"Hello WicketWorld!"</span>));</pre></div><p
class="paragraph"/>This constructor internally builds a model which wraps the
second string parameter. That's why we didn't mention label model in the
previous examples. Here is the code of this constructor:<p
class="paragraph"/><div class="code"><pre><span
class="java-keyword">public</span> Label(<span
class="java-keyword">final</span> <span
class="java-object">String</span> id, <span
class="java-object">String</span> label) {
+<p class="paragraph"/>Model is essentially a <a
href="http://en.wikipedia.org/wiki/Facade_pattern" target="blank">facade</a>
interface which allows components to access and modify their data without
knowing any detail about how they are managed or persisted. Every component has
at most one related model, while a model can be shared among different
components. In Wicket a model is any implementation of the interface
<code>org.apache.wicket.model.IModel</code>:<p class="paragraph"/><img
border="0" class="center" src="../img/uml-imodel.png"></img><p
class="paragraph"/>The IModel interface defines just the methods needed to get
and set a data object (getObject() and setObject()), decoupling components from
concrete details about the persistence strategy adopted for data. In addition,
the level of indirection introduced by models allows access data object only
when it is really needed (for example during the rendering phase) and not
earlier when it may not be ready to be used.<p class="p
aragraph"/>Any component can get/set its model as well as its data object
using the 4 public shortcut methods listed in the class diagram above. The two
methods onModelChanged() and onModelChanging() are triggered by Wicket each
time a model is modified: the first one is called after the model has been
changed, the second one just before the change occurs. In the examples seen so
far we have worked with Label component using its constructor which takes as
input two string parameters, the component id and the text to display:<p
class="paragraph"/><div class="code"><pre>add(<span
class="java-keyword">new</span> Label(<span
class="java-quote">"helloMessage"</span>, <span
class="java-quote">"Hello WicketWorld!"</span>));</pre></div><p
class="paragraph"/>This constructor internally builds a model which wraps the
second string parameter. That's why we didn't mention label model in the
previous examples. Here is the code of this constructor:<p
class="paragraph"/><div class="cod
e"><pre><span class="java-keyword">public</span> Label(<span
class="java-keyword">final</span> <span
class="java-object">String</span> id, <span
class="java-object">String</span> label) {
<span class="java-keyword">this</span>(id, <span
class="java-keyword">new</span> Model<<span
class="java-object">String</span>>(label));
-}</pre></div><p class="paragraph"/>Class org.apache.wicket.model.Model is
a basic implementation of IModel. It can wrap any object that implements the
interface java.io.Serializable. The reason of this constraint over data object
is that this model is stored in the web session, and we know from chapter 6
that data are stored into session using serialization.<p
class="paragraph"/><blockquote class="note">
+}</pre></div><p class="paragraph"/>Class
<code>org.apache.wicket.model.Model</code> is a basic implementation of
<code>IModel</code>. It can wrap any object that implements the interface
java.io.Serializable. The reason of this constraint over data object is that
this model is stored in the web session, and we know from chapter 6 that data
are stored into session using serialization.<p class="paragraph"/><blockquote
class="note">
In general, Wicket models support a detaching capability that allows us to
work also with non-serializable objects as data model. We will see the
detaching mechanism later in this chapter.
</blockquote><p class="paragraph"/>Just like any other Wicket components,
Label provides a constructor that takes as input the component id and the model
to use with the component. Using this constructor the previous example
becomes:<p class="paragraph"/><div class="code"><pre>add(<span
class="java-keyword">new</span> Label(<span
class="java-quote">"helloMessage"</span>, <span
class="java-keyword">new</span> Model<<span
class="java-object">String</span>>(<span class="java-quote">"Hello
WicketWorld!"</span>)));</pre></div><p class="paragraph"/><blockquote
class="note">
The Model class comes with a bunch of factory methods that makes it easier to
build new model instances. For example the of(T object) method creates a new
instance of Model which wraps any Object instance inside it. So instead of
writing<p class="paragraph"/> new Model<String>("Hello
WicketWorld!")<p class="paragraph"/>we can write<p class="paragraph"/>
Model.of("Hello WicketWorld!")<p class="paragraph"/>If the data object is a
List, a Map or a Set we can use similar methods called ofList, ofMap and ofSet.
@@ -212,7 +212,7 @@ By default class Component escapes HTML
<h2 id="chapter10_2">11.2 Models and JavaBeans</h2>
-<p class="paragraph"/>One of the main goals of Wicket is to use JavaBeans and
POJO as data model, overcoming the impedance mismatch between web technologies
and OO paradigm. In order to make this task as easy as possible, Wicket offers
two special model classes: org.apache.wicket.model.PropertyModel and
org.apache.wicket.model.CompoundPropertyModel. We will see how to use them in
the next two examples, using the following JavaBean as the data object:<p
class="paragraph"/><div class="code"><pre><span
class="java-keyword">public</span> class Person <span
class="java-keyword">implements</span> Serializable {<p
class="paragraph"/> <span class="java-keyword">private</span> <span
class="java-object">String</span> name;
+<p class="paragraph"/>One of the main goals of Wicket is to use JavaBeans and
POJO as data model, overcoming the impedance mismatch between web technologies
and OO paradigm. In order to make this task as easy as possible, Wicket offers
two special model classes: <code>org.apache.wicket.model.PropertyModel</code>
and <code>org.apache.wicket.model.CompoundPropertyModel</code>. We will see how
to use them in the next two examples, using the following JavaBean as the data
object:<p class="paragraph"/><div class="code"><pre><span
class="java-keyword">public</span> class Person <span
class="java-keyword">implements</span> Serializable {<p
class="paragraph"/> <span class="java-keyword">private</span> <span
class="java-object">String</span> name;
<span class="java-keyword">private</span> <span
class="java-object">String</span> surname;
<span class="java-keyword">private</span> <span
class="java-object">String</span> address;
<span class="java-keyword">private</span> <span
class="java-object">String</span> email;
@@ -226,10 +226,10 @@ By default class Component escapes HTML
* Getters and setters <span class="java-keyword">for</span>
<span class="java-keyword">private</span> fields
*/
}</pre></div><p class="paragraph"/><h3>PropertyModel</h3><p
class="paragraph"/>Let's say we want to display the name field of a Person
instance with a label. We could, of course, use the Model class like we did in
the previous example, obtaining something like this:<p class="paragraph"/><div
class="code"><pre>Person person = <span class="java-keyword">new</span>
Person();
-//load person's data...<p class="paragraph"/>Label label = <span
class="java-keyword">new</span> Label(<span
class="java-quote">"name"</span>, <span class="java-keyword">new</span>
Model(person.getName()));</pre></div><p class="paragraph"/>However this
solution has a huge drawback: the text displayed by the label will be static
and if we change the value of the field, the label won't update its content.
Instead, to always display the current value of a class field, we should use
the org.apache.wicket.model.PropertyModel model class:<p
class="paragraph"/><div class="code"><pre>Person person = <span
class="java-keyword">new</span> Person();
-//load person's data...<p class="paragraph"/>Label label = <span
class="java-keyword">new</span> Label(<span
class="java-quote">"name"</span>, <span class="java-keyword">new</span>
PropertyModel(person, <span
class="java-quote">"name"</span>));</pre></div><p
class="paragraph"/>PropertyModel has just one constructor with two parameters:
the model object (person in our example) and the name of the property we want
to read/write ("name" in our example). This last parameter is called property
expression. Internally, methods getObject/setObject use property expression to
get/set property's value. To resolve class properties PropertyModel uses class
org.apache.wicket.util.lang.Property Resolver which can access any kind of
property, private fields included.<p class="paragraph"/>Just like the Java
language, property expressions support dotted notation to select sub
properties. So if we want to display the name of the Person's spouse we can
write:<p class="paragraph"/><div c
lass="code"><pre>Label label = <span class="java-keyword">new</span>
Label(<span class="java-quote">"spouseName"</span>, <span
class="java-keyword">new</span> PropertyModel(person, <span
class="java-quote">"spouse.name"</span>));</pre></div><p
class="paragraph"/><blockquote class="note">
+//load person's data...<p class="paragraph"/>Label label = <span
class="java-keyword">new</span> Label(<span
class="java-quote">"name"</span>, <span class="java-keyword">new</span>
Model(person.getName()));</pre></div><p class="paragraph"/>However this
solution has a huge drawback: the text displayed by the label will be static
and if we change the value of the field, the label won't update its content.
Instead, to always display the current value of a class field, we should use
the <code>org.apache.wicket.model.PropertyModel</code> model class:<p
class="paragraph"/><div class="code"><pre>Person person = <span
class="java-keyword">new</span> Person();
+//load person's data...<p class="paragraph"/>Label label = <span
class="java-keyword">new</span> Label(<span
class="java-quote">"name"</span>, <span class="java-keyword">new</span>
PropertyModel(person, <span
class="java-quote">"name"</span>));</pre></div><p
class="paragraph"/>PropertyModel has just one constructor with two parameters:
the model object (person in our example) and the name of the property we want
to read/write ("name" in our example). This last parameter is called property
expression. Internally, methods getObject/setObject use property expression to
get/set property's value. To resolve class properties PropertyModel uses class
<code>org.apache.wicket.util.lang.Property</code> Resolver which can access any
kind of property, private fields included.<p class="paragraph"/>Just like the
Java language, property expressions support dotted notation to select sub
properties. So if we want to display the name of the Person's spouse we can
write:<p class="parag
raph"/><div class="code"><pre>Label label = <span
class="java-keyword">new</span> Label(<span
class="java-quote">"spouseName"</span>, <span
class="java-keyword">new</span> PropertyModel(person, <span
class="java-quote">"spouse.name"</span>));</pre></div><p
class="paragraph"/><blockquote class="note">
PropertyModel is null-safe, which means we don't have to worry if property
expression includes a null value in its path. If such a value is encountered,
an empty string will be returned.
-</blockquote><p class="paragraph"/>If property is an array or a List, we can
specify an index after its name. For example, to display the name of the first
child of a Person we can write the following property expression:<p
class="paragraph"/><div class="code"><pre>Label label = <span
class="java-keyword">new</span> Label(<span
class="java-quote">"firstChildName"</span>, <span
class="java-keyword">new</span> PropertyModel(person, <span
class="java-quote">"children.0.name"</span>));</pre></div><p
class="paragraph"/>Indexes and map keys can be also specified using squared
brackets like âchildren0.nameâ or âmapFieldkey.subfieldâ.<p
class="paragraph"/><h3>CompoundPropertyModel and model inheritance</h3><p
class="paragraph"/>Class org.apache.wicket.model.CompoundPropertyModel is a
particular kind of model which is usually used in conjunction with another
Wicket feature called model inheritance. With this feature, when a component
needs to use a model b
ut none has been assigned to it, it will search through the whole container
hierarchy for a parent with an inheritable model. Inheritable models are those
which implement interface org.apache.wicket.model.IComponentInheritedModel and
CompoundPropertyModel is one of them. Once a CompoundPropertyModel has been
inherited by a component, it will behave just like a PropertyModel using the id
of the component as property expression. As a consequence, to make the most of
CompoundPropertyModel we must assign it to one of the containers of a given
component, rather than directly to the component itself.<p
class="paragraph"/>For example if we use CompoundPropertyModel with the
previous example (display spouse's name), the code would become like this:<p
class="paragraph"/><div class="code"><pre>//set CompoundPropertyModel as model
<span class="java-keyword">for</span> the container of the label
+</blockquote><p class="paragraph"/>If property is an array or a List, we can
specify an index after its name. For example, to display the name of the first
child of a Person we can write the following property expression:<p
class="paragraph"/><div class="code"><pre>Label label = <span
class="java-keyword">new</span> Label(<span
class="java-quote">"firstChildName"</span>, <span
class="java-keyword">new</span> PropertyModel(person, <span
class="java-quote">"children.0.name"</span>));</pre></div><p
class="paragraph"/>Indexes and map keys can be also specified using squared
brackets like âchildren0.nameâ or âmapFieldkey.subfieldâ.<p
class="paragraph"/><h3>CompoundPropertyModel and model inheritance</h3><p
class="paragraph"/>Class
<code>org.apache.wicket.model.CompoundPropertyModel</code> is a particular kind
of model which is usually used in conjunction with another Wicket feature
called model inheritance. With this feature, when a component needs to
use a model but none has been assigned to it, it will search through the whole
container hierarchy for a parent with an inheritable model. Inheritable models
are those which implement interface
<code>org.apache.wicket.model.IComponentInheritedModel</code> and
<code>CompoundPropertyModel</code> is one of them. Once a
<code>CompoundPropertyModel</code> has been inherited by a component, it will
behave just like a PropertyModel using the id of the component as property
expression. As a consequence, to make the most of CompoundPropertyModel we must
assign it to one of the containers of a given component, rather than directly
to the component itself.<p class="paragraph"/>For example if we use
CompoundPropertyModel with the previous example (display spouse's name), the
code would become like this:<p class="paragraph"/><div class="code"><pre>//set
CompoundPropertyModel as model <span class="java-keyword">for</span> the
container of the label
setDefaultModel(<span class="java-keyword">new</span>
CompoundPropertyModel(person));<p class="paragraph"/>Label label = <span
class="java-keyword">new</span> Label(<span
class="java-quote">"spouse.name"</span>);<p
class="paragraph"/>add(label);</pre></div><p class="paragraph"/>Note that now
the id of the label is equal to the property expression previously used with
PropertyModel. Now as a further example let's say we want to extend the code
above to display all of the main informations of a person (name, surname,
address and email). All we have to do is to add one label for every additional
information using the relative property expression as component id:<p
class="paragraph"/><div class="code"><pre>//Create a person named 'John Smith'
Person person = <span class="java-keyword">new</span> Person(<span
class="java-quote">"John"</span>, <span
class="java-quote">"Smith"</span>);
setDefaultModel(<span class="java-keyword">new</span>
CompoundPropertyModel(person));<p class="paragraph"/>add(<span
class="java-keyword">new</span> Label(<span
class="java-quote">"name"</span>));
@@ -245,7 +245,7 @@ Model is referred to as static model bec
<h2 id="chapter10_3">11.3 Wicket forms</h2>
-<p class="paragraph"/>Web applications use HTML forms to collect user input
and send it to the server. Wicket provides
org.apache.wicket.markup.html.form.Form class to handle web forms. This
component must be bound to <form> tag. The following snippet shows how
to create a very basic Wicket form in a page:<p class="paragraph"/>Html:<p
class="paragraph"/><div class="code"><pre><form wicket:id=<span
class="java-quote">"form"</span>>
+<p class="paragraph"/>Web applications use HTML forms to collect user input
and send it to the server. Wicket provides
<code>org.apache.wicket.markup.html.form.Form</code> class to handle web forms.
This component must be bound to <form> tag. The following snippet shows
how to create a very basic Wicket form in a page:<p class="paragraph"/>Html:<p
class="paragraph"/><div class="code"><pre><form wicket:id=<span
class="java-quote">"form"</span>>
<input type=<span class="java-quote">"submit"</span> value=<span
class="java-quote">"submit"</span>/>
</form></pre></div><p class="paragraph"/>
Java code:<p class="paragraph"/><div class="code"><pre>Form form = <span
class="java-keyword">new</span> Form(<span
class="java-quote">"form"</span>){
@@ -255,9 +255,9 @@ Java code:<p class="paragraph"/><div cla
}
};
add(form);</pre></div><p class="paragraph"/>Method onSubmit is called whenever
a form has been submitted and it can be overridden to perform custom actions.
Please note that a Wicket form can be submitted using a standard HTML submit
button which is not mapped to any component (i.e. it does not have a wicket:id
attribute).
-In the next chapter we will continue to explore Wicket forms and we will see
how to submit forms using special components which implement interface
org.apache.wicket.markup.html.form.IFormSubmitter.<p
class="paragraph"/><h3>Form and models</h3><p class="paragraph"/>A form should
contain some input fields (like text fields, check boxes, radio buttons,
drop-down lists, text areas, etc.) to interact with users. Wicket provides an
abstraction for all these kinds of elements with component
org.apache.wicket.markup.html.form.FormComponent:<p class="paragraph"/><img
border="0" class="center" src="../img/uml-form-component.png"></img><p
class="paragraph"/>The purpose of FormComponent is to store the corresponding
user input into its model when the form is submitted. The form is responsible
for mapping input values to the corresponding components, avoiding us the
burden of manually synchronizing models with input fields and vice versa.<p
class="paragraph"/><h3>Login form</h3><p class="paragr
aph"/>As first example of interaction between the form and its models, we will
build a classic login form which asks for username and password (project
LoginForm).<p class="paragraph"/><blockquote class="warning">
+In the next chapter we will continue to explore Wicket forms and we will see
how to submit forms using special components which implement interface
<code>org.apache.wicket.markup.html.form.IFormSubmitter</code>.<p
class="paragraph"/><h3>Form and models</h3><p class="paragraph"/>A form should
contain some input fields (like text fields, check boxes, radio buttons,
drop-down lists, text areas, etc.) to interact with users. Wicket provides an
abstraction for all these kinds of elements with component
org.apache.wicket.markup.html.form.FormComponent:<p class="paragraph"/><img
border="0" class="center" src="../img/uml-form-component.png"></img><p
class="paragraph"/>The purpose of FormComponent is to store the corresponding
user input into its model when the form is submitted. The form is responsible
for mapping input values to the corresponding components, avoiding us the
burden of manually synchronizing models with input fields and vice versa.<p
class="paragraph"/><h3>Login form</h3><p
class="paragraph"/>As first example of interaction between the form and its
models, we will build a classic login form which asks for username and password
(project LoginForm).<p class="paragraph"/><blockquote class="warning">
The topic of security will be discussed later in chapter 18. The following
form is for example purposes only and is not suited for a real application.
-If you need to use a login form you should consider to use component
org.apache.wicket.authroles.authentication.panel.SignInPanel shipped with
Wicket.
+If you need to use a login form you should consider to use component
<code>org.apache.wicket.authroles.authentication.panel.SignInPanel</code>
shipped with Wicket.
</blockquote><p class="paragraph"/>This form needs two text fields, one of
which must be a password field. We should also use a label to display the
result of login process1. For the sake of simplicity, the login logic is all
inside onSubmit and is quite trivial.<p class="paragraph"/>The following is a
possible implementation of our form:<p class="paragraph"/><div
class="code"><pre><span class="java-keyword">public</span> class LoginForm
<span class="java-keyword">extends</span> Form {<p class="paragraph"/>
<span class="java-keyword">private</span> TextField usernameField;
<span class="java-keyword">private</span> PasswordTextField
passwordField;
<span class="java-keyword">private</span> Label loginStatus;<p
class="paragraph"/> <span class="java-keyword">public</span>
LoginForm(<span class="java-object">String</span> id) {
@@ -321,7 +321,7 @@ spouse.add(name = <span class="java-
<h2 id="chapter10_4">11.4 Component DropDownChoice</h2>
-<p class="paragraph"/>Class org.apache.wicket.markup.html.form.DropDownChoice
is the form component needed to display a list of possible options as a
drop-down list where users can select one of the proposed options. This
component must be used with <select> tag:<p class="paragraph"/>Html:<p
class="paragraph"/><div class="code"><pre><form wicket:id=<span
class="java-quote">"form"</span>>
+<p class="paragraph"/>Class
<code>org.apache.wicket.markup.html.form.DropDownChoice</code> is the form
component needed to display a list of possible options as a drop-down list
where users can select one of the proposed options. This component must be used
with <select> tag:<p class="paragraph"/>Html:<p class="paragraph"/><div
class="code"><pre><form wicket:id=<span
class="java-quote">"form"</span>>
Select a fruit: <select wicket:id=<span
class="java-quote">"fruits"</span>></select>
<div><input type=<span class="java-quote">"submit"</span>
value=<span class="java-quote">"submit"</span>/></div>
</form></pre></div><p class="paragraph"/>Java code:<p
class="paragraph"/><div class="code"><pre>List<<span
class="java-object">String</span>> fruits = Arrays.asList(<span
class="java-quote">"apple"</span>, <span
class="java-quote">"strawberry"</span>, <span
class="java-quote">"watermelon"</span>);
@@ -334,14 +334,14 @@ form.add(<span class="java-keyword">
<option value=<span
class="java-quote">"0"</span>>apple</option>
<option value=<span
class="java-quote">"1"</span>>strawberry</option>
<option value=<span
class="java-quote">"2"</span>>watermelon</option>
-</select></pre></div><p class="paragraph"/>The first option is a
placeholder item corresponding to a null model value. By default DropDownChoice
cannot have a null value so users are forced to select a not-null option. If we
want to change this behavior we can set the nullValid flag to true via the
setNullValid method. Please note that the placeholder text (âChose oneâ)
can be localized, as we will see in chapter 12. The other options are
identified by the attribute value. By default the value of this attribute is
the index of the single option inside the provided list of choices, while the
text displayed to the user is obtained by calling toString()on the choice
object. This default behavior works fine as long as our options are simple
objects like strings, but when we move to more complex objects we may need to
implement a more sophisticated algorithm to generate the value to use as the
option id and the one to display to user. Wicket has solved this problem wit
h org.apache.wicket.markup.html.form.IChoiceRender interface. This interface
defines method getDisplayValue(T object) that is called to generate the value
to display for the given choice object, and method getIdValue(T object, int
index) that is called to generate the option id. The built-in implementation of
this interface is class org.apache.wicket.markup.html.Form. ChoiceRenderer
which renders the two values using property expressions.<p
class="paragraph"/>In the following code we want to show a list of Person
objects using their full name as value to display and using their passport code
as option id:<p class="paragraph"/>Java code:<p class="paragraph"/><div
class="code"><pre>List<Person> persons;
+</select></pre></div><p class="paragraph"/>The first option is a
placeholder item corresponding to a null model value. By default DropDownChoice
cannot have a null value so users are forced to select a not-null option. If we
want to change this behavior we can set the nullValid flag to true via the
setNullValid method. Please note that the placeholder text (âChose oneâ)
can be localized, as we will see in chapter 12. The other options are
identified by the attribute value. By default the value of this attribute is
the index of the single option inside the provided list of choices, while the
text displayed to the user is obtained by calling toString()on the choice
object. This default behavior works fine as long as our options are simple
objects like strings, but when we move to more complex objects we may need to
implement a more sophisticated algorithm to generate the value to use as the
option id and the one to display to user. Wicket has solved this problem wit
h <code>org.apache.wicket.markup.html.form.IChoiceRender</code> interface.
This interface defines method getDisplayValue(T object) that is called to
generate the value to display for the given choice object, and method
getIdValue(T object, int index) that is called to generate the option id. The
built-in implementation of this interface is class
<code>org.apache.wicket.markup.html.form.ChoiceRenderer</code> which renders
the two values using property expressions.<p class="paragraph"/>In the
following code we want to show a list of Person objects using their full name
as value to display and using their passport code as option id:<p
class="paragraph"/>Java code:<p class="paragraph"/><div
class="code"><pre>List<Person> persons;
//Initialize the list of persons here…
ChoiceRenderer personRenderer = <span class="java-keyword">new</span>
ChoiceRenderer(<span class="java-quote">"fullName"</span>, <span
class="java-quote">"passportCode"</span>);
form.add(<span class="java-keyword">new</span> DropDownChoice<<span
class="java-object">String</span>>(<span
class="java-quote">"persons"</span>, <span
class="java-keyword">new</span> Model<Person>(), persons,
personRenderer));</pre></div><p class="paragraph"/>The choice renderer can be
assigned to the DropDownChoice using one of its constructor that accepts this
type of parameter (like we did in the example above) or after its creation
invoking setChoiceRenderer method.
<h2 id="chapter10_5">11.5 Model chaining</h2>
-<p class="paragraph"/>Models that implement the interface
org.apache.wicket.model.IChainingModel can be used to build a chain of models.
These kinds of models are able to recognize whether their model object is
itself an implementation of IModel and if so, they will call getObject on the
wrapped model and the returned value will be the actual model object. In this
way we can combine the action of an arbitrary number of models, making exactly
a chain of models. Chaining models allows to combine different data persistence
strategies, similarly to what we do with chains of <a
href="http://java.sun.com/developer/technicalArticles/Streams/ProgIOStreams"
target="blank">I/O streams.</a> To see model chaining in action we will build a
page that implements the List/Detail View pattern, where we have a drop-down
list of Person objects and a form to display and edit the data of the current
selected Person.<p class="paragraph"/>The example page will look like this:<p
class="paragraph"/><img bor
der="0" class="center" src="../img/model-chaining.png"></img><p
class="paragraph"/>What we want to do in this example is to chain the model of
the DropDownChoice (which contains the selected Person) with the model of the
Form. In this way the Form will work with the selected Person as backing
object. The DropDownChoice component can be configured to automatically update
its model each time we change the selected item on the client side. All we have
to do is to override method wantOn SelectionChangedNotifications to make it
return true. In practice, when this method returns true, DropDownChoice will
submit its value every time JavaScript event onChange occurs, and its model
will be consequently updated. To leverage this functionality, DropDownChoice
doesn't need to be inside a form.<p class="paragraph"/>The following is the
resulting markup of the example page:<p class="paragraph"/><div
class="code"><pre>…
+<p class="paragraph"/>Models that implement the interface
<code>org.apache.wicket.model.IChainingModel</code> can be used to build a
chain of models. These kinds of models are able to recognize whether their
model object is itself an implementation of IModel and if so, they will call
getObject on the wrapped model and the returned value will be the actual model
object. In this way we can combine the action of an arbitrary number of models,
making exactly a chain of models. Chaining models allows to combine different
data persistence strategies, similarly to what we do with chains of <a
href="http://java.sun.com/developer/technicalArticles/Streams/ProgIOStreams"
target="blank">I/O streams.</a> To see model chaining in action we will build a
page that implements the List/Detail View pattern, where we have a drop-down
list of Person objects and a form to display and edit the data of the current
selected Person.<p class="paragraph"/>The example page will look like this:<p
class="paragra
ph"/><img border="0" class="center" src="../img/model-chaining.png"></img><p
class="paragraph"/>What we want to do in this example is to chain the model of
the DropDownChoice (which contains the selected Person) with the model of the
Form. In this way the Form will work with the selected Person as backing
object. The DropDownChoice component can be configured to automatically update
its model each time we change the selected item on the client side. All we have
to do is to override method wantOn SelectionChangedNotifications to make it
return true. In practice, when this method returns true, DropDownChoice will
submit its value every time JavaScript event onChange occurs, and its model
will be consequently updated. To leverage this functionality, DropDownChoice
doesn't need to be inside a form.<p class="paragraph"/>The following is the
resulting markup of the example page:<p class="paragraph"/><div
class="code"><pre>…
<body>
List of persons <select wicket:id=<span
class="java-quote">"persons"</span>></select> <br/>
<br/>