[jboss-cvs] jboss-seam/seam-ui-cdk/jboss-seam-ui/src/main/java/org/jboss/seam/ui/converter ...

Peter Muir peter at bleepbleep.org.uk
Tue May 8 10:07:26 EDT 2007


  User: pmuir   
  Date: 07/05/08 10:07:26

  Modified:    seam-ui-cdk/jboss-seam-ui/src/main/java/org/jboss/seam/ui/converter     
                        EnumConverter.java EntityConverter.java
  Added:       seam-ui-cdk/jboss-seam-ui/src/main/java/org/jboss/seam/ui/converter     
                        DateTimeConverter.java
  Removed:     seam-ui-cdk/jboss-seam-ui/src/main/java/org/jboss/seam/ui/converter     
                        EntityConverterStore.java ConvertDateTimeBase.java
  Log:
  Updates for CDK port
  
  Revision  Changes    Path
  1.2       +42 -24    jboss-seam/seam-ui-cdk/jboss-seam-ui/src/main/java/org/jboss/seam/ui/converter/EnumConverter.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: EnumConverter.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/seam-ui-cdk/jboss-seam-ui/src/main/java/org/jboss/seam/ui/converter/EnumConverter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- EnumConverter.java	20 Mar 2007 17:58:58 -0000	1.1
  +++ EnumConverter.java	8 May 2007 14:07:26 -0000	1.2
  @@ -1,31 +1,49 @@
   package org.jboss.seam.ui.converter;
   
  -import javax.faces.component.*;
  -import javax.faces.context.*;
  -import javax.faces.convert.*;
  +import static org.jboss.seam.InterceptionType.NEVER;
  +import static org.jboss.seam.annotations.Install.BUILT_IN;
   
  -public class EnumConverter
  -    implements Converter
  +import javax.faces.component.StateHolder;
  +import javax.faces.component.UIComponent;
  +import javax.faces.context.FacesContext;
  +import javax.faces.convert.ConverterException;
  +
  +import org.jboss.seam.ScopeType;
  +import org.jboss.seam.annotations.Install;
  +import org.jboss.seam.annotations.Intercept;
  +import org.jboss.seam.annotations.Name;
  +import org.jboss.seam.annotations.Scope;
  +import org.jboss.seam.annotations.jsf.Converter;
  +
  + at Name("org.jboss.seam.ui.EnumConverter")
  + at Scope(ScopeType.EVENT)
  + at Install(precedence = BUILT_IN)
  + at Converter
  + at Intercept(NEVER)
  +public abstract class EnumConverter implements javax.faces.convert.Converter, StateHolder
   {
  -    public Object getAsObject(FacesContext context,
  -                              UIComponent comp,
  -                              String value)
  +   public Object getAsObject(FacesContext context, UIComponent comp, String value)
           throws ConverterException
       {
           Class enumType = comp.getValueBinding("value").getType(context);
           return Enum.valueOf(enumType, value);
       }
   
  -    public String getAsString(FacesContext context,
  -                              UIComponent component,
  -                              Object object)
  +   public String getAsString(FacesContext context, UIComponent component, Object object)
           throws ConverterException
       {
  -        if (object == null) {
  +      if (object == null)
  +      {
               return null;
           }
   
           return ((Enum) object).name();
       }
   
  +   public Object saveState(FacesContext context)
  +   {
  +      // TODO Auto-generated method stub
  +      return null;
  +   }
  +
   }
  
  
  
  1.2       +2 -1      jboss-seam/seam-ui-cdk/jboss-seam-ui/src/main/java/org/jboss/seam/ui/converter/EntityConverter.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: EntityConverter.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/seam-ui-cdk/jboss-seam-ui/src/main/java/org/jboss/seam/ui/converter/EntityConverter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- EntityConverter.java	20 Mar 2007 17:58:58 -0000	1.1
  +++ EntityConverter.java	8 May 2007 14:07:26 -0000	1.2
  @@ -27,6 +27,7 @@
   import org.jboss.seam.core.Expressions.ValueBinding;
   import org.jboss.seam.log.Log;
   import org.jboss.seam.log.Logging;
  +import org.jboss.seam.ui.core.EntityConverterStore;
   import org.jboss.seam.util.Reflections;
   
   /**
  @@ -35,7 +36,7 @@
    * 
    * 
    */
  - at Name("org.jboss.seam.ui.entityConverter")
  + at Name("org.jboss.seam.ui.EntityConverter")
   @Scope(ScopeType.CONVERSATION)
   @Install(precedence = BUILT_IN)
   @Converter
  
  
  
  1.1      date: 2007/05/08 14:07:26;  author: pmuir;  state: Exp;jboss-seam/seam-ui-cdk/jboss-seam-ui/src/main/java/org/jboss/seam/ui/converter/DateTimeConverter.java
  
  Index: DateTimeConverter.java
  ===================================================================
  /**
   * License Agreement.
   *
   * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
   *
   * Copyright (C) 2007 Exadel, Inc.
   *
   * This library is free software; you can redistribute it and/or
   * modify it under the terms of the GNU Lesser General Public
   * License version 2.1 as published by the Free Software Foundation.
   *
   * This library is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   * Lesser General Public License for more details.
   *
   * You should have received a copy of the GNU Lesser General Public
   * License along with this library; if not, write to the Free Software
   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
   */
  
  package org.jboss.seam.ui.converter;
  
  import java.util.TimeZone;
  
  import org.jboss.seam.InterceptionType;
  import org.jboss.seam.ScopeType;
  import org.jboss.seam.annotations.Install;
  import org.jboss.seam.annotations.Intercept;
  import org.jboss.seam.annotations.Name;
  import org.jboss.seam.annotations.Scope;
  import org.jboss.seam.annotations.jsf.Converter;
  import org.jboss.seam.contexts.Contexts;
  
  @Name("org.jboss.seam.ui.DateTimeConverter")
  @Scope(ScopeType.EVENT)
  @Intercept(InterceptionType.NEVER)
  @Converter
  @Install(precedence=Install.BUILT_IN)
  public class DateTimeConverter extends javax.faces.convert.DateTimeConverter{
  	
  	private static final String CONVERTER_ID = "org.jboss.seam.ui.DateTimeConverter";
  	
     public DateTimeConverter()
     {
        setTimeZone( getTimeZone() );
     }
  
     @Override
     public TimeZone getTimeZone()
     {
        if ( Contexts.isApplicationContextActive() )
        {
           return org.jboss.seam.core.TimeZone.instance();
        }
        else
        {
           return TimeZone.getDefault();
        }
     }
     
  }
  
  
  



More information about the jboss-cvs-commits mailing list