[seam-commits] Seam SVN: r8145 - in trunk: ui/src/main/config/component and 1 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Fri May 9 12:31:27 EDT 2008


Author: pete.muir at jboss.org
Date: 2008-05-09 12:31:27 -0400 (Fri, 09 May 2008)
New Revision: 8145

Modified:
   trunk/build/root.pom.xml
   trunk/ui/src/main/config/component/atomicBooleanConverter.xml
   trunk/ui/src/main/config/component/atomicIntegerConverter.xml
   trunk/ui/src/main/config/component/atomicLongConverter.xml
   trunk/ui/src/main/config/component/convertDateTime.xml
   trunk/ui/src/main/config/component/convertEntity.xml
   trunk/ui/src/main/config/component/convertEnum.xml
   trunk/ui/src/main/config/component/modelValidator.xml
   trunk/ui/src/main/java/org/jboss/seam/ui/util/cdk/UIComponentTagBase.java
Log:
Upgrade to RF 3.2.1.CR3 (snapshot for CDK)

Modified: trunk/build/root.pom.xml
===================================================================
--- trunk/build/root.pom.xml	2008-05-09 14:04:54 UTC (rev 8144)
+++ trunk/build/root.pom.xml	2008-05-09 16:31:27 UTC (rev 8145)
@@ -15,12 +15,12 @@
       <name>JBoss Repository</name>
       <url>http://repository.jboss.org/maven2</url>
     </pluginRepository>
-    <!-- <pluginRepository>
+    <pluginRepository>
       <snapshots />
       <id>snapshots.jboss.org</id>
       <name>JBoss Snapshot Repository</name>
       <url>http://snapshots.jboss.org/maven2</url>
-      </pluginRepository>-->
+      </pluginRepository>
   </pluginRepositories>
   <repositories>
     <repository>
@@ -38,7 +38,7 @@
   
   <!-- Externalize some version numbers here -->
   <properties>
-    <version.richfaces>3.1.4.GA</version.richfaces>
+    <version.richfaces>3.2.1.CR3</version.richfaces>
     <version.wicket>1.3.3</version.wicket>
     <version.drools>4.0.4</version.drools>
   </properties>
@@ -1080,7 +1080,7 @@
         <plugin>
           <groupId>org.richfaces.cdk</groupId>
           <artifactId>maven-cdk-plugin</artifactId>
-          <version>${version.richfaces}</version>
+          <version>3.2.1-SNAPSHOT</version>
         </plugin>
 
         <!-- Packaging -->

Modified: trunk/ui/src/main/config/component/atomicBooleanConverter.xml
===================================================================
--- trunk/ui/src/main/config/component/atomicBooleanConverter.xml	2008-05-09 14:04:54 UTC (rev 8144)
+++ trunk/ui/src/main/config/component/atomicBooleanConverter.xml	2008-05-09 16:31:27 UTC (rev 8145)
@@ -2,7 +2,7 @@
 <!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN"  "http://jboss.org/jbossrichfaces/component-config.dtd" >
 <components>
 	<converter generate="false">
-		<name>org.jboss.seam.ui.AtomicBooleanConverter</name>
+		<id>org.jboss.seam.ui.AtomicBooleanConverter</id>
 		<classname>org.jboss.seam.ui.converter.AtomicBooleanConverter</classname>
 		<description>
 			<![CDATA[Converter for java.util.concurrent.atomic.AtomicBoolean]]>

Modified: trunk/ui/src/main/config/component/atomicIntegerConverter.xml
===================================================================
--- trunk/ui/src/main/config/component/atomicIntegerConverter.xml	2008-05-09 14:04:54 UTC (rev 8144)
+++ trunk/ui/src/main/config/component/atomicIntegerConverter.xml	2008-05-09 16:31:27 UTC (rev 8145)
@@ -2,7 +2,7 @@
 <!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN"  "http://jboss.org/jbossrichfaces/component-config.dtd" >
 <components>
 	<converter generate="false">
