You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2011/11/16 00:54:38 UTC

svn commit: r1202479 - in /myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib: ./ core/ html/

Author: lu4242
Date: Tue Nov 15 23:54:37 2011
New Revision: 1202479

URL: http://svn.apache.org/viewvc?rev=1202479&view=rev
Log:
synch with impl shared

Added:
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentBodyELTagBase.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentBodyTagBase.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentELTagBase.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentELTagUtils.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentTagBase.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentTagUtils.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/core/
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/html/

Added: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentBodyELTagBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentBodyELTagBase.java?rev=1202479&view=auto
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentBodyELTagBase.java (added)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentBodyELTagBase.java Tue Nov 15 23:54:37 2011
@@ -0,0 +1,264 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.shared.taglib;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.el.MethodExpression;
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
+import javax.faces.webapp.UIComponentELTag;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.BodyContent;
+
+/**
+ * @author Manfred Geiler (latest modification by $Author: lu4242 $)
+ * @version $Revision: 1151650 $ $Date: 2011-07-27 17:14:17 -0500 (Wed, 27 Jul 2011) $
+ */
+public abstract class UIComponentBodyELTagBase extends UIComponentELTag
+{
+    //private static final Log log = LogFactory.getLog(UIComponentBodyTagBase.class);
+    private static final Logger log = Logger.getLogger(UIComponentBodyTagBase.class.getName());
+
+    public int doEndTag() throws JspException
+    {
+        if (log.isLoggable(Level.WARNING))
+        {
+            UIComponent component = getComponentInstance();
+            if (component != null &&
+                component.getRendersChildren() &&
+                !isBodyContentEmpty())
+            {
+                log.warning("Component with id '" + component.getClientId(getFacesContext()) +
+                         "' (" + getClass().getName() +
+                         " tag) and path : "+org.apache.myfaces.shared.renderkit.RendererUtils.getPathToComponent(component)+"renders it's children, but has embedded JSP or HTML code. Use the <f:verbatim> tag for nested HTML. For comments use <%/* */%> style JSP comments instead of <!-- --> style HTML comments." +
+                         "\n BodyContent:\n" + getBodyContent().getString().trim());
+            }
+        }
+        return super.doEndTag();
+    }
+
+    /**
+     * TODO: Ignore <!-- --> comments
+     */
+    private boolean isBodyContentEmpty()
+    {
+        BodyContent bodyContent = getBodyContent();
+        if (bodyContent == null)
+        {
+            return true;
+        }
+        try
+        {
+            Reader reader = bodyContent.getReader();
+            int c;
+            while ((c = reader.read()) != -1)
+            {
+                if (!Character.isWhitespace((char)c))
+                {
+                    return false;
+                }
+            }
+            return true;
+        }
+        catch (IOException e)
+        {
+            log.log(Level.SEVERE, "Error inspecting BodyContent", e);
+            return false;
+        }
+    }
+
+    //-------- rest is identical to UIComponentTagBase ------------------
+
+    //UIComponent attributes
+    private ValueExpression _forceId;
+    private ValueExpression _forceIdIndex;
+    private static final Boolean DEFAULT_FORCE_ID_INDEX_VALUE = Boolean.TRUE;
+
+    //Special UIComponent attributes (ValueHolder, ConvertibleValueHolder)
+    private ValueExpression _value;
+    private ValueExpression _converter;
+    //attributes id, rendered and binding are handled by UIComponentTag
+
+    protected void setProperties(UIComponent component)
+    {
+        super.setProperties(component);
+
+        setBooleanProperty(component, org.apache.myfaces.shared.renderkit.JSFAttr.FORCE_ID_ATTR, _forceId);
+        setBooleanProperty(component, org.apache.myfaces.shared.renderkit.JSFAttr.FORCE_ID_INDEX_ATTR, _forceIdIndex, DEFAULT_FORCE_ID_INDEX_VALUE);
+
+        //rendererType already handled by UIComponentTag
+
+        setValueProperty(component, _value);
+        setConverterProperty(component, _converter);
+    }
+
+    /**
+     * Sets the forceId attribute of the tag.  NOTE: Not every tag that extends this class will
+     * actually make use of this attribute.  Check the TLD to see which components actually
+     * implement it.
+     *
+     * @param aForceId The value of the forceId attribute.
+     */
+    public void setForceId(ValueExpression aForceId)
+    {
+        _forceId = aForceId;
+    }
+
+    /**
+     * Sets the forceIdIndex attribute of the tag.  NOTE: Not every tag that extends this class will
+     * actually make use of this attribute.  Check the TLD to see which components actually implement it.
+     *
+     * @param aForceIdIndex The value of the forceIdIndex attribute.
+     */
+    public void setForceIdIndex(ValueExpression aForceIdIndex)
+    {
+        _forceIdIndex = aForceIdIndex;
+    }
+
+    public void setValue(ValueExpression value)
+    {
+        _value = value;
+    }
+
+    public void setConverter(ValueExpression converter)
+    {
+        _converter = converter;
+    }
+
+
+
+    // sub class helpers
+    
+    protected void setIntegerProperty(UIComponent component, String propName, ValueExpression value)
+    {
+        UIComponentELTagUtils.setIntegerProperty(component, propName, value);
+    }
+    
+    @Deprecated
+    protected void setIntegerProperty(UIComponent component, String propName, String value)
+    {
+        UIComponentTagUtils.setIntegerProperty(getFacesContext(), component, propName, value);
+    }
+    
+    protected void setStringProperty(UIComponent component, String propName, ValueExpression value)
+    {
+        UIComponentELTagUtils.setStringProperty(component, propName, value);
+    }
+
+    @Deprecated
+    protected void setStringProperty(UIComponent component, String propName, String value)
+    {
+        UIComponentTagUtils.setStringProperty(getFacesContext(), component, propName, value);
+    }
+    
+    protected void setBooleanProperty(UIComponent component, String propName, ValueExpression value)
+    {
+        UIComponentELTagUtils.setBooleanProperty(component, propName, value);
+    }
+    
+    protected void setBooleanProperty(UIComponent component, String propName, ValueExpression value, Boolean defaultValue)
+    {
+        UIComponentELTagUtils.setBooleanProperty(component, propName, value, defaultValue);
+    }
+
+    @Deprecated
+    protected void setBooleanProperty(UIComponent component, String propName, String value)
+    {
+        UIComponentTagUtils.setBooleanProperty(getFacesContext(), component, propName, value);
+    }
+    
+    private void setValueProperty(UIComponent component, ValueExpression value)
+    {
+        UIComponentELTagUtils.setValueProperty(getFacesContext(), component, value);
+    }
+
+    @Deprecated
+    protected void setValueProperty(UIComponent component, String value)
+    {
+        UIComponentTagUtils.setValueProperty(getFacesContext(), component, value);
+    }
+    
+    private void setConverterProperty(UIComponent component, ValueExpression value)
+    {
+        UIComponentELTagUtils.setConverterProperty(getFacesContext(), component, value);
+    }
+
+
+    @Deprecated
+    private void setConverterProperty(UIComponent component, String value)
+    {
+        UIComponentTagUtils.setConverterProperty(getFacesContext(), component, value);
+    }
+    
+    protected void addValidatorProperty(UIComponent component, MethodExpression value)
+    {
+        UIComponentELTagUtils.addValidatorProperty(getFacesContext(), component, value);
+    }
+
+    @Deprecated
+    protected void setValidatorProperty(UIComponent component, String value)
+    {
+        UIComponentTagUtils.setValidatorProperty(getFacesContext(), component, value);
+    }
+    
+    protected void setActionProperty(UIComponent component, MethodExpression action)
+    {
+        UIComponentELTagUtils.setActionProperty(getFacesContext(), component, action);
+    }
+
+    @Deprecated
+    protected void setActionProperty(UIComponent component, String action)
+    {
+        UIComponentTagUtils.setActionProperty(getFacesContext(), component, action);
+    }
+    
+    protected void setActionListenerProperty(UIComponent component, MethodExpression actionListener)
+    {
+        UIComponentELTagUtils.addActionListenerProperty(getFacesContext(), component, actionListener);
+    }
+
+    @Deprecated
+    protected void setActionListenerProperty(UIComponent component, String actionListener)
+    {
+        UIComponentTagUtils.setActionListenerProperty(getFacesContext(), component, actionListener);
+    }
+    
+    protected void addValueChangedListenerProperty(UIComponent component, MethodExpression valueChangedListener)
+    {
+        UIComponentELTagUtils.addValueChangedListenerProperty(getFacesContext(), component, valueChangedListener);
+    }
+
+    @Deprecated
+    protected void setValueChangedListenerProperty(UIComponent component, String valueChangedListener)
+    {
+        UIComponentTagUtils.setValueChangedListenerProperty(getFacesContext(), component, valueChangedListener);
+    }
+
+    protected void setValueBinding(UIComponent component,
+            String propName,
+            ValueExpression value)
+    {
+        UIComponentELTagUtils.setValueBinding(getFacesContext(), component, propName, value);
+    }
+
+}

