[seam-commits] Seam SVN: r13229 - modules/international/trunk/docs/reference/src/main/docbook/en-US.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Thu Jun 17 17:31:30 EDT 2010


Author: kenfinni
Date: 2010-06-17 17:31:29 -0400 (Thu, 17 Jun 2010)
New Revision: 13229

Modified:
   modules/international/trunk/docs/reference/src/main/docbook/en-US/timezones.xml
Log:
Add timezone content from blog into ref guide

Modified: modules/international/trunk/docs/reference/src/main/docbook/en-US/timezones.xml
===================================================================
--- modules/international/trunk/docs/reference/src/main/docbook/en-US/timezones.xml	2010-06-17 21:21:01 UTC (rev 13228)
+++ modules/international/trunk/docs/reference/src/main/docbook/en-US/timezones.xml	2010-06-17 21:31:29 UTC (rev 13229)
@@ -1,6 +1,71 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
    "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" []>
-<chapter id="timezones">
+<chapter id="international.timezones">
 	<title>Timezones</title>
+	<para>
+		To support a more developer friendly way of handling TimeZones we have incorporated the use of Joda-Time through their <literal>DateTimeZone</literal> 
+		class.  Don't worry, it provides convenience methods to convert to JDK <literal>TimeZone</literal> if required.
+	</para>
+	<section id="defaulttz">
+		<title>Default TimeZone</title>
+		<para>
+			Starting at the application level the module provides a <literal>DateTimeZone</literal> that can be retrieved with
+<programlisting>
+ at Inject
+DateTimeZone applicationTimeZone;</programlisting>
+			It can also be accessed through EL by the name "defaultTimeZone"!
+		</para>
+		<para>
+			By default the <literal>TimeZone</literal> will be set to the JVM default, unless you override the <literal>DefaultTimeZoneProducer</literal> Bean through XML Config.
+			For instance, adding this XML into <literal>seam-beans.xml</literal> or <literal>beans.xml</literal> will change the default <literal>TimeZone</literal> of the application to be Tijuana!
+		</para>
+<programlisting role="XML"><![CDATA[<beans xmlns="http://java.sun.com/xml/ns/javaee"
+   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xmlns:s="urn:java:seam:core" 
+   xmlns:tz="urn:java:org.jboss.seam.international.timezone"
+   xsi:schemaLocation="
+      http://java.sun.com/xml/ns/javaee 
+      http://docs.jboss.org/cdi/beans_1_0.xsd">
+
+    <tz:DefaultTimeZoneProducer>
+        <s:specializes/>
+        <tz:defaultTimeZoneId>America/Tijuana</tz:defaultTimeZoneId>
+    </tz:DefaultTimeZoneProducer>
+</beans>]]></programlisting>
+	</section>
+	<section id="usertz">
+		<title>User TimeZone</title>
+		<para>
+			We also have a <literal>DateTimeZone</literal> that is scoped to the User Session which can be retrieved with
+<programlisting>
+ at Inject
+ at UserTimeZone
+DateTimeZone userTimeZone;</programlisting>
+			It can also be accessed through EL using "userTimeZone".
+		</para>
+		<para>
+			By default the <literal>TimeZone</literal> will be the same as the application when the User Session is initialised.  However, changing
+			the User's <literal>TimeZone</literal> is a simple matter of firing an event to update it.  An example would be
+<programlisting>
+ at Inject
+ at Changed
+Event&lt;DateTimeZone&gt; tzEvent;
+ 
+public void setUserTimeZone()
+{
+     DateTimeZone tijuana = DateTimeZone.forID("America/Tijuana");
+     tzEvent.fire(tijuana);
+}</programlisting>
+		</para>
+	</section>
+	<section id="availtz">
+		<title>Available TimeZones</title>
+		<para>
+			We've also provided a list of available TimeZones that can be accessed via
+<programlisting>
+ at Inject
+List&lt;DateTimeZone&gt; timeZones;</programlisting>
+		</para>
+	</section>
 </chapter>
\ No newline at end of file



More information about the seam-commits mailing list