-		<name>org.jboss.seam.ui.AtomicIntegerConverter</name>
+		<id>org.jboss.seam.ui.AtomicIntegerConverter</id>
 		<classname>org.jboss.seam.ui.converter.AtomicIntegerConverter</classname>
 		<description>
 			<![CDATA[Converter for java.util.concurrent.atomic.AtomicInteger]]>

Modified: trunk/ui/src/main/config/component/atomicLongConverter.xml
===================================================================
--- trunk/ui/src/main/config/component/atomicLongConverter.xml	2008-05-09 14:04:54 UTC (rev 8144)
+++ trunk/ui/src/main/config/component/atomicLongConverter.xml	2008-05-09 16:31:27 UTC (rev 8145)
@@ -2,7 +2,7 @@
 <!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN"  "http://jboss.org/jbossrichfaces/component-config.dtd" >
 <components>
 	<converter generate="false">
-		<name>org.jboss.seam.ui.AtomicLongConverter</name>
+		<id>org.jboss.seam.ui.AtomicLongConverter</id>
 		<classname>org.jboss.seam.ui.converter.AtomicLongConverter</classname>
 		<description>
 			<![CDATA[Converter for java.util.concurrent.atomic.AtomicLong]]>

Modified: trunk/ui/src/main/config/component/convertDateTime.xml
===================================================================
--- trunk/ui/src/main/config/component/convertDateTime.xml	2008-05-09 14:04:54 UTC (rev 8144)
+++ trunk/ui/src/main/config/component/convertDateTime.xml	2008-05-09 16:31:27 UTC (rev 8145)
@@ -2,7 +2,7 @@
 <!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN"  "http://jboss.org/jbossrichfaces/component-config.dtd" >
 <components>
 	<converter generate="false">
-		<name>org.jboss.seam.ui.DateTimeConverter</name>
+		<id>org.jboss.seam.ui.DateTimeConverter</id>
 		<classname>org.jboss.seam.ui.converter.DateTimeConverter</classname>
 		<description>
 			<![CDATA[Perform date or time conversions in the Seam timezone.]]>

Modified: trunk/ui/src/main/config/component/convertEntity.xml
===================================================================
--- trunk/ui/src/main/config/component/convertEntity.xml	2008-05-09 14:04:54 UTC (rev 8144)
+++ trunk/ui/src/main/config/component/convertEntity.xml	2008-05-09 16:31:27 UTC (rev 8145)
@@ -2,7 +2,7 @@
 <!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN"  "http://jboss.org/jbossrichfaces/component-config.dtd" >
 <components>
 	<converter generate="false" >
-		<name>org.jboss.seam.ui.EntityConverter</name>
+		<id>org.jboss.seam.ui.EntityConverter</id>
 		<classname>org.jboss.seam.ui.EntityConverter</classname>
 		<description>
 			<![CDATA[Convert an entity.]]>

Modified: trunk/ui/src/main/config/component/convertEnum.xml
===================================================================
--- trunk/ui/src/main/config/component/convertEnum.xml	2008-05-09 14:04:54 UTC (rev 8144)
+++ trunk/ui/src/main/config/component/convertEnum.xml	2008-05-09 16:31:27 UTC (rev 8145)
@@ -2,7 +2,7 @@
 <!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN"  "http://jboss.org/jbossrichfaces/component-config.dtd" >
 <components>
 	<converter generate="false">
-		<name>org.jboss.seam.ui.EnumConverter</name>
+		<id>org.jboss.seam.ui.EnumConverter</id>
 		<classname>org.jboss.seam.ui.converter.EnumConverter</classname>
 		<description>
 			<![CDATA[Convert an enum.]]>

Modified: trunk/ui/src/main/config/component/modelValidator.xml
===================================================================
--- trunk/ui/src/main/config/component/modelValidator.xml	2008-05-09 14:04:54 UTC (rev 8144)
+++ trunk/ui/src/main/config/component/modelValidator.xml	2008-05-09 16:31:27 UTC (rev 8145)
@@ -2,7 +2,7 @@
 <!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN"  "http://jboss.org/jbossrichfaces/component-config.dtd" >
 <components>
 	<validator generate="false">
