[seam-commits] Seam SVN: r8583 - branches/Seam_2_0/doc/Seam_Reference_Guide/en-US.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Tue Aug 5 12:50:30 EDT 2008


Author: pete.muir at jboss.org
Date: 2008-08-05 12:50:30 -0400 (Tue, 05 Aug 2008)
New Revision: 8583

Modified:
   branches/Seam_2_0/doc/Seam_Reference_Guide/en-US/Controls.xml
Log:
Backport JBSEAM-3118

Modified: branches/Seam_2_0/doc/Seam_Reference_Guide/en-US/Controls.xml
===================================================================
--- branches/Seam_2_0/doc/Seam_Reference_Guide/en-US/Controls.xml	2008-08-05 16:47:36 UTC (rev 8582)
+++ branches/Seam_2_0/doc/Seam_Reference_Guide/en-US/Controls.xml	2008-08-05 16:50:30 UTC (rev 8583)
@@ -1132,23 +1132,23 @@
          </term>
          <listitem>
            <programlisting role="JAVA"><![CDATA[@Name("itemConverter") 
-   @BypassInterceptors 
-   @Converter
-   public class ItemConverter implements Converter {
-      
-     @Transactional
-     public Object getAsObject(FacesContext context, UIComponent cmp, String value) {
-       EntityManager entityManager = (EntityManager) Component.getInstance("entityManager");
-       entityManager.joinTransaction();
-       // Do the conversion
-     }
-     
-     public String getAsString(FacesContext context, UIComponent cmp, Object value) {
-       // Do the conversion
-     }
-     
-   }]]></programlisting>
+ at BypassInterceptors 
+ at Converter
+public class ItemConverter implements Converter {
    
+   @Transactional
+   public Object getAsObject(FacesContext context, UIComponent cmp, String value) {
+      EntityManager entityManager = (EntityManager) Component.getInstance("entityManager");
+      entityManager.joinTransaction();
+      // Do the conversion
+   }
+  
+   public String getAsString(FacesContext context, UIComponent cmp, Object value) {
+      // Do the conversion
+   }
+  
+}]]></programlisting>
+   
              <programlisting role="XHTML"><![CDATA[<h:inputText value="#{shop.item}" converter="itemConverter" />]]></programlisting>
                
              <para>
@@ -1165,17 +1165,19 @@
          </term>
          <listitem>
            <programlisting role="JAVA"><![CDATA[@Name("itemValidator") 
-   @BypassInterceptors 
-   @Validator
-   public class ItemValidator implements Validator {
+ at BypassInterceptors 
+ at org.jboss.seam.annotations.faces.Validator
+public class ItemValidator implements javax.faces.validator.Validator {
       
-     public void validate(FacesContext context, UIComponent cmp, Object value)
-       throws ValidatorException {
-       ItemController ItemController = (ItemController) Component.getInstance("itemController");
-       return itemController.validate(value);
-     }
-     
-     }]]></programlisting>
+   public void validate(FacesContext context, UIComponent cmp, Object value)
+         throws ValidatorException {
+      ItemController ItemController = (ItemController) Component.getInstance("itemController");
+      boolean valid = itemController.validate(value);
+      if (!valid) {
+         throw ValidatorException("Invalid value " + value);
+      }
+   }
+}]]></programlisting>
             
             <programlisting role="XHTML"><![CDATA[<h:inputText value="#{shop.item}" validator="itemValidator" />]]></programlisting>
                <para>




More information about the seam-commits mailing list