You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@cocoon.apache.org by st...@outerthought.org on 2003/11/29 17:00:05 UTC

[WIKI-UPDATE] CocoonFormsRoadmap XMLIndiceCocoon2.1 WoodyDatatypeReference Sat Nov 29 17:00:05 2003

Page: http://wiki.cocoondev.org/Wiki.jsp?page=CocoonFormsRoadmap , version: 11 on Sat Nov 29 15:53:18 2003 by 80.183.30.23

- vote: +1 (RP), +1 ([AH|AndreasHochsteger])\\
+ vote: +1 (RP), +1 ([AH|AndreasHochsteger]), +1 ([UC|UgoCei])\\
?                                           ++++++++++++++++++

- vote: +1 (RP), +1 ([AH|AndreasHochsteger])\\
+ vote: +1 (RP), +1 ([AH|AndreasHochsteger]), +1 ([UC|UgoCei])\\
?                                           ++++++++++++++++++

-  vote: +1 (RP)\\  
+  vote: +1 (RP), +1 ([UC|UgoCei])\\  
- vote: +0 (RP), +1 ([AH|AndreasHochsteger])\\
+ vote: +0 (RP), +1 ([AH|AndreasHochsteger]), +1 ([UC|UgoCei])\\
?                                           ++++++++++++++++++

- status: done (needs documentation)  \\
+ status: done\\
- vote: \\
+ vote: +1 ([UC|UgoCei])\\
- vote: +1 (DB), +1 ([AH|AndreasHochsteger])\\
+ vote: +1 (DB), +1 ([AH|AndreasHochsteger]), +1 ([UC|UgoCei])\\
?                                           ++++++++++++++++++



Page: http://wiki.cocoondev.org/Wiki.jsp?page=XMLIndiceCocoon2.1 , version: 5 on Sat Nov 29 15:39:00 2003 by Vadim

+ __NOTE:__ While for Xindice 1.0 default port is 4080, Xindice 1.1 server is deployed on top of servlet engine, and you should use servlet engine's port number, such as 8080 or 8888.
+ 


Page: http://wiki.cocoondev.org/Wiki.jsp?page=WoodyDatatypeReference , version: 6 on Sat Nov 29 15:38:11 2003 by 80.183.30.23

- !!Selection lists: flow-jxpath implemenation
+ !!Selection lists: flow-jxpath implementation
?                                        +

+ !!Selection lists: enum implementation
+ 
+ This type of selection list outputs a list of items corresponding to the possible instances of an enumerated type (see below).
+ 
+ Example:
+ 
+ {{{
+ <wd:selection-list type="enum" class="com.example.Sex"/>
+ }}}
+ 
+ outputs:
+ 
+ {{{
+ <wi:selection-list>
+   <wi:item value=""/>
+   <wi:item value="com.example.Sex.MALE">
+     <wi:label>
+       <i18n:text>com.example.Sex.MALE</i18n:text>
+     </wi:label>
+   </wi:item>
+   <wi:item value="com.example.Sex.FEMALE">
+     <wi:label>
+       <i18n:text>com.example.Sex.FEMALE</i18n:text>
+     </wi:label>
+   </wi:item>
+ </wi:selection-list>
+ }}}
+ 
+ If you don't want an initial null value, add a __nullable="false"__ attribute to the __wd:selection-list__ element.
+ 
+ |enum|Enumerated type|enum
+ !!Enumerated datatypes
+ 
+ The __enum__ datatype is meant to be used with types implementing Joshua Bloch's [typesafe enum pattern|http://developer.java.sun.com/developer/Books/shiftintojava/page1.html#replaceenums].     The following is a possible implementation:
+ 
+ {{{
+ package com.example;
+ 
+ public class Sex {
+ 
+     public static final Sex MALE = new Sex("M");
+     public static final Sex FEMALE = new Sex("F");
+     private String code;
+ 
+     private Sex(String code) { this.code = code; }
+ }
+ }}}
+ 
+ The following snippet shows the usage of this type:
+ 
+ {{{
+ <wd:field id="sex">
+   <wd:label>Sex</wd:label>
+   <wd:datatype base="enum">
+     <wd:convertor type="enum">
+       <wd:enum>com.example.Sex</wd:enum>
+     </wd:convertor>
+   </wd:datatype>
+   <wd:selection-list type="enum" class="com.example.Sex"/>
+ </wd:field>
+ }}}
+ 
+ If your enumerated type does not provide a {{toString()}} method, the enum convertor will use the fully qualified class name, followed by the name of the {{public static final}} field referring to each instance, i.e. {{"com.example.Sex.MALE"}}, {{"com.example.Sex.FEMALE"}} and so on.
+ 
+ If you provide a {{toString()}} method which returns something different, you should also provide a {{fromString(String, Locale)}} method to convert those strings back to instances.
+ 
+ The enum datatype is typically used together with the __enum__ selection list type.