cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stev...@outerthought.org
Subject [WIKI-UPDATE] WoodyReference Tue Jul 15 18:00:03 2003
Date Tue, 15 Jul 2003 16:00:06 GMT
Page: http://wiki.cocoondev.org/Wiki.jsp?page=WoodyReference , version: 3 on Tue Jul 15 15:51:53
2003 by BrunoDumon

- !!Widget reference
+ !!!Widget reference
? +

- !!Datatype reference
+ !!!Datatype reference
? +

- !General
+ !!General
? +

- !string datatype
+ !!string datatype
? +

- !long datatype
+ !!long datatype
? +

- !date datatype
+ !!date datatype
? +

- [[Nothing here yet]
+ The date datatype corresponds to the java.util.Date type. This means it can be used both
for dates as times.
+ The date datatype supports the following convertors:
+ 
+ !formatting
+ 
+ This convertor uses the java.text.SimpleDateFormat class (or com.ibm.icu.text.SimpleDateFormat
class if it is present in the classpath). This means it can perform locale-dependent, pattern-based
formatting of dates.
+ 
+ Configuration pseudo-schema:
+ {{{
+ <wd:convertor type="formatting" variant="date|time|datetime" ? style="short|medium|long|full"
?>
+   <wd:patterns>
+     <wd:pattern>....</wd:pattern> ?
+     <wd:pattern locale="lang-COUNTRY">....</wd:pattern> *
+   </wd:patterns> ?
+ </wd:convertor>
+ }}}
+ 
+ Usually you will use either the variant and style attributes or the pattern(s).
+ 
+ For example, the following convertor configuration:
+ {{{
+ <wd:convertor type="formatting" variant="date" style="short">
+ }}}
+ 
+ Will give the following for July 15, 2003: 7/15/03. Using style medium it gives "Jul 15,
2003", style long gives "July 15, 2003", and style full gives "Tuesday, July 15, 2003". These
result are locale-dependent of course.
+ 
+ Here's an example of using a formatting pattern:
+ {{{
+ <wd:convertor type="formatting">
+   <wd:patterns>
+     <wd:pattern>dd/MM/yyyy</wd:pattern>
+   </wd:patterns>
+ </wd:convertor>
+ }}}
+ 
+ Using the same date, this will now give "15/07/2003".
+ 
+ It is also possible to use different patterns for different locales by using multiple wd:pattern
elements with "locale" attributes, for example:
+ {{{
+ <wd:convertor type="formatting">
+   <wd:patterns>
+     <wd:pattern>MM/dd/yyyy</wd:pattern>
+     <wd:pattern locale="nl-BE">dd/MM/yyyy</wd:pattern>
+     <wd:pattern locale="fr">dd-MM-yyyy</wd:pattern>
+   </wd:patterns>
+ </wd:convertor>
+ }}}
+ 
+ In this case, if the locale is "nl-BE", the second pattern will be used; if the locale is
"en", the first pattern will be used; and if the locale is "fr-BE" the third pattern will
be used (because when fr-BE is not found, it will first search for "fr" before using the locale-indepent
pattern).
+ 
+ !millis
+ 
+ The millis convertor for dates uses the number of milliseconds since January 1, 1970, 00:00:00
GMT as string representation. This will likely not be used to present dates to the user, but
may be useful in selection lists retrieved from external sources.
+ 
- !!Validation rule reference
+ !!!Validation rule reference
? +

+ !regexp
+ 
+ Can be used in combination with these datatypes: string
+ 
+ Checks that a string matches a regular expression. It requires a "pattern" attributes specifying
the regexp. The regular expression library used is Jakarta ORO, see [here|http://jakarta.apache.org/oro/api/org/apache/oro/text/regex/package-summary.html]
for some information.
+ 
+ Example:
+ {{{
+ <wd:regexp pattern="[a-z]{3,5}">
+    <wd:failmessage>Invalid code!</wd:failmessage>
+ </wd:regexp>
+ }}}
+ 
+ !mod10
+ 
+ Can be used in combination with these datatypes: string
+ 
+ Uses the "mod10" algorithm used to check the validity of credit card numbers such as VISA.
This validation rule does not require any additional attributes.
+ 



Mime
View raw message