bruno 2003/08/12 05:59:10
Modified: src/blocks/woody/java/org/apache/cocoon/woody/samples
Form2Bean.java
src/blocks/woody/samples/forms form2_bind_bean.xml
form2_bind_xml.xml form2_data.xml form2_jx.xml
form2_model.xml form2_template.xml
Log:
Extended binding samples with a booleanfield
Revision Changes Path
1.3 +9 -0
cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/samples/Form2Bean.java
Index: Form2Bean.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/samples/Form2Bean.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Form2Bean.java 24 Jul 2003 12:40:32 -0000 1.2
+++ Form2Bean.java 12 Aug 2003 12:59:10 -0000 1.3
@@ -67,6 +67,7 @@
private String ipAddress;
private Date birthday;
private int aNumber;
+ private boolean choose;
private Collection contacts = new ArrayList();
@@ -127,6 +128,14 @@
public void setaNumber(int aNumber) {
this.aNumber = aNumber;
+ }
+
+ public boolean isChoose() {
+ return choose;
+ }
+
+ public void setChoose(boolean choose) {
+ this.choose = choose;
}
public Collection getContacts() {
1.4 +12 -11 cocoon-2.1/src/blocks/woody/samples/forms/form2_bind_bean.xml
Index: form2_bind_bean.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/samples/forms/form2_bind_bean.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- form2_bind_bean.xml 24 Jul 2003 12:42:19 -0000 1.3
+++ form2_bind_bean.xml 12 Aug 2003 12:59:10 -0000 1.4
@@ -11,10 +11,11 @@
<wb:context xmlns:wb="http://apache.org/cocoon/woody/binding/1.0" path="/" >
<!-- the email value will not be saved because of the @readonly -->
- <wb:field id="email" path="email" readonly="true"/>
- <wb:field id="ipaddress" path="ipAddress"/>
- <wb:field id="birthday" path="birthday"/>
- <wb:field id="number" path="aNumber"/>
+ <wb:value id="email" path="email" readonly="true"/>
+ <wb:value id="ipaddress" path="ipAddress"/>
+ <wb:value id="birthday" path="birthday"/>
+ <wb:value id="number" path="aNumber"/>
+ <wb:value id="choose" path="choose"/>
<!-- An aggregatefield is a special kind of widget that lets
the user edit the value of multiple widgets through one text box
@@ -22,9 +23,9 @@
it is used to map the different parts of a phone number to different
bean properties. -->
<wb:aggregate id="phone" path="." >
- <wb:field id="number" path="phoneNumber"/>
- <wb:field id="zone" path="phoneZone"/>
- <wb:field id="cntr" path="phoneCountry"/>
+ <wb:value id="number" path="phoneNumber"/>
+ <wb:value id="zone" path="phoneZone"/>
+ <wb:value id="cntr" path="phoneCountry"/>
</wb:aggregate>
<!-- repeater requires unique identification mechanism of the row-nodes -->
@@ -40,10 +41,10 @@
<wb:on-bind>
<!-- executed on updates AND right after the insert -->
- <wb:field id="firstname" path="firstName"/>
- <wb:field id="lastname" path="lastName"/>
- <wb:field id="phone" path="phone"/>
- <wb:field id="email" path="email"/>
+ <wb:value id="firstname" path="firstName"/>
+ <wb:value id="lastname" path="lastName"/>
+ <wb:value id="phone" path="phone"/>
+ <wb:value id="email" path="email"/>
</wb:on-bind>
<wb:on-delete-row>
1.3 +18 -14 cocoon-2.1/src/blocks/woody/samples/forms/form2_bind_xml.xml
Index: form2_bind_xml.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/samples/forms/form2_bind_xml.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- form2_bind_xml.xml 24 Jul 2003 12:42:19 -0000 1.2
+++ form2_bind_xml.xml 12 Aug 2003 12:59:10 -0000 1.3
@@ -11,41 +11,45 @@
<wb:context path="info">
<!-- the email value will not be saved because of the @readonly -->
- <wb:field id="email" path="email" readonly="true"/>
+ <wb:value id="email" path="email" readonly="true"/>
<!-- jxpath binds to nodes as well as to attributes -->
- <wb:field id="number" path="number/@value">
+ <wb:value id="number" path="number/@value">
<!-- for non-string datatypes, a convertor must be specified. These are
the same convertors as can be used in form definitions, but require an
extra datatype attribute. Here we use the default convertor for longs. -->
<wd:convertor datatype="long"/>
- </wb:field>
+ </wb:value>
+
+ <wb:value id="choose" path="choose/@value">
+ <wd:convertor datatype="boolean"/>
+ </wb:value>
<!-- one entry field in the client maps through aggregate fields -->
<wb:aggregate id="phone" path="phone" >
<!-- to multiple fields in the XML file -->
- <wb:field id="number" path="number" />
- <wb:field id="zone" path="zone" />
- <wb:field id="cntr" path="@cntr" />
+ <wb:value id="number" path="number" />
+ <wb:value id="zone" path="zone" />
+ <wb:value id="cntr" path="@cntr" />
</wb:aggregate>
</wb:context>
- <wb:field id="ipaddress" path="ipaddress">
+ <wb:value id="ipaddress" path="ipaddress">
<wb:on-update>
<!-- if the value has changed, the attribute will be set -->
<wb:set-attribute name="changed" value="true"/>
</wb:on-update>
- </wb:field>
+ </wb:value>
- <wb:field id="birthday" path="birthday">
+ <wb:value id="birthday" path="birthday">
<wd:convertor datatype="date" type="formatting">
<wd:patterns>
<wd:pattern>yyyy-MM-dd</wd:pattern>
</wd:patterns>
</wd:convertor>
- </wb:field>
+ </wb:value>
<!-- repeater requires unique identification mechanism of the row-nodes -->
@@ -60,10 +64,10 @@
<wb:on-bind>
<!-- executed on updates AND right after the insert -->
- <wb:field id="firstname" path="firstname" />
- <wb:field id="lastname" path="lastname" />
- <wb:field id="phone" path="phone/@nr" />
- <wb:field id="email" path="email" />
+ <wb:value id="firstname" path="firstname" />
+ <wb:value id="lastname" path="lastname" />
+ <wb:value id="phone" path="phone/@nr" />
+ <wb:value id="email" path="email" />
</wb:on-bind>
<wb:on-delete-row>
1.3 +1 -0 cocoon-2.1/src/blocks/woody/samples/forms/form2_data.xml
Index: form2_data.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/samples/forms/form2_data.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- form2_data.xml 24 Jul 2003 12:42:19 -0000 1.2
+++ form2_data.xml 12 Aug 2003 12:59:10 -0000 1.3
@@ -5,6 +5,7 @@
<info>
<email boolBindingWorks="false">[EMAIL PROTECTED]</email>
<number value="3"/>
+ <choose value="true"/>
<phone cntr="32">
<zone>2</zone>
1.4 +2 -0 cocoon-2.1/src/blocks/woody/samples/forms/form2_jx.xml
Index: form2_jx.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/samples/forms/form2_jx.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- form2_jx.xml 24 Jul 2003 12:42:19 -0000 1.3
+++ form2_jx.xml 12 Aug 2003 12:59:10 -0000 1.4
@@ -10,6 +10,8 @@
birthday: ${form2bean.birthday}
<br/>
number: ${form2bean.aNumber}
+ <br/>
+ I choose: ${form2bean.choose}
<table border="1">
<tr>
1.5 +6 -2 cocoon-2.1/src/blocks/woody/samples/forms/form2_model.xml
Index: form2_model.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/samples/forms/form2_model.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- form2_model.xml 28 Jul 2003 15:58:16 -0000 1.4
+++ form2_model.xml 12 Aug 2003 12:59:10 -0000 1.5
@@ -74,10 +74,14 @@
</wd:selection-list>
</wd:field>
+ <wd:booleanfield id="choose">
+ <wd:label>I choose</wd:label>
+ </wd:booleanfield>
+
<wd:repeater id="contacts">
- <wd:field id="id">
+ <wd:output id="id">
<wd:datatype base="string"/>
- </wd:field>
+ </wd:output>
<wd:field id="firstname">
<wd:label>Firstname</wd:label>
<wd:datatype base="string"/>
1.2 +4 -0 cocoon-2.1/src/blocks/woody/samples/forms/form2_template.xml
Index: form2_template.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/samples/forms/form2_template.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- form2_template.xml 25 Jul 2003 09:01:40 -0000 1.1
+++ form2_template.xml 12 Aug 2003 12:59:10 -0000 1.2
@@ -48,6 +48,10 @@
<td valign="top"><wt:widget-label id="number"/></td>
<td valign="top"><wt:widget id="number"/></td>
</tr>
+ <tr>
+ <td/>
+ <td valign="top"><wt:widget id="choose"/> <wt:widget-label
id="choose"/></td>
+ </tr>
</table>
<wt:widget-label id="contacts"/><br/>