-		<name>org.jboss.seam.ui.ModelValidator</name>
+		<id>org.jboss.seam.ui.ModelValidator</id>
 		<classname>org.jboss.seam.ui.validator.ModelValidator</classname>
 		<description>
 			<![CDATA[Validate the JSF component against the model]]>

Modified: trunk/ui/src/main/java/org/jboss/seam/ui/util/cdk/UIComponentTagBase.java
===================================================================
--- trunk/ui/src/main/java/org/jboss/seam/ui/util/cdk/UIComponentTagBase.java	2008-05-09 14:04:54 UTC (rev 8144)
+++ trunk/ui/src/main/java/org/jboss/seam/ui/util/cdk/UIComponentTagBase.java	2008-05-09 16:31:27 UTC (rev 8145)
@@ -1,365 +1,166 @@
 /**
- * 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.util.cdk;
 
-import javax.faces.component.ActionSource;
-import javax.faces.component.EditableValueHolder;
+import javax.el.ExpressionFactory;
+import javax.el.MethodExpression;
+import javax.el.ValueExpression;
 import javax.faces.component.UICommand;
 import javax.faces.component.UIComponent;
 import javax.faces.component.UIGraphic;
 import javax.faces.component.UIParameter;
 import javax.faces.component.UISelectBoolean;
 import javax.faces.component.ValueHolder;
-import javax.faces.context.FacesContext;
-import javax.faces.convert.Converter;
-import javax.faces.el.MethodBinding;
-import javax.faces.el.ValueBinding;
 import javax.faces.event.ActionEvent;
 import javax.faces.event.ValueChangeEvent;
-import javax.faces.webapp.UIComponentTag;
 
-/**
- * Base class with utility functions for all JSF tags. Get from apache MyFaces
- * @author asmirnov at exadel.com (latest modification by $Author$)
- * @version $Revision$ $Date$
- *
- */
+import org.richfaces.webapp.taglib.UIComponentELTagBase;
+
 @Deprecated
