[jboss-cvs] jboss-seam/src/ui/org/jboss/seam/ui ...

Peter Muir peter at bleepbleep.org.uk
Wed Feb 21 14:03:06 EST 2007


  User: pmuir   
  Date: 07/02/21 14:03:06

  Modified:    src/ui/org/jboss/seam/ui   UISelectItems.java
                        ConverterChain.java
  Log:
  JBSEAM-890
  
  Revision  Changes    Path
  1.9       +8 -1      jboss-seam/src/ui/org/jboss/seam/ui/UISelectItems.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: UISelectItems.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/ui/org/jboss/seam/ui/UISelectItems.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -b -r1.8 -r1.9
  --- UISelectItems.java	18 Feb 2007 20:49:16 -0000	1.8
  +++ UISelectItems.java	21 Feb 2007 19:03:06 -0000	1.9
  @@ -8,6 +8,7 @@
   import javax.faces.FacesException;
   import javax.faces.component.ValueHolder;
   import javax.faces.context.FacesContext;
  +import javax.faces.convert.Converter;
   import javax.faces.el.ValueBinding;
   import javax.faces.model.DataModel;
   
  @@ -258,7 +259,13 @@
            NullableSelectItem s = new NullableSelectItem(NO_SELECTION_VALUE, getNoSelectionLabel());
            selectItems.add(s);
            ConverterChain converterChain = new ConverterChain(this.getParent());
  -         converterChain.addConverterToChain(new NoSelectionConverter(), ConverterChain.CHAIN_START);
  +         
  +
  +         Converter noSelectionConverter = new NoSelectionConverter();
  +         // Make sure that the converter is only added once
  +         if (!converterChain.containsConverterType(noSelectionConverter)) {
  +            converterChain.addConverterToChain(noSelectionConverter, ConverterChain.CHAIN_START);
  +         }
            return true;
         }
         else
  
  
  
  1.7       +29 -16    jboss-seam/src/ui/org/jboss/seam/ui/ConverterChain.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ConverterChain.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/ui/org/jboss/seam/ui/ConverterChain.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -b -r1.6 -r1.7
  --- ConverterChain.java	18 Feb 2007 19:43:17 -0000	1.6
  +++ ConverterChain.java	21 Feb 2007 19:03:06 -0000	1.7
  @@ -68,6 +68,8 @@
         if (component instanceof ValueHolder)
         {
            ValueHolder valueHolder = (ValueHolder) component;
  +         if (!(valueHolder.getConverter() instanceof ConverterChain)) 
  +         {
            ValueBinding converterValueBinding = component.getValueBinding("converter");
            if (converterValueBinding != null)
            {
  @@ -90,6 +92,7 @@
            valueHolder.setConverter(this);
         }
      }
  +   }
   
      public Object getAsObject(FacesContext context, UIComponent component, String value)
               throws ConverterException
  @@ -206,4 +209,14 @@
         }
         return converters;
      }
  +   
  +   public boolean containsConverterType(Converter converter) {
  +      // TODO Improve this
  +      for (Converter c : converters) {
  +         if (c.getClass().equals(converter)) {
  +            return true;
  +         }
  +      }
  +      return false;
  +   }
   }
  \ No newline at end of file
  
  
  



More information about the jboss-cvs-commits mailing list