Added: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentBodyTagBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentBodyTagBase.java?rev=1202479&view=auto
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentBodyTagBase.java (added)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentBodyTagBase.java Tue Nov 15 23:54:37 2011
@@ -0,0 +1,205 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.shared.taglib;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.faces.component.UIComponent;
+import javax.faces.webapp.UIComponentBodyTag;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.BodyContent;
+
+import org.apache.myfaces.shared.renderkit.JSFAttr;
+
+/**
+ * @author Manfred Geiler (latest modification by $Author: lu4242 $)
+ * @version $Revision: 1151650 $ $Date: 2011-07-27 17:14:17 -0500 (Wed, 27 Jul 2011) $
+ * @deprecated use {@link UIComponentBodyELTagBase} instead
+ */
+public abstract class UIComponentBodyTagBase
+        extends UIComponentBodyTag
+{
+    //private static final Log log = LogFactory.getLog(UIComponentBodyTagBase.class);
+    private static final Logger log = Logger.getLogger(UIComponentBodyTagBase.class.getName());
+
+    public int doEndTag() throws JspException
+    {
+        if (log.isLoggable(Level.WARNING))
+        {
+            UIComponent component = getComponentInstance();
+            if (component != null &&
+                component.getRendersChildren() &&
+                !isBodyContentEmpty())
+            {
+                log.warning("Component with id '" + component.getClientId(getFacesContext()) +
+                         "' (" + getClass().getName() +
+                         " tag) and path : "+org.apache.myfaces.shared.renderkit.RendererUtils.getPathToComponent(component)+"renders it's children, but has embedded JSP or HTML code. Use the <f:verbatim> tag for nested HTML. For comments use <%/* */%> style JSP comments instead of <!-- --> style HTML comments." +
+                         "\n BodyContent:\n" + getBodyContent().getString().trim());
+            }
+        }
+        return super.doEndTag();
+    }
+
+    /**
+     * TODO: Ignore <!-- --> comments
+     */
+    private boolean isBodyContentEmpty()
+    {
+        BodyContent bodyContent = getBodyContent();
+        if (bodyContent == null)
+        {
+            return true;
+        }
+        try
+        {
+            Reader reader = bodyContent.getReader();
+            int c;
+            while ((c = reader.read()) != -1)
+            {
+                if (!Character.isWhitespace((char)c))
+                {
+                    return false;
+                }
+            }
+            return true;
+        }
+        catch (IOException e)
+        {
+            log.log(Level.SEVERE, "Error inspecting BodyContent", e);
+            return false;
+        }
+    }
+
+    //-------- rest is identical to UIComponentTagBase ------------------
+
+    //UIComponent attributes
+    private String _forceId;
+    private String _forceIdIndex = "true";
+
+    //Special UIComponent attributes (ValueHolder, ConvertibleValueHolder)
+    private String _value;
+    private String _converter;
+    //attributes id, rendered and binding are handled by UIComponentTag
+
+    protected void setProperties(UIComponent component)
+    {
+        super.setProperties(component);
+
+        setBooleanProperty(component, JSFAttr.FORCE_ID_ATTR, _forceId);
+        setBooleanProperty(component, org.apache.myfaces.shared.renderkit.JSFAttr.FORCE_ID_INDEX_ATTR, _forceIdIndex);
+
+        //rendererType already handled by UIComponentTag
+
+        setValueProperty(component, _value);
+        setConverterProperty(component, _converter);
+    }
+
+    /**
+     * Sets the forceId attribute of the tag.  NOTE: Not every tag that extends this class will
+     * actually make use of this attribute.  Check the TLD to see which components actually
+     * implement it.
+     *
+     * @param aForceId The value of the forceId attribute.
+     */
+    public void setForceId(String aForceId)
+    {
+        _forceId = aForceId;
+    }
+
+    /**
+     * Sets the forceIdIndex attribute of the tag.  NOTE: Not every tag that extends this class will
+     * actually make use of this attribute.  Check the TLD to see which components actually implement it.
+     *
+     * @param aForceIdIndex The value of the forceIdIndex attribute.
+     */
+    public void setForceIdIndex(String aForceIdIndex)
+    {
+        _forceIdIndex = aForceIdIndex;
+    }
+
+    public void setValue(String value)
+    {
+        _value = value;
+    }
+
+    public void setConverter(String converter)
+    {
+        _converter = converter;
+    }
+
+
+
+    // sub class helpers
+
+    protected void setIntegerProperty(UIComponent component, String propName, String value)
+    {
+        UIComponentTagUtils.setIntegerProperty(getFacesContext(), component, propName, value);
+    }
+
+    protected void setStringProperty(UIComponent component, String propName, String value)
+    {
+        UIComponentTagUtils.setStringProperty(getFacesContext(), component, propName, value);
+    }
+
+    protected void setBooleanProperty(UIComponent component, String propName, String value)
+    {
+        UIComponentTagUtils.setBooleanProperty(getFacesContext(), component, propName, value);
+    }
+
+    protected void setValueProperty(UIComponent component, String value)
+    {
+        UIComponentTagUtils.setValueProperty(getFacesContext(), component, value);
+    }
+
+    private void setConverterProperty(UIComponent component, String value)
+    {
+        UIComponentTagUtils.setConverterProperty(getFacesContext(), component, value);
+    }
+
+    protected void setValidatorProperty(UIComponent component, String value)
+    {
+        UIComponentTagUtils.setValidatorProperty(getFacesContext(), component, value);
+    }
+
+    protected void setActionProperty(UIComponent component, String action)
+    {
+        UIComponentTagUtils.setActionProperty(getFacesContext(), component, action);
+    }
+
+    protected void setActionListenerProperty(UIComponent component, String actionListener)
+    {
+        UIComponentTagUtils.setActionListenerProperty(getFacesContext(), component, actionListener);
+    }
+
+    protected void setValueChangedListenerProperty(UIComponent component, String valueChangedListener)
+    {
+        UIComponentTagUtils.setValueChangedListenerProperty(getFacesContext(), component, valueChangedListener);
+    }
+
+    protected void setValueBinding(UIComponent component,
+                                   String propName,
+                                   String value)
+    {
+        UIComponentTagUtils.setValueBinding(getFacesContext(), component, propName, value);
+    }
+
+}