-public abstract class UIComponentTagBase extends UIComponentTag {
+public abstract class UIComponentTagBase extends UIComponentELTagBase {
 
-    //Special UIComponent attributes (ValueHolder, ConvertibleValueHolder)
-    private String _value;
-    private String _converter;
-    //attributes id, rendered and binding are handled by UIComponentTag
+   protected ExpressionFactory getExpressionFactory() {
+      return getFacesContext().getApplication().getExpressionFactory();
+   }
 
-    /**
-    * @param converter The converter to set.
-    */
-   public void setConverter(String converter) {
-      _converter = converter;
+   protected void setProperty(UIComponent component, String propName, ValueExpression valueExpression) {
+      if (valueExpression != null) {
+         if (valueExpression.isLiteralText()) {
+            component.getAttributes().put(propName,valueExpression.getValue(getELContext()));
+         } else {
+            component.setValueExpression(propName, valueExpression);
+         }
+      }
    }
+   
+   protected void setProperty(UIComponent component, Class<?> type,
+         String propName, String value) {
+      if (value != null) {
+         ValueExpression valueExpression = getExpressionFactory()
+               .createValueExpression(getELContext(), value, type);
+         setProperty(component, propName, valueExpression);
+      }
+   }
 
-   /**
-    * @param value The value to set.
-    */
-   public void setValue(String value) {
-      _value = value;
+   protected void setIntegerProperty(UIComponent component, String propName,
+         ValueExpression value) {
+      setProperty(component, propName, value);
    }
 
-   @Override
-   public void release() {
-        super.release();
+   protected void setLongProperty(UIComponent component, String propName,
+         ValueExpression value) {
+      setProperty(component, propName, value);
+   }
 
-        _value=null;
-        _converter=null;
-    }
+   protected void setFloatProperty(UIComponent component, String propName,
+         ValueExpression value) {
+      setProperty(component, propName, value);
+   }
 
-    @Override
-   protected void setProperties(UIComponent component)
-    {
-        super.setProperties(component);
+   protected void setDoubleProperty(UIComponent component, String propName,
+         ValueExpression value) {
+      setProperty(component, propName, value);
+   }
 
+   protected void setStringProperty(UIComponent component, String propName,
+         ValueExpression value) {
+      setProperty(component, propName, value);
+   }
 
-        //rendererType already handled by UIComponentTag
+   protected void setBooleanProperty(UIComponent component, String propName,
+         ValueExpression value) {
+      setProperty(component, propName, value);
+   }
 
-        setValueProperty(component, _value);
-        setConverterProperty(component, _converter);
-    }
+   protected void setIntegerProperty(UIComponent component, String propName,
+         String value) {
+      setProperty(component, Integer.class, propName, value);
+   }
 
+   protected void setLongProperty(UIComponent component, String propName,
+         String value) {
+      setProperty(component, Long.class, propName, value);
+   }
 
-    private static final Class[] VALIDATOR_ARGS = {FacesContext.class,
-                                                   UIComponent.class,
-                                                   Object.class};
-    private static final Class[] ACTION_LISTENER_ARGS = {ActionEvent.class};
-    private static final Class[] VALUE_LISTENER_ARGS = {ValueChangeEvent.class};
+   protected void setFloatProperty(UIComponent component, String propName,
+         String value) {
+      setProperty(component, Float.class, propName, value);
+   }
 
-    protected void setCharterProperty(UIComponent component, String propName, String value)
-    {
-        if (value != null)
-        {
-            if (isValueReference(value))
-            {
-                ValueBinding vb = getFacesContext().getApplication().createValueBinding(value);
-                component.setValueBinding(propName, vb);
-            }
-            else
-            {
-                //FIXME: should use converter maybe?
-                component.getAttributes().put(propName, new Character(value.charAt(0)));
-            }
-        }
-    }
-    protected void setIntegerProperty(UIComponent component, String propName, String value)
-    {
-        if (value != null)
-        {
-            if (isValueReference(value))
-            {
-                ValueBinding vb = getFacesContext().getApplication().createValueBinding(value);
-                component.setValueBinding(propName, vb);
-            }
-            else
-            {
-                //FIXME: should use converter maybe?
-                component.getAttributes().put(propName, Integer.valueOf(value));
-            }
-        }
-    }
+   protected void setDoubleProperty(UIComponent component, String propName,
+         String value) {
+      setProperty(component, Double.class, propName, value);
+   }
 
-    protected void setLongProperty(UIComponent component, String propName, String value)
-    {
-        if (value != null)
-        {
-            if (isValueReference(value))
-            {
-                ValueBinding vb = getFacesContext().getApplication().createValueBinding(value);
-                component.setValueBinding(propName, vb);
-            }
-            else
-            {
-                //FIXME: should use converter maybe?
-                component.getAttributes().put(propName, Long.valueOf(value));
-            }
-        }
-    }
+   protected void setStringProperty(UIComponent component, String propName,
+         String value) {
+      setProperty(component, String.class, propName, value);
+   }
 
-    protected void setFloatProperty(UIComponent component, String propName, String value)
-    {
-        if (value != null)
-        {
-            if (isValueReference(value))
-            {
-                ValueBinding vb = getFacesContext().getApplication().createValueBinding(value);
-                component.setValueBinding(propName, vb);
-            }
-            else
-            {
-                //FIXME: should use converter maybe?
-                component.getAttributes().put(propName, Float.valueOf(value));
-            }
-        }
-    }
-    protected void setDoubleProperty(UIComponent component, String propName, String value)
-    {
-        if (value != null)
-        {
-            if (isValueReference(value))
-            {
-                ValueBinding vb = getFacesContext().getApplication().createValueBinding(value);
-                component.setValueBinding(propName, vb);
-            }
-            else
-            {
-                //FIXME: should use converter maybe?
-                component.getAttributes().put(propName, Double.valueOf(value));
-            }
-        }
-    }
-    
-    protected void setStringProperty(UIComponent component, String propName, String value)
-    {
-        if (value != null)
-        {
-            if (isValueReference(value))
-            {
-                ValueBinding vb = getFacesContext().getApplication().createValueBinding(value);
-                component.setValueBinding(propName, vb);
-            }
-            else
-            {
-                //TODO: Warning if component has no such property (with reflection)
-                component.getAttributes().put(propName, value);
-            }
-        }
-    }
+   protected void setBooleanProperty(UIComponent component, String propName,
+         String value) {
+      setProperty(component, Boolean.class, propName, value);
+   }
+   protected void setValueProperty(UIComponent component, String value) {
+      if (value != null) {
+         ValueExpression expression = getExpressionFactory()
+               .createValueExpression(getELContext(), value, Object.class);
 
-    protected void setBooleanProperty(UIComponent component, String propName, String value)
-    {
-        if (value != null)
-        {
-            if (isValueReference(value))
-            {
-                ValueBinding vb = getFacesContext().getApplication().createValueBinding(value);
-                component.setValueBinding(propName, vb);
-            }
-            else
-            {
-                //TODO: More sophisticated way to convert boolean value (yes/no, 1/0, on/off, etc.)
-                component.getAttributes().put(propName, Boolean.valueOf(value));
-            }
-        }
-    }
+         setValueProperty(component, expression);
+      }
+   }
+   protected void setValueProperty(UIComponent component, ValueExpression expression) {
+      if (expression != null) {
+         String value = expression.getExpressionString();
+         if (!expression.isLiteralText()) {
+            component.setValueExpression("value", expression);
+         } else if (component instanceof UICommand) {
+            ((UICommand) component).setValue(value);
+         } else if (component instanceof UIParameter) {
+            ((UIParameter) component).setValue(value);
+         } else if (component instanceof UISelectBoolean) {
+            ((UISelectBoolean) component).setValue(Boolean.valueOf(value));
+         } else if (component instanceof UIGraphic) {
+            ((UIGraphic) component).setValue(value);
+         }
+         // Since many input components are ValueHolders the special
+         // components
+         // must come first, ValueHolder is the last resort.
+         else if (component instanceof ValueHolder) {
+            ((ValueHolder) component).setValue(value);
+         } else {
+            component.getAttributes().put("value", value);
+         }
+      }
+   }
 
-    protected void setValueProperty(UIComponent component, String value)
-    {
-        if (value != null)
-        {
-            if (isValueReference(value))
-            {
-                ValueBinding vb = getFacesContext().getApplication().createValueBinding(value);
-                component.setValueBinding("value", vb);
-            }
-            else if (component instanceof UICommand)
-            {
-                ((UICommand)component).setValue(value);
-            }
-            else if (component instanceof UIParameter)
-            {
-                ((UIParameter)component).setValue(value);
-            }
-            else if (component instanceof UISelectBoolean)
-            {
-                ((UISelectBoolean)component).setValue(Boolean.valueOf(value));
-            }
-            else if (component instanceof UIGraphic)
-            {
-                ((UIGraphic)component).setValue(value);
-            }
-            //Since many input components are ValueHolders the special components
-            //must come first, ValueHolder is the last resort.
-            else if (component instanceof ValueHolder)
-            {
-                ((ValueHolder)component).setValue(value);
-            }
-            else
-            {
-               component.getAttributes().put("value", value);
-            }
+   public boolean isValueReference(String s) {
+      return !getExpressionFactory().createValueExpression(s, Object.class).isLiteralText();
+   }
+   
+    protected void setActionProperty(UIComponent component, String action) {
+        if (action != null) {
+         MethodExpression expression = 
+            getExpressionFactory().createMethodExpression(getELContext(), action, String.class, new Class[] {});
+         setActionProperty(component, expression);
         }
     }
 
-    protected void setConverterProperty(UIComponent component, String value)
-    {
-        if (value != null)
-        {
-            if (component instanceof ValueHolder)
-            {
-                if (isValueReference(value))
-                {
-                    ValueBinding vb = getFacesContext().getApplication().createValueBinding(value);
-                    component.setValueBinding("converter", vb);
-                }
-                else
-                {
-                    FacesContext facesContext = FacesContext.getCurrentInstance();
-                    Converter converter = facesContext.getApplication().createConverter(value);
-                    ((ValueHolder)component).setConverter(converter);
-                }
-            }
-
+    protected void setActionListenerProperty(UIComponent component, String actionListener){
+        if (actionListener != null) {
+         MethodExpression expression = 
+            getExpressionFactory().createMethodExpression(getELContext(), actionListener, String.class, new Class[] {ActionEvent.class});
+         setActionListenerProperty(component, expression);
         }
     }
 
-    protected void setValidatorProperty(UIComponent component, String validator)
-    {
-        if (validator != null)
-        {
-            if (!(component instanceof EditableValueHolder))
-            {
-                throw new IllegalArgumentException();
-            }
-            if (isValueReference(validator))
-            {
-                MethodBinding mb = getFacesContext().getApplication().createMethodBinding(validator,
-                                                                                VALIDATOR_ARGS);
-                ((EditableValueHolder)component).setValidator(mb);
-            }
-
+    protected void setValueChangedListenerProperty(UIComponent component, String valueChangedListener) {
+        if (valueChangedListener != null) {
+         MethodExpression expression = 
+            getExpressionFactory().createMethodExpression(getELContext(), valueChangedListener, String.class, new Class[] {ValueChangeEvent.class});
+         setValueChangeListenerProperty(component, expression);
         }
     }
 
-    protected void setActionProperty(UIComponent component, String action)
-    {
-        if (action != null)
-        {
-            if (!(component instanceof ActionSource))
-            {
-                throw new IllegalArgumentException();
-            }
-            MethodBinding mb;
-            if (isValueReference(action))
-            {
-                mb = getFacesContext().getApplication().createMethodBinding(action, null);
-            }
-            else
-            {
-                mb = new SimpleActionMethodBinding(action);
-            }
-            ((ActionSource)component).setAction(mb);
-        }
-    }
-
-    protected void setActionListenerProperty(UIComponent component, String actionListener)
-    {
-        if (actionListener != null)
-        {
-            if (!(component instanceof ActionSource))
-            {
-                throw new IllegalArgumentException();
-            }
-            if (isValueReference(actionListener))
-            {
-                MethodBinding mb = getFacesContext().getApplication().createMethodBinding(actionListener,
-                                                                                ACTION_LISTENER_ARGS);
-                ((ActionSource)component).setActionListener(mb);
-            }
-
-        }
-    }
-
-    protected void setValueChangedListenerProperty(UIComponent component, String valueChangedListener)
-    {
-        if (valueChangedListener != null)
-        {
-            if (!(component instanceof EditableValueHolder))
-            {
-                throw new IllegalArgumentException();
-            }
-            if (isValueReference(valueChangedListener))
-            {
-                MethodBinding mb = getFacesContext().getApplication().createMethodBinding(valueChangedListener,
-                                                                                VALUE_LISTENER_ARGS);
-                ((EditableValueHolder)component).setValueChangeListener(mb);
-            }
-
-        }
-    }
-
-    protected void setValueBinding(UIComponent component,
-                                   String propName,
-                                   String value)
-    {
-        if (value != null)
-        {
-            if (isValueReference(value))
-            {
-                ValueBinding vb = getFacesContext().getApplication().createValueBinding(value);
-                component.setValueBinding(propName, vb);
-            }
-
-        }
-    }
-
-
-
 }
-




More information about the seam-commits mailing list