Added: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentELTagBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentELTagBase.java?rev=1202479&view=auto
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentELTagBase.java (added)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentELTagBase.java Tue Nov 15 23:54:37 2011
@@ -0,0 +1,304 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.shared.taglib;
+
+import org.apache.myfaces.shared.renderkit.JSFAttr;
+
+import javax.el.MethodExpression;
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
+import javax.faces.webapp.UIComponentELTag;
+
+/**
+ * @author Manfred Geiler (latest modification by $Author$)
+ * @author Bruno Aranda (JSR-252)
+ * @version $Revision$ $Date$
+ */
+public abstract class UIComponentELTagBase extends UIComponentELTag
+{
+    //private static final Log log = LogFactory.getLog(UIComponentTagBase.class);
+
+    //UIComponent attributes
+    private ValueExpression _forceId;
+
+    private ValueExpression _forceIdIndex;
+    private static final Boolean DEFAULT_FORCE_ID_INDEX_VALUE = Boolean.TRUE;
+
+    private ValueExpression _javascriptLocation;
+    private ValueExpression _imageLocation;
+    private ValueExpression _styleLocation;
+
+    //Special UIComponent attributes (ValueHolder, ConvertibleValueHolder)
+    private ValueExpression _value;
+    private ValueExpression _converter;
+
+    //attributes id, rendered and binding are handled by UIComponentTag
+
+    public void release()
+    {
+        super.release();
+
+        _forceId = null;
+        _forceIdIndex = null;
+
+        _value = null;
+        _converter = null;
+
+        _javascriptLocation = null;
+        _imageLocation = null;
+        _styleLocation = null;
+    }
+
+    protected void setProperties(UIComponent component)
+    {
+        super.setProperties(component);
+
+        setBooleanProperty(component,
+                org.apache.myfaces.shared.renderkit.JSFAttr.FORCE_ID_ATTR,
+                _forceId);
+        setBooleanProperty(
+                component,
+                org.apache.myfaces.shared.renderkit.JSFAttr.FORCE_ID_INDEX_ATTR,
+                _forceIdIndex, DEFAULT_FORCE_ID_INDEX_VALUE);
+        if (_javascriptLocation != null)
+        {
+            setStringProperty(component, JSFAttr.JAVASCRIPT_LOCATION,
+                    _javascriptLocation);
+        }
+        if (_imageLocation != null)
+        {
+            setStringProperty(component, JSFAttr.IMAGE_LOCATION, _imageLocation);
+        }
+        if (_styleLocation != null)
+        {
+            setStringProperty(component, JSFAttr.STYLE_LOCATION, _styleLocation);
+        }
+
+        //rendererType already handled by UIComponentTag
+
+        setValueProperty(component, _value);
+        setConverterProperty(component, _converter);
+    }
+
+    /**
+     * Sets the forceId attribute of the tag.  NOTE: Not every tag that extends this class will
+     * actually make use of this attribute.  Check the TLD to see which components actually
+     * implement it.
+     *
+     * @param aForceId The value of the forceId attribute.
+     */
+    public void setForceId(ValueExpression aForceId)
+    {
+        _forceId = aForceId;
+    }
+
+    /**
+     * Sets the forceIdIndex attribute of the tag.  NOTE: Not every tag that extends this class will
+     * actually make use of this attribute.  Check the TLD to see which components actually implement it.
+     *
+     * @param aForceIdIndex The value of the forceIdIndex attribute.
+     */
+    public void setForceIdIndex(ValueExpression aForceIdIndex)
+    {
+        _forceIdIndex = aForceIdIndex;
+    }
+
+    public void setValue(ValueExpression value)
+    {
+        _value = value;
+    }
+
+    public void setConverter(ValueExpression converter)
+    {
+        _converter = converter;
+    }
+
+    /**
+     * Sets the javascript location attribute of the tag.  NOTE: Not every tag that extends this class will
+     * actually make use of this attribute.  Check the TLD to see which components actually implement it.
+     *
+     * @param aJavascriptLocation The alternate javascript location to use.
+     */
+    public void setJavascriptLocation(ValueExpression aJavascriptLocation)
+    {
+        _javascriptLocation = aJavascriptLocation;
+    }
+
+    /**
+     * Sets the image location attribute of the tag.  NOTE: Not every tag that extends this class will
+     * actually make use of this attribute.  Check the TLD to see which components actually implement it.
+     *
+     * @param aImageLocation The alternate image location to use.
+     */
+    public void setImageLocation(ValueExpression aImageLocation)
+    {
+        _imageLocation = aImageLocation;
+    }
+
+    /**
+     * Sets the style location attribute of the tag.  NOTE: Not every tag that extends this class will
+     * actually make use of this attribute.  Check the TLD to see which components actually implement it.
+     *
+     * @param aStyleLocation The alternate style location to use.
+     */
+    public void setStyleLocation(ValueExpression aStyleLocation)
+    {
+        _styleLocation = aStyleLocation;
+    }
+
+    // sub class helpers
+
+    protected void setIntegerProperty(UIComponent component, String propName,
+            ValueExpression value)
+    {
+        UIComponentELTagUtils.setIntegerProperty(component, propName, value);
+    }
+
+    protected void setIntegerProperty(UIComponent component, String propName,
+            ValueExpression value, Integer defaultValue)
+    {
+        UIComponentELTagUtils.setIntegerProperty(component, propName, value,
+                defaultValue);
+    }
+
+    protected void setLongProperty(UIComponent component, String propName,
+            ValueExpression value)
+    {
+        UIComponentELTagUtils.setLongProperty(component, propName, value);
+    }
+
+    protected void setLongProperty(UIComponent component, String propName,
+            ValueExpression value, Long defaultValue)
+    {
+        UIComponentELTagUtils.setLongProperty(component, propName, value,
+                defaultValue);
+    }
+
+    @Deprecated
+    protected void setStringProperty(UIComponent component, String propName,
+            String value)
+    {
+        UIComponentTagUtils.setStringProperty(getFacesContext(), component,
+                propName, value);
+    }
+
+    protected void setStringProperty(UIComponent component, String propName,
+            ValueExpression value)
+    {
+        UIComponentELTagUtils.setStringProperty(component, propName, value);
+    }
+
+    protected void setStringProperty(UIComponent component, String propName,
+            ValueExpression value, String defaultValue)
+    {
+        UIComponentELTagUtils.setStringProperty(component, propName, value,
+                defaultValue);
+    }
+
+    @Deprecated
+    protected void setBooleanProperty(UIComponent component, String propName,
+            String value)
+    {
+        UIComponentTagUtils.setBooleanProperty(getFacesContext(), component,
+                propName, value);
+    }
+
+    protected void setBooleanProperty(UIComponent component, String propName,
+            ValueExpression value)
+    {
+        UIComponentELTagUtils.setBooleanProperty(component, propName, value);
+    }
+
+    protected void setBooleanProperty(UIComponent component, String propName,
+            ValueExpression value, Boolean defaultValue)
+    {
+        UIComponentELTagUtils.setBooleanProperty(component, propName, value,
+                defaultValue);
+    }
+
+    private void setValueProperty(UIComponent component, ValueExpression value)
+    {
+        UIComponentELTagUtils.setValueProperty(getFacesContext(), component,
+                value);
+    }
+
+    private void setConverterProperty(UIComponent component,
+            ValueExpression value)
+    {
+        UIComponentELTagUtils.setConverterProperty(getFacesContext(),
+                component, value);
+    }
+
+    protected void addValidatorProperty(UIComponent component,
+            MethodExpression value)
+    {
+        UIComponentELTagUtils.addValidatorProperty(getFacesContext(),
+                component, value);
+    }
+
+    @Deprecated
+    protected void setActionProperty(UIComponent component, String action)
+    {
+        UIComponentTagUtils.setActionProperty(getFacesContext(), component,
+                action);
+    }
+
+    protected void setActionProperty(UIComponent component,
+            MethodExpression action)
+    {
+        UIComponentELTagUtils.setActionProperty(getFacesContext(), component,
+                action);
+    }
+
+    @Deprecated
+    protected void setActionListenerProperty(UIComponent component,
+            String actionListener)
+    {
+        UIComponentTagUtils.setActionListenerProperty(getFacesContext(),
+                component, actionListener);
+    }
+
+    protected void setActionListenerProperty(UIComponent component,
+            MethodExpression actionListener)
+    {
+        UIComponentELTagUtils.addActionListenerProperty(getFacesContext(),
+                component, actionListener);
+    }
+
+    protected void addValueChangedListenerProperty(UIComponent component,
+            MethodExpression valueChangedListener)
+    {
+        UIComponentELTagUtils.addValueChangedListenerProperty(
+                getFacesContext(), component, valueChangedListener);
+    }
+
+    protected void setValueBinding(UIComponent component, String propName,
+            ValueExpression value)
+    {
+        UIComponentELTagUtils.setValueBinding(getFacesContext(), component,
+                propName, value);
+    }
+
+    protected Object evaluateValueExpression(ValueExpression expression)
+    {
+        return UIComponentELTagUtils.evaluateValueExpression(getFacesContext()
+                .getELContext(), expression);
+    }
+
+}

Added: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentELTagUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentELTagUtils.java?rev=1202479&view=auto
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentELTagUtils.java (added)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentELTagUtils.java Tue Nov 15 23:54:37 2011
@@ -0,0 +1,417 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.shared.taglib;
+
+import java.util.logging.Logger;
+
+import javax.el.ELContext;
+import javax.el.MethodExpression;
+import javax.el.ValueExpression;
+import javax.faces.component.ActionSource2;
+import javax.faces.component.EditableValueHolder;
+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.event.MethodExpressionActionListener;
+import javax.faces.event.MethodExpressionValueChangeListener;
+import javax.faces.validator.MethodExpressionValidator;
+
+/**
+ * @author Manfred Geiler (latest modification by $Author$)
+ * @author Bruno Aranda (JSR-252)
+ * @version $Revision$ $Date$
+ *
+ * @since 1.2
+ */
+public class UIComponentELTagUtils
+{
+    //private static final Log log = LogFactory.getLog(UIComponentELTagUtils.class);
+    private static final Logger log = Logger
+            .getLogger(UIComponentELTagUtils.class.getName());
+
+    private UIComponentELTagUtils()
+    {
+    } //util class, no instantiation allowed
+
+    /**
+     * @since 1.2
+     */
+    public static void setIntegerProperty(UIComponent component,
+            String propName, ValueExpression value)
+    {
+        setIntegerProperty(component, propName, value, null);
+    }
+
+    /**
+     * @since 1.2
+     */
+    public static void setIntegerProperty(UIComponent component,
+            String propName, ValueExpression value, Integer defaultValue)
+    {
+        if (value != null)
+        {
+            if (value.isLiteralText())
+            {
+                component.getAttributes().put(propName,
+                        Integer.valueOf(value.getExpressionString()));
+            }
+            else
+            {
+                component.setValueExpression(propName, value);
+            }
+        }
+        else
+        {
+            if (defaultValue != null)
+            {
+                component.getAttributes().put(propName, defaultValue);
+            }
+        }
+    }
+
+    /**
+     * @since 1.2
+     */
+    public static void setLongProperty(UIComponent component, String propName,
+            ValueExpression value)
+    {
+        setLongProperty(component, propName, value, null);
+    }
+
+    /**
+     * @since 1.2
+     */
+    public static void setLongProperty(UIComponent component, String propName,
+            ValueExpression value, Long defaultValue)
+    {
+        if (value != null)
+        {
+            if (value.isLiteralText())
+            {
+                component.getAttributes().put(propName,
+                        Long.valueOf(value.getExpressionString()));
+            }
+            else
+            {
+                component.setValueExpression(propName, value);
+            }
+        }
+        else
+        {
+            if (defaultValue != null)
+            {
+                component.getAttributes().put(propName, defaultValue);
+            }
+        }
+    }
+
+    /**
+     * @since 1.2
+     */
+    public static void setStringProperty(UIComponent component,
+            String propName, ValueExpression value)
+    {
+        setStringProperty(component, propName, value, null);
+    }
+
+    /**
+     * @since 1.2
+     */
+    public static void setStringProperty(UIComponent component,
+            String propName, ValueExpression value, String defaultValue)
+    {
+        if (value != null)
+        {
+            if (value.isLiteralText())
+            {
+                component.getAttributes().put(propName,
+                        value.getExpressionString());
+            }
+            else
+            {
+                component.setValueExpression(propName, value);
+            }
+        }
+        else
+        {
+            if (defaultValue != null)
+            {
+                component.getAttributes().put(propName, defaultValue);
+            }
+        }
+    }
+
+    /**
+     * @since 1.2
+     */
+    public static void setBooleanProperty(UIComponent component,
+            String propName, ValueExpression value)
+    {
+        setBooleanProperty(component, propName, value, null);
+    }
+
+    /**
+     * @since 1.2
+     */
+    public static void setBooleanProperty(UIComponent component,
+            String propName, ValueExpression value, Boolean defaultValue)
+    {
+        if (value != null)
+        {
+            if (value.isLiteralText())
+            {
+                component.getAttributes().put(propName,
+                        Boolean.valueOf(value.getExpressionString()));
+            }
+            else
+            {
+                component.setValueExpression(propName, value);
+            }
+        }
+        else
+        {
+            if (defaultValue != null)
+            {
+                component.getAttributes().put(propName, defaultValue);
+            }
+        }
+    }
+
+    /**
+     * @since 1.2
+     */
+    public static void setValueProperty(FacesContext context,
+            UIComponent component, ValueExpression value)
+    {
+        if (value != null)
+        {
+            if (!value.isLiteralText())
+            {
+                component.setValueExpression(
+                        org.apache.myfaces.shared.renderkit.JSFAttr.VALUE_ATTR,
+                        value);
+            }
+            else if (component instanceof UICommand)
+            {
+                ((UICommand) component).setValue(value.getExpressionString());
+            }
+            else if (component instanceof UIParameter)
+            {
+                ((UIParameter) component).setValue(value.getExpressionString());
+            }
+            else if (component instanceof UISelectBoolean)
+            {
+                ((UISelectBoolean) component).setValue(Boolean.valueOf(value
+                        .getExpressionString()));
+            }
+            else if (component instanceof UIGraphic)
+            {
+                ((UIGraphic) component).setValue(value.getExpressionString());
+            }
+            //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.getExpressionString());
+            }
+            else
+            {
+                log.severe("Component " + component.getClass().getName()
+                        + " is no ValueHolder, cannot set value.");
+            }
+        }
+    }
+
+    /**
+     * @since 1.2
+     */
+    public static void setConverterProperty(FacesContext context,
+            UIComponent component, ValueExpression value)
+    {
+        if (value != null)
+        {
+            if (component instanceof ValueHolder)
+            {
+                if (value.isLiteralText())
+                {
+                    FacesContext facesContext = FacesContext
+                            .getCurrentInstance();
+                    Converter converter = facesContext.getApplication()
+                            .createConverter(value.getExpressionString());
+                    ((ValueHolder) component).setConverter(converter);
+                }
+                else
+                {
+                    component
+                            .setValueExpression(
+                                    org.apache.myfaces.shared.renderkit.JSFAttr.CONVERTER_ATTR,
+                                    value);
+                }
+            }
+            else
+            {
+                log.severe("Component " + component.getClass().getName()
+                        + " is no ValueHolder, cannot set value.");
+            }
+        }
+    }
+
+    /**
+     * @since 1.2
+     */
+    public static void addValidatorProperty(FacesContext context,
+            UIComponent component, MethodExpression validator)
+    {
+        if (validator != null)
+        {
+            if (!(component instanceof EditableValueHolder))
+            {
+                throw new IllegalArgumentException("Component "
+                        + component.getClientId(context)
+                        + " is no EditableValueHolder");
+            }
+
+            ((EditableValueHolder) component)
+                    .addValidator(new MethodExpressionValidator(validator));
+        }
+    }
+
+    /**
+     * @since 1.2
+     */
+    public static void setValueBinding(FacesContext context,
+            UIComponent component, String propName, ValueExpression value)
+    {
+        if (value != null)
+        {
+            if (!value.isLiteralText())
+            {
+                component.setValueExpression(propName, value);
+            }
+            else
+            {
+                throw new IllegalArgumentException("Component "
+                        + component.getClientId(context) + " attribute "
+                        + propName + " must be a value reference, was " + value);
+            }
+        }
+    }
+
+    /**
+     * @since 1.2
+     */
+    public static void setActionProperty(FacesContext context,
+            UIComponent component, MethodExpression action)
+    {
+        if (action != null)
+        {
+            if (!(component instanceof ActionSource2))
+            {
+                throw new IllegalArgumentException("Component "
+                        + component.getClientId(context)
+                        + " is no ActionSource2");
+            }
+
+            ((ActionSource2) component).setActionExpression(action);
+        }
+    }
+
+    /**
+     * @since 1.2
+     */
+    public static void addActionListenerProperty(FacesContext context,
+            UIComponent component, MethodExpression actionListener)
+    {
+        if (actionListener != null)
+        {
+            if (!(component instanceof ActionSource2))
+            {
+                throw new IllegalArgumentException("Component "
+                        + component.getClientId(context)
+                        + " is no ActionSource");
+            }
+
+            ((ActionSource2) component)
+                    .addActionListener(new MethodExpressionActionListener(
+                            actionListener));
+        }
+    }
+
+    /**
+     * @since 1.2
+     */
+    public static void addValueChangedListenerProperty(FacesContext context,
+            UIComponent component, MethodExpression valueChangedListener)
+    {
+        if (valueChangedListener != null)
+        {
+            if (!(component instanceof EditableValueHolder))
+            {
+                throw new IllegalArgumentException("Component "
+                        + component.getClientId(context)
+                        + " is no EditableValueHolder");
+            }
+
+            ((EditableValueHolder) component)
+                    .addValueChangeListener(new MethodExpressionValueChangeListener(
+                            valueChangedListener));
+        }
+    }
+
+    /**
+     * @since 1.2
+     */
+    public static Object evaluateValueExpression(ELContext elContext,
+            ValueExpression valueExpression)
+    {
+        return valueExpression.isLiteralText() ? valueExpression
+                .getExpressionString() : valueExpression.getValue(elContext);
+    }
+
+    /**
+     * @since 1.2
+     */
+    public static Boolean getBooleanValue(ELContext elContext,
+            ValueExpression valueExpression)
+    {
+        if (valueExpression.isLiteralText())
+        {
+            return Boolean.valueOf(valueExpression.getExpressionString());
+        }
+
+        return (Boolean) valueExpression.getValue(elContext);
+    }
+
+    public static Integer getIntegerValue(ELContext elContext,
+            ValueExpression valueExpression)
+    {
+        if (valueExpression.isLiteralText())
+        {
+            return Integer.valueOf(valueExpression.getExpressionString());
+        }
+
+        return (Integer) valueExpression.getValue(elContext);
+    }
+
+}

Added: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentTagBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentTagBase.java?rev=1202479&view=auto
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentTagBase.java (added)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentTagBase.java Tue Nov 15 23:54:37 2011
@@ -0,0 +1,208 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.shared.taglib;
+
+import org.apache.myfaces.shared.renderkit.JSFAttr;
+
+import javax.faces.component.UIComponent;
+import javax.faces.webapp.UIComponentTag;
+
+/**
+ * @author Manfred Geiler (latest modification by $Author: lu4242 $)
+ * @version $Revision: 1151650 $ $Date: 2011-07-27 17:14:17 -0500 (Wed, 27 Jul 2011) $
+ *
+ * @deprecated use {@link UIComponentELTagBase} instead
+ */
+public abstract class UIComponentTagBase
+        extends UIComponentTag
+{
+    //private static final Log log = LogFactory.getLog(UIComponentTagBase.class);
+
+    //UIComponent attributes
+    private String _forceId;
+    private String _forceIdIndex = "true";
+    private String _javascriptLocation;
+    private String _imageLocation;
+    private String _styleLocation;
+
+    //Special UIComponent attributes (ValueHolder, ConvertibleValueHolder)
+    private String _value;
+    private String _converter;
+    //attributes id, rendered and binding are handled by UIComponentTag
+
+    public void release() {
+        super.release();
+
+        _forceId=null;
+        //see declaration of that property
+        _forceIdIndex = "true";
+
+        _value=null;
+        _converter=null;
+        
+        _javascriptLocation = null;
+        _imageLocation = null;
+        _styleLocation = null;
+    }
+
+    protected void setProperties(UIComponent component)
+    {
+        super.setProperties(component);
+
+        setBooleanProperty(component, org.apache.myfaces.shared.renderkit.JSFAttr.FORCE_ID_ATTR, _forceId);
+        setBooleanProperty(component, org.apache.myfaces.shared.renderkit.JSFAttr.FORCE_ID_INDEX_ATTR, _forceIdIndex);
+        if (_javascriptLocation != null) setStringProperty(component, JSFAttr.JAVASCRIPT_LOCATION, _javascriptLocation);
+        if (_imageLocation != null) setStringProperty(component, org.apache.myfaces.shared.renderkit.JSFAttr.IMAGE_LOCATION, _imageLocation);
+        if (_styleLocation != null) setStringProperty(component, JSFAttr.STYLE_LOCATION, _styleLocation);
+
+        //rendererType already handled by UIComponentTag
+
+        setValueProperty(component, _value);
+        setConverterProperty(component, _converter);
+    }
+
+    /**
+     * Sets the forceId attribute of the tag.  NOTE: Not every tag that extends this class will
+     * actually make use of this attribute.  Check the TLD to see which components actually
+     * implement it.
+     *
+     * @param aForceId The value of the forceId attribute.
+     */
+    public void setForceId(String aForceId)
+    {
+        _forceId = aForceId;
+    }
+
+    /**
+     * Sets the forceIdIndex attribute of the tag.  NOTE: Not every tag that extends this class will
+     * actually make use of this attribute.  Check the TLD to see which components actually implement it.
+     *
+     * @param aForceIdIndex The value of the forceIdIndex attribute.
+     */
+    public void setForceIdIndex(String aForceIdIndex)
+    {
+        _forceIdIndex = aForceIdIndex;
+    }
+
+    public void setValue(String value)
+    {
+        _value = value;
+    }
+
+    public void setConverter(String converter)
+    {
+        _converter = converter;
+    }
+
+
+    /**
+     * Sets the javascript location attribute of the tag.  NOTE: Not every tag that extends this class will
+     * actually make use of this attribute.  Check the TLD to see which components actually implement it.
+     *
+     * @param aJavascriptLocation The alternate javascript location to use.
+     */
+    public void setJavascriptLocation(String aJavascriptLocation)
+    {
+        _javascriptLocation = aJavascriptLocation;
+    }
+
+    /**
+     * Sets the image location attribute of the tag.  NOTE: Not every tag that extends this class will
+     * actually make use of this attribute.  Check the TLD to see which components actually implement it.
+     *
+     * @param aImageLocation The alternate image location to use.
+     */
+    public void setImageLocation(String aImageLocation)
+    {
+        _imageLocation = aImageLocation;
+    }
+
+    /**
+     * Sets the style location attribute of the tag.  NOTE: Not every tag that extends this class will
+     * actually make use of this attribute.  Check the TLD to see which components actually implement it.
+     *
+     * @param aStyleLocation The alternate style location to use.
+     */
+    public void setStyleLocation(String aStyleLocation)
+    {
+        _styleLocation = aStyleLocation;
+    }
+
+    // sub class helpers
+
+    protected void setIntegerProperty(UIComponent component, String propName, String value)
+    {
+        UIComponentTagUtils.setIntegerProperty(getFacesContext(), component, propName, value);
+    }
+
+    protected void setLongProperty(UIComponent component, String propName, String value)
+    {
+        UIComponentTagUtils.setLongProperty(getFacesContext(), component, propName, value);
+    }
+
+    protected void setStringProperty(UIComponent component, String propName, String value)
+    {
+        UIComponentTagUtils.setStringProperty(getFacesContext(), component, propName, value);
+    }
+
+    protected void setBooleanProperty(UIComponent component, String propName, String value)
+    {
+        UIComponentTagUtils.setBooleanProperty(getFacesContext(), component, propName, value);
+    }
+
+    private void setValueProperty(UIComponent component, String value)
+    {
+        UIComponentTagUtils.setValueProperty(getFacesContext(), component, value);
+    }
+
+    private void setConverterProperty(UIComponent component, String value)
+    {
+        UIComponentTagUtils.setConverterProperty(getFacesContext(), component, value);
+    }
+
+    protected void setValidatorProperty(UIComponent component, String value)
+    {
+        UIComponentTagUtils.setValidatorProperty(getFacesContext(), component, value);
+    }
+
+    protected void setActionProperty(UIComponent component, String action)
+    {
+        UIComponentTagUtils.setActionProperty(getFacesContext(), component, action);
+    }
+
+    protected void setActionListenerProperty(UIComponent component, String actionListener)
+    {
+        UIComponentTagUtils.setActionListenerProperty(getFacesContext(), component, actionListener);
+    }
+
+    protected void setValueChangedListenerProperty(UIComponent component, String valueChangedListener)
+    {
+        UIComponentTagUtils.setValueChangedListenerProperty(getFacesContext(), component, valueChangedListener);
+    }
+
+    protected void setValueBinding(UIComponent component,
+                                   String propName,
+                                   String value)
+    {
+        UIComponentTagUtils.setValueBinding(getFacesContext(), component, propName, value);
+    }
+
+
+}
+

Added: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentTagUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentTagUtils.java?rev=1202479&view=auto
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentTagUtils.java (added)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentTagUtils.java Tue Nov 15 23:54:37 2011
@@ -0,0 +1,361 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.shared.taglib;
+
+import java.util.logging.Logger;
+
+import javax.faces.component.ActionSource;
+import javax.faces.component.EditableValueHolder;
+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;
+
+import org.apache.myfaces.shared.el.SimpleActionMethodBinding;
+
+/**
+ * @author Manfred Geiler (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ *
+ * @deprecated replaced by @{link UIComponentELTagUtils}
+ */
+public class UIComponentTagUtils
+{
+    //private static final Log log = LogFactory.getLog(UIComponentTagUtils.class);
+    private static final Logger log = Logger
+            .getLogger(UIComponentTagUtils.class.getName());
+
+    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 };
+
+    private UIComponentTagUtils()
+    {
+    } //util class, no instantiation allowed
+
+    public static boolean isValueReference(String v)
+    {
+        return UIComponentTag.isValueReference(v);
+    }
+
+    public static void setIntegerProperty(FacesContext context,
+            UIComponent component, String propName, String value)
+    {
+        if (value != null)
+        {
+            if (isValueReference(value))
+            {
+                ValueBinding vb = context.getApplication().createValueBinding(
+                        value);
+                component.setValueBinding(propName, vb);
+            }
+            else
+            {
+                //FIXME: should use converter maybe?
+                component.getAttributes().put(propName, Integer.valueOf(value));
+            }
+        }
+    }
+
+    public static void setLongProperty(FacesContext context,
+            UIComponent component, String propName, String value)
+    {
+        if (value != null)
+        {
+            if (isValueReference(value))
+            {
+                ValueBinding vb = context.getApplication().createValueBinding(
+                        value);
+                component.setValueBinding(propName, vb);
+            }
+            else
+            {
+                //FIXME: should use converter maybe?
+                component.getAttributes().put(propName, Long.valueOf(value));
+            }
+        }
+    }
+
+    public static void setStringProperty(FacesContext context,
+            UIComponent component, String propName, String value)
+    {
+        if (value != null)
+        {
+            if (isValueReference(value))
+            {
+                ValueBinding vb = context.getApplication().createValueBinding(
+                        value);
+                component.setValueBinding(propName, vb);
+            }
+            else
+            {
+                //TODO: Warning if component has no such property (with reflection)
+                component.getAttributes().put(propName, value);
+            }
+        }
+    }
+
+    public static void setBooleanProperty(FacesContext context,
+            UIComponent component, String propName, String value)
+    {
+        if (value != null)
+        {
+            if (isValueReference(value))
+            {
+                ValueBinding vb = context.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));
+            }
+        }
+    }
+
+    public static void setValueProperty(FacesContext context,
+            UIComponent component, String value)
+    {
+        if (value != null)
+        {
+            if (isValueReference(value))
+            {
+                ValueBinding vb = context.getApplication().createValueBinding(
+                        value);
+                component.setValueBinding(
+                        org.apache.myfaces.shared.renderkit.JSFAttr.VALUE_ATTR,
+                        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
+            {
+                log.severe("Component " + component.getClass().getName()
+                        + " is no ValueHolder, cannot set value.");
+            }
+        }
+    }
+
+    public static void setConverterProperty(FacesContext context,
+            UIComponent component, String value)
+    {
+        if (value != null)
+        {
+            if (component instanceof ValueHolder)
+            {
+                if (isValueReference(value))
+                {
+                    ValueBinding vb = context.getApplication()
+                            .createValueBinding(value);
+                    component
+                            .setValueBinding(
+                                    org.apache.myfaces.shared.renderkit.JSFAttr.CONVERTER_ATTR,
+                                    vb);
+                }
+                else
+                {
+                    FacesContext facesContext = FacesContext
+                            .getCurrentInstance();
+                    Converter converter = facesContext.getApplication()
+                            .createConverter(value);
+                    ((ValueHolder) component).setConverter(converter);
+                }
+            }
+            else
+            {
+                log.severe("Component " + component.getClass().getName()
+                        + " is no ValueHolder, cannot set value.");
+            }
+        }
+    }
+
+    public static void setValidatorProperty(FacesContext context,
+            UIComponent component, String validator)
+    {
+        if (validator != null)
+        {
+            if (!(component instanceof EditableValueHolder))
+            {
+                throw new IllegalArgumentException("Component "
+                        + component.getClientId(context)
+                        + " is no EditableValueHolder");
+            }
+            if (isValueReference(validator))
+            {
+                MethodBinding mb = context.getApplication()
+                        .createMethodBinding(validator, VALIDATOR_ARGS);
+                ((EditableValueHolder) component).setValidator(mb);
+            }
+            else
+            {
+                log.severe("Component " + component.getClientId(context)
+                        + " has invalid validation expression " + validator);
+            }
+        }
+    }
+
+    public static void setValueBinding(FacesContext context,
+            UIComponent component, String propName, String value)
+    {
+        if (value != null)
+        {
+            if (isValueReference(value))
+            {
+                ValueBinding vb = context.getApplication().createValueBinding(
+                        value);
+                component.setValueBinding(propName, vb);
+            }
+            else
+            {
+                throw new IllegalArgumentException("Component "
+                        + component.getClientId(context) + " attribute "
+                        + propName + " must be a value reference, was " + value);
+            }
+        }
+    }
+
+    public static void setActionProperty(FacesContext context,
+            UIComponent component, String action)
+    {
+        if (action != null)
+        {
+            if (!(component instanceof ActionSource))
+            {
+                throw new IllegalArgumentException("Component "
+                        + component.getClientId(context)
+                        + " is no ActionSource");
+            }
+            MethodBinding mb;
+            if (isValueReference(action))
+            {
+                mb = context.getApplication().createMethodBinding(action, null);
+            }
+            else
+            {
+                mb = new SimpleActionMethodBinding(action);
+            }
+            ((ActionSource) component).setAction(mb);
+        }
+    }
+
+    public static void setActionListenerProperty(FacesContext context,
+            UIComponent component, String actionListener)
+    {
+        if (actionListener != null)
+        {
+            if (!(component instanceof ActionSource))
+            {
+                throw new IllegalArgumentException("Component "
+                        + component.getClientId(context)
+                        + " is no ActionSource");
+            }
+            if (isValueReference(actionListener))
+            {
+                MethodBinding mb = context.getApplication()
+                        .createMethodBinding(actionListener,
+                                ACTION_LISTENER_ARGS);
+
+                /**
+                if(! Void.class.equals(mb.getType(context)))
+                {
+                    throw new IllegalArgumentException(
+                            actionListener +
+                            " : Return types for action listeners must be void, see JSF spec. 3.2.1.1");
+                }
+                */
+
+                ((ActionSource) component).setActionListener(mb);
+            }
+            else
+            {
+                log.severe("Component " + component.getClientId(context)
+                        + " has invalid actionListener value: "
+                        + actionListener);
+            }
+        }
+    }
+
+    public static void setValueChangedListenerProperty(FacesContext context,
+            UIComponent component, String valueChangedListener)
+    {
+        if (valueChangedListener != null)
+        {
+            if (!(component instanceof EditableValueHolder))
+            {
+                throw new IllegalArgumentException("Component "
+                        + component.getClientId(context)
+                        + " is no EditableValueHolder");
+            }
+            if (isValueReference(valueChangedListener))
+            {
+                MethodBinding mb = context.getApplication()
+                        .createMethodBinding(valueChangedListener,
+                                VALUE_LISTENER_ARGS);
+                /**
+                if(! Void.class.equals(mb.getType(context)))
+                {
+                    throw new IllegalArgumentException(
+                            valueChangedListener +
+                            " : Return types for value change listeners must be void, see JSF spec. 3.2.5.1");
+                }
+                */
+
+                ((EditableValueHolder) component).setValueChangeListener(mb);
+            }
+            else
+            {
+                log.severe("Component " + component.getClientId(context)
+                        + " has invalid valueChangedListener expression "
+                        + valueChangedListener);
+            }
+        }
+    }
+
+}