You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ja...@apache.org on 2010/06/16 14:16:03 UTC

svn commit: r955214 [1/3] - in /myfaces: core/trunk/api/src/main/java/javax/faces/component/ shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/ shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/ tomahawk/trunk/c...

Author: jakobk
Date: Wed Jun 16 12:16:02 2010
New Revision: 955214

URL: http://svn.apache.org/viewvc?rev=955214&view=rev
Log:
TOMAHAWK-1522 Introduce valueType attribute for UISelectMany components

Added:
    myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlSelectManyCheckbox.java   (with props)
    myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlSelectManyListbox.java   (with props)
    myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlSelectManyMenu.java   (with props)
    myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/picklist/AbstractHtmlSelectManyPicklist.java   (with props)
    myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/renderkit/html/ext/HtmlCheckboxRenderer.java   (with props)
    myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/renderkit/html/ext/HtmlListboxRenderer.java   (with props)
    myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/renderkit/html/ext/HtmlMenuRenderer.java   (with props)
    myfaces/tomahawk/trunk/core20/src/test/java/org/
    myfaces/tomahawk/trunk/core20/src/test/java/org/apache/
    myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/
    myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/
    myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/picklist/
    myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/custom/picklist/HtmlPicklistRendererTest.java   (with props)
    myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/renderkit/
    myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/renderkit/html/
    myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/renderkit/html/ext/
    myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/renderkit/html/ext/HtmlCheckboxRendererTest.java   (with props)
    myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/renderkit/html/ext/HtmlListboxRendererTest.java   (with props)
    myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/renderkit/html/ext/HtmlMenuRendererTest.java   (with props)
    myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/renderkit/html/ext/TestBean.java   (with props)
    myfaces/tomahawk/trunk/core20/src/test/java/org/apache/myfaces/renderkit/html/ext/TestIntegerConverter.java   (with props)
Modified:
    myfaces/core/trunk/api/src/main/java/javax/faces/component/_SharedRendererUtils.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/_SharedRendererUtils.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlListboxRendererBase.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlMenuRendererBase.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java
    myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/picklist/HtmlPicklistRenderer.java

Modified: myfaces/core/trunk/api/src/main/java/javax/faces/component/_SharedRendererUtils.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/_SharedRendererUtils.java?rev=955214&r1=955213&r2=955214&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/java/javax/faces/component/_SharedRendererUtils.java (original)
+++ myfaces/core/trunk/api/src/main/java/javax/faces/component/_SharedRendererUtils.java Wed Jun 16 12:16:02 2010
@@ -89,7 +89,7 @@ class _SharedRendererUtils
                                                 String[] submittedValue) throws ConverterException
     {
         // Attention!
-        // This code is duplicated in jsfapi component package.
+        // This code is duplicated in shared renderkit package (except for considerValueType).
         // If you change something here please do the same in the other class!
 
         if (submittedValue == null)
@@ -99,8 +99,12 @@ class _SharedRendererUtils
 
         ValueExpression expression = component.getValueExpression("value");
         Object targetForConvertedValues = null;
+        
         // if the component has an attached converter, use it
         Converter converter = component.getConverter();
+        
+        // at this point the valueType attribute is handled in shared.
+        
         if (expression != null)
         {
             Class<?> modelType = expression
@@ -162,38 +166,8 @@ class _SharedRendererUtils
                             COLLECTION_TYPE_KEY);
                     if (collectionTypeAttr != null)
                     {
-                        Class<?> collectionType = null;
-                        // if there is a value, it must be a ...
-                        // ... a ValueExpression that evaluates to a String or a Class
-                        if (collectionTypeAttr instanceof ValueExpression)
-                        {
-                            // get the value of the ValueExpression
-                            collectionTypeAttr = ((ValueExpression) collectionTypeAttr)
-                                    .getValue(facesContext.getELContext());
-                        }
-                        // ... String that is a fully qualified Java class name
-                        if (collectionTypeAttr instanceof String)
-                        {
-                            try
-                            {
-                                collectionType = Class
-                                        .forName((String) collectionTypeAttr);
-                            }
-                            catch (ClassNotFoundException cnfe)
-                            {
-                                throw new FacesException(
-                                        "Unable to find class "
-                                                + collectionTypeAttr
-                                                + " on the classpath.", cnfe);
-                            }
-    
-                        }
-                        // ... a Class object
-                        else if (collectionTypeAttr instanceof Class)
-                        {
-                            collectionType = (Class<?>) collectionTypeAttr;
-                        }
-                        else
+                        Class<?> collectionType = getClassFromAttribute(facesContext, collectionTypeAttr);
+                        if (collectionType == null)
                         {
                             throw new FacesException(
                                     "The attribute "
@@ -343,6 +317,59 @@ class _SharedRendererUtils
     }
     
     /**
+     * Gets a Class object from a given component attribute. The attribute can
+     * be a ValueExpression (that evaluates to a String or a Class) or a 
+     * String (that is a fully qualified Java class name) or a Class object.
+     * 
+     * @param facesContext
+     * @param attribute
+     * @return
+     * @throws FacesException if the value is a String and the represented
+     *                        class cannot be found
+     */
+    static Class<?> getClassFromAttribute(FacesContext facesContext,
+            Object attribute) throws FacesException
+    {
+        // Attention!
+        // This code is duplicated in shared renderkit package.
+        // If you change something here please do the same in the other class!
+        
+        Class<?> type = null;
+        
+        // if there is a value, it must be a ...
+        // ... a ValueExpression that evaluates to a String or a Class
+        if (attribute instanceof ValueExpression)
+        {
+            // get the value of the ValueExpression
+            attribute = ((ValueExpression) attribute)
+                    .getValue(facesContext.getELContext());
+        }
+        // ... String that is a fully qualified Java class name
+        if (attribute instanceof String)
+        {
+            try
+            {
+                type = Class.forName((String) attribute);
+            }
+            catch (ClassNotFoundException cnfe)
+            {
+                throw new FacesException(
+                        "Unable to find class "
+                                + attribute
+                                + " on the classpath.", cnfe);
+            }
+
+        }
+        // ... a Class object
+        else if (attribute instanceof Class)
+        {
+            type = (Class<?>) attribute;
+        }
+        
+        return type;
+    }
+    
+    /**
      * Iterates through the SelectItems with the given Iterator and tries to obtain
      * a by-class-converter based on the Class of SelectItem.getValue().
      * @param iterator

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java?rev=955214&r1=955213&r2=955214&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java Wed Jun 16 12:16:02 2010
@@ -82,7 +82,7 @@ public final class RendererUtils
     
     //private static final Log log = LogFactory.getLog(RendererUtils.class);
     private static final Logger log = Logger.getLogger(RendererUtils.class.getName());
-
+    
     public static final String SELECT_ITEM_LIST_ATTR = RendererUtils.class.getName() + ".LIST";
     public static final String EMPTY_STRING = "";
     //This constant is no longer used by UISelectOne/UISelectMany instances
@@ -415,17 +415,39 @@ public final class RendererUtils
 
 
     /**
+     * Calls findUISelectManyConverter with considerValueType = false.
+     * @param facesContext
+     * @param component
+     * @return
+     */
+    public static Converter findUISelectManyConverter(FacesContext facesContext,
+                                                      UISelectMany component)
+    {
+        return findUISelectManyConverter(facesContext, component, false);
+    }
+    
+    /**
      * Find proper Converter for the entries in the associated Collection or array of
      * the given UISelectMany as specified in API Doc of UISelectMany.
+     * If considerValueType is true, the valueType attribute will be used
+     * in addition to the standard algorithm to get a valid converter.
+     * 
      * @return the Converter or null if no Converter specified or needed
      * @throws FacesException if the Converter could not be created
      */
     public static Converter findUISelectManyConverter(FacesContext facesContext,
-                                                      UISelectMany component)
+            UISelectMany component, boolean considerValueType) 
     {
         // If the component has an attached Converter, use it.
         Converter converter = component.getConverter();
         if (converter != null) return converter;
+        
+        if (considerValueType)
+        {
+            // try to get a converter from the valueType attribute
+            converter = _SharedRendererUtils.getValueTypeConverter(facesContext, component);
+            if (converter != null) return converter;
+        }
 
         //Try to find out by value expression
         ValueExpression ve = component.getValueExpression("value");
@@ -761,9 +783,38 @@ public final class RendererUtils
         return converter == null ? submittedValue : converter
                 .getAsObject(facesContext, output, (String) submittedValue);
     }
+    
+    /**
+     * Invokes getConvertedUISelectManyValue() with considerValueType = false, thus
+     * implementing the standard behavior of the spec (valueType comes from Tomahawk).
+     * 
+     * @param facesContext
+     * @param selectMany
+     * @param submittedValue
+     * @return
+     * @throws ConverterException
+     */
+    public static Object getConvertedUISelectManyValue(FacesContext facesContext, 
+            UISelectMany selectMany, Object submittedValue) throws ConverterException
+    {
+        // do not consider the valueType attribute
+        return getConvertedUISelectManyValue(facesContext, selectMany, submittedValue, false);
+    }
 
-    public static Object getConvertedUISelectManyValue(FacesContext facesContext, UISelectMany selectMany,
-            Object submittedValue) throws ConverterException
+    /**
+     * Gets the converted value of a UISelectMany component.
+     * 
+     * @param facesContext
+     * @param selectMany
+     * @param submittedValue
+     * @param considerValueType if true, the valueType attribute of the component will
+     *                          also be used (applies for Tomahawk UISelectMany components)
+     * @return
+     * @throws ConverterException
+     */
+    public static Object getConvertedUISelectManyValue(FacesContext facesContext, 
+            UISelectMany selectMany, Object submittedValue,
+            boolean considerValueType) throws ConverterException
     {
         if (submittedValue == null)
         {
@@ -776,8 +827,8 @@ public final class RendererUtils
                     + getPathToComponent(selectMany) + "expected");
         }
 
-        return org.apache.myfaces.shared.renderkit._SharedRendererUtils.getConvertedUISelectManyValue(facesContext,
-                selectMany, (String[]) submittedValue);
+        return _SharedRendererUtils.getConvertedUISelectManyValue(facesContext,
+                selectMany, (String[]) submittedValue, considerValueType);
     }
 
     public static boolean getBooleanAttribute(UIComponent component, String attrName, boolean defaultValue)

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/_SharedRendererUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/_SharedRendererUtils.java?rev=955214&r1=955213&r2=955214&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/_SharedRendererUtils.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/_SharedRendererUtils.java Wed Jun 16 12:16:02 2010
@@ -56,6 +56,7 @@ import org.apache.myfaces.shared.util.Se
 class _SharedRendererUtils
 {
     static final String COLLECTION_TYPE_KEY = "collectionType";
+    static final String VALUE_TYPE_KEY = "valueType";
 
     static Converter findUIOutputConverter(FacesContext facesContext,
             UIOutput component)
@@ -92,11 +93,23 @@ class _SharedRendererUtils
         }
     }
 
+    /**
+     * Gets the converted value of a UISelectMany component.
+     * If the considerValueType is true, this method will also consider the
+     * valueType attribute of Tomahawk UISelectMany components.
+     * 
+     * @param facesContext
+     * @param component
+     * @param submittedValue
+     * @param considerValueType
+     * @return
+     * @throws ConverterException
+     */
     static Object getConvertedUISelectManyValue(FacesContext facesContext, UISelectMany component,  
-                                                String[] submittedValue) throws ConverterException
+            String[] submittedValue, boolean considerValueType) throws ConverterException
     {
         // Attention!
-        // This code is duplicated in jsfapi component package.
+        // This code is duplicated in jsfapi component package (except for considerValueType).
         // If you change something here please do the same in the other class!
 
         if (submittedValue == null)
@@ -106,8 +119,15 @@ class _SharedRendererUtils
 
         ValueExpression expression = component.getValueExpression("value");
         Object targetForConvertedValues = null;
+        
         // if the component has an attached converter, use it
         Converter converter = component.getConverter();
+        if (converter == null && considerValueType)
+        {
+            // try to get a converter from the valueType attribute
+            converter = getValueTypeConverter(facesContext, component);
+        }
+        
         if (expression != null)
         {
             Class<?> modelType = expression
@@ -169,38 +189,8 @@ class _SharedRendererUtils
                             COLLECTION_TYPE_KEY);
                     if (collectionTypeAttr != null)
                     {
-                        Class<?> collectionType = null;
-                        // if there is a value, it must be a ...
-                        // ... a ValueExpression that evaluates to a String or a Class
-                        if (collectionTypeAttr instanceof ValueExpression)
-                        {
-                            // get the value of the ValueExpression
-                            collectionTypeAttr = ((ValueExpression) collectionTypeAttr)
-                                    .getValue(facesContext.getELContext());
-                        }
-                        // ... String that is a fully qualified Java class name
-                        if (collectionTypeAttr instanceof String)
-                        {
-                            try
-                            {
-                                collectionType = Class
-                                        .forName((String) collectionTypeAttr);
-                            }
-                            catch (ClassNotFoundException cnfe)
-                            {
-                                throw new FacesException(
-                                        "Unable to find class "
-                                                + collectionTypeAttr
-                                                + " on the classpath.", cnfe);
-                            }
-    
-                        }
-                        // ... a Class object
-                        else if (collectionTypeAttr instanceof Class)
-                        {
-                            collectionType = (Class<?>) collectionTypeAttr;
-                        }
-                        else
+                        Class<?> collectionType = getClassFromAttribute(facesContext, collectionTypeAttr);
+                        if (collectionType == null)
                         {
                             throw new FacesException(
                                     "The attribute "
@@ -263,8 +253,8 @@ class _SharedRendererUtils
                             // or with the class object of componentValue (if any)
                             try
                             {
-                                targetForConvertedValues = (componentValue != null ? componentValue
-                                        .getClass()
+                                targetForConvertedValues = (componentValue != null 
+                                        ? componentValue.getClass()
                                         : modelType).newInstance();
                             }
                             catch (Exception e)
@@ -350,6 +340,103 @@ class _SharedRendererUtils
     }
     
     /**
+     * Gets a Class object from a given component attribute. The attribute can
+     * be a ValueExpression (that evaluates to a String or a Class) or a 
+     * String (that is a fully qualified Java class name) or a Class object.
+     * 
+     * @param facesContext
+     * @param attribute
+     * @return
+     * @throws FacesException if the value is a String and the represented
+     *                        class cannot be found
+     */
+    static Class<?> getClassFromAttribute(FacesContext facesContext,
+            Object attribute) throws FacesException
+    {
+        // Attention!
+        // This code is duplicated in jsfapi component package.
+        // If you change something here please do the same in the other class!
+        
+        Class<?> type = null;
+        
+        // if there is a value, it must be a ...
+        // ... a ValueExpression that evaluates to a String or a Class
+        if (attribute instanceof ValueExpression)
+        {
+            // get the value of the ValueExpression
+            attribute = ((ValueExpression) attribute)
+                    .getValue(facesContext.getELContext());
+        }
+        // ... String that is a fully qualified Java class name
+        if (attribute instanceof String)
+        {
+            try
+            {
+                type = Class.forName((String) attribute);
+            }
+            catch (ClassNotFoundException cnfe)
+            {
+                throw new FacesException(
+                        "Unable to find class "
+                                + attribute
+                                + " on the classpath.", cnfe);
+            }
+
+        }
+        // ... a Class object
+        else if (attribute instanceof Class)
+        {
+            type = (Class<?>) attribute;
+        }
+        
+        return type;
+    }
+    
+    /**
+     * Uses the valueType attribute of the given UISelectMany component to
+     * get a by-type converter.
+     * 
+     * @param facesContext
+     * @param component
+     * @return
+     */
+    static Converter getValueTypeConverter(FacesContext facesContext, UISelectMany component)
+    {
+        Converter converter = null;
+        
+        Object valueTypeAttr = component.getAttributes().get(VALUE_TYPE_KEY);
+        if (valueTypeAttr != null)
+        {
+            // treat the valueType attribute exactly like the collectionType attribute
+            Class<?> valueType = getClassFromAttribute(facesContext, valueTypeAttr);
+            if (valueType == null)
+            {
+                throw new FacesException(
+                        "The attribute "
+                                + VALUE_TYPE_KEY
+                                + " of component "
+                                + component.getClientId()
+                                + " does not evaluate to a "
+                                + "String, a Class object or a ValueExpression pointing "
+                                + "to a String or a Class object.");
+            }
+            // now we have a valid valueType
+            // --> try to get a registered-by-class converter
+            converter = facesContext.getApplication().createConverter(valueType);
+            
+            if (converter == null)
+            {
+                log.log(Level.WARNING, "Found attribute valueType on component " +
+                        RendererUtils.getPathToComponent(component) +
+                        ", but could not get a by-type converter for type " + 
+                        valueType.getName());
+            }
+        }
+        
+        return converter;
+    }
+    
+    /**
      * Iterates through the SelectItems with the given Iterator and tries to obtain
      * a by-class-converter based on the Class of SelectItem.getValue().
      * @param iterator

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java?rev=955214&r1=955213&r2=955214&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java Wed Jun 16 12:16:02 2010
@@ -23,15 +23,13 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import javax.faces.FacesException;
-import javax.faces.component.NamingContainer;
 import javax.faces.component.UIComponent;
 import javax.faces.component.UINamingContainer;
 import javax.faces.component.UISelectBoolean;
 import javax.faces.component.UISelectMany;
+import javax.faces.component.UISelectOne;
 import javax.faces.component.behavior.ClientBehavior;
 import javax.faces.component.behavior.ClientBehaviorHolder;
 import javax.faces.component.html.HtmlSelectBooleanCheckbox;
@@ -116,15 +114,7 @@ public class HtmlCheckboxRendererBase ex
         if (!pageDirectionLayout)
             writer.startElement(HTML.TR_ELEM, selectMany);
         
-        Converter converter;
-        try {
-            converter = org.apache.myfaces.shared.renderkit.RendererUtils.findUISelectManyConverter(facesContext,
-                    selectMany);
-        } catch (FacesException e) {
-            log.log(Level.SEVERE, "Error finding Converter for component with id "
-                    + selectMany.getClientId(facesContext), e);
-            converter = null;
-        }
+        Converter converter = getConverter(facesContext, selectMany);
 
         Set lookupSet = org.apache.myfaces.shared.renderkit.RendererUtils.getSubmittedValuesAsSet(facesContext, selectMany, converter, selectMany);
         boolean useSubmittedValues = lookupSet != null;
@@ -399,4 +389,26 @@ public class HtmlCheckboxRendererBase ex
                     + component.getClass().getName());
         }
     }
+    
+    /**
+     * Gets the converter for the given component rendered by this renderer.
+     * @param facesContext
+     * @param component
+     * @return
+     */
+    protected Converter getConverter(FacesContext facesContext,
+            UIComponent component)
+    {
+        if (component instanceof UISelectMany)
+        {
+            return HtmlRendererUtils.findUISelectManyConverterFailsafe(facesContext, 
+                    (UISelectMany) component);
+        }
+        else if (component instanceof UISelectOne)
+        {
+            return HtmlRendererUtils.findUIOutputConverterFailSafe(facesContext, component);
+        }
+        return null;
+    }
+    
 }

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlListboxRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlListboxRendererBase.java?rev=955214&r1=955213&r2=955214&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlListboxRendererBase.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlListboxRendererBase.java Wed Jun 16 12:16:02 2010
@@ -30,6 +30,7 @@ import javax.faces.component.behavior.Cl
 import javax.faces.component.html.HtmlSelectManyListbox;
 import javax.faces.component.html.HtmlSelectOneListbox;
 import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
 import javax.faces.convert.ConverterException;
 import java.io.IOException;
 import java.util.List;
@@ -71,14 +72,14 @@ public class HtmlListboxRendererBase
             HtmlRendererUtils.renderListbox(facesContext,
                                             (UISelectMany)uiComponent,
                                             isDisabled(facesContext, uiComponent),
-                                            size);
+                                            size, getConverter(facesContext, uiComponent));
         }
         else if (uiComponent instanceof HtmlSelectOneListbox)
         {
             HtmlRendererUtils.renderListbox(facesContext,
                                             (UISelectOne)uiComponent,
                                             isDisabled(facesContext, uiComponent),
-                                            size);
+                                            size, getConverter(facesContext, uiComponent));
         }
         else
         {
@@ -148,5 +149,26 @@ public class HtmlListboxRendererBase
             throw new IllegalArgumentException("Unsupported component class " + uiComponent.getClass().getName());
         }
     }
+    
+    /**
+     * Gets the converter for the given component rendered by this renderer.
+     * @param facesContext
+     * @param component
+     * @return
+     */
+    protected Converter getConverter(FacesContext facesContext,
+            UIComponent component)
+    {
+        if (component instanceof UISelectMany)
+        {
+            return HtmlRendererUtils.findUISelectManyConverterFailsafe(facesContext, 
+                    (UISelectMany) component);
+        }
+        else if (component instanceof UISelectOne)
+        {
+            return HtmlRendererUtils.findUIOutputConverterFailSafe(facesContext, component);
+        }
+        return null;
+    }
 
 }

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlMenuRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlMenuRendererBase.java?rev=955214&r1=955213&r2=955214&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlMenuRendererBase.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlMenuRendererBase.java Wed Jun 16 12:16:02 2010
@@ -20,6 +20,7 @@ package org.apache.myfaces.shared.render
 
 import org.apache.myfaces.shared.renderkit.RendererUtils;
 import org.apache.myfaces.shared.renderkit.html.util.ResourceUtils;
+import org.apache.myfaces.shared.renderkit.html.HtmlRendererUtils;
 
 import javax.faces.component.UIComponent;
 import javax.faces.component.UISelectMany;
@@ -29,6 +30,7 @@ import javax.faces.component.behavior.Cl
 import javax.faces.component.html.HtmlSelectManyMenu;
 import javax.faces.component.html.HtmlSelectOneMenu;
 import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
 import javax.faces.convert.ConverterException;
 import java.io.IOException;
 import java.util.List;
@@ -66,13 +68,15 @@ public class HtmlMenuRendererBase
         {
             HtmlRendererUtils.renderMenu(facesContext,
                                          (UISelectMany)component,
-                                         isDisabled(facesContext, component));
+                                         isDisabled(facesContext, component),
+                                         getConverter(facesContext, component));
         }
         else if (component instanceof UISelectOne)
         {
             HtmlRendererUtils.renderMenu(facesContext,
                                          (UISelectOne)component,
-                                         isDisabled(facesContext, component));
+                                         isDisabled(facesContext, component),
+                                         getConverter(facesContext, component));
         }
         else
         {
@@ -141,5 +145,26 @@ public class HtmlMenuRendererBase
             throw new IllegalArgumentException("Unsupported component class " + uiComponent.getClass().getName());
         }
     }
+    
+    /**
+     * Gets the converter for the given component rendered by this renderer.
+     * @param facesContext
+     * @param component
+     * @return
+     */
+    protected Converter getConverter(FacesContext facesContext,
+            UIComponent component)
+    {
+        if (component instanceof UISelectMany)
+        {
+            return HtmlRendererUtils.findUISelectManyConverterFailsafe(facesContext, 
+                    (UISelectMany) component);
+        }
+        else if (component instanceof UISelectOne)
+        {
+            return HtmlRendererUtils.findUIOutputConverterFailSafe(facesContext, component);
+        }
+        return null;
+    }
 
 }

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java?rev=955214&r1=955213&r2=955214&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java Wed Jun 16 12:16:02 2010
@@ -348,31 +348,36 @@ public final class HtmlRendererUtils {
      * writer.endElement(HTML.INPUT_ELEM); }
      */
 
-    public static void renderListbox(FacesContext facesContext,
-                                     UISelectOne selectOne, boolean disabled, int size)
-            throws IOException {
-        internalRenderSelect(facesContext, selectOne, disabled, size, false);
+    public static void renderListbox(FacesContext facesContext, UISelectOne selectOne,
+            boolean disabled, int size, Converter converter)
+            throws IOException 
+    {
+        internalRenderSelect(facesContext, selectOne, disabled, size, false, converter);
     }
 
-    public static void renderListbox(FacesContext facesContext,
-                                     UISelectMany selectMany, boolean disabled, int size)
-            throws IOException {
-        internalRenderSelect(facesContext, selectMany, disabled, size, true);
+    public static void renderListbox(FacesContext facesContext, UISelectMany selectMany,
+            boolean disabled, int size, Converter converter)
+            throws IOException 
+    {
+        internalRenderSelect(facesContext, selectMany, disabled, size, true, converter);
     }
 
-    public static void renderMenu(FacesContext facesContext,
-                                  UISelectOne selectOne, boolean disabled) throws IOException {
-        internalRenderSelect(facesContext, selectOne, disabled, 1, false);
+    public static void renderMenu(FacesContext facesContext, UISelectOne selectOne,
+            boolean disabled, Converter converter) throws IOException 
+    {
+        internalRenderSelect(facesContext, selectOne, disabled, 1, false, converter);
     }
 
-    public static void renderMenu(FacesContext facesContext,
-                                  UISelectMany selectMany, boolean disabled) throws IOException {
-        internalRenderSelect(facesContext, selectMany, disabled, 1, true);
+    public static void renderMenu(FacesContext facesContext, UISelectMany selectMany,
+            boolean disabled, Converter converter) throws IOException 
+    {
+        internalRenderSelect(facesContext, selectMany, disabled, 1, true, converter);
     }
 
     private static void internalRenderSelect(FacesContext facesContext,
                                              UIComponent uiComponent, boolean disabled, int size,
-                                             boolean selectMany) throws IOException {
+                                             boolean selectMany, Converter converter) throws IOException 
+    {
         ResponseWriter writer = facesContext.getResponseWriter();
 
         writer.startElement(HTML.SELECT_ELEM, uiComponent);
@@ -391,16 +396,13 @@ public final class HtmlRendererUtils {
                               uiComponent.getClientId(facesContext), null);
 
         List selectItemList;
-        Converter converter;
         if (selectMany) {
             writer.writeAttribute(HTML.MULTIPLE_ATTR, HTML.MULTIPLE_ATTR, null);
             selectItemList = org.apache.myfaces.shared.renderkit.RendererUtils
                     .getSelectItemList((UISelectMany) uiComponent, facesContext);
-            converter = findUISelectManyConverterFailsafe(facesContext, uiComponent);
         } else {
             selectItemList = RendererUtils
                     .getSelectItemList((UISelectOne) uiComponent, facesContext);
-            converter = findUIOutputConverterFailSafe(facesContext, uiComponent);
         }
 
         if (size == Integer.MIN_VALUE) {
@@ -473,12 +475,20 @@ public final class HtmlRendererUtils {
         }
         return lookupSet;
     }
+    
+    public static Converter findUISelectManyConverterFailsafe(FacesContext facesContext, UIComponent uiComponent)
+    {
+        // invoke with considerValueType = false
+        return findUISelectManyConverterFailsafe(facesContext, uiComponent, false);
+    }
 
-    public static Converter findUISelectManyConverterFailsafe(FacesContext facesContext, UIComponent uiComponent) {
+    public static Converter findUISelectManyConverterFailsafe(FacesContext facesContext,
+            UIComponent uiComponent, boolean considerValueType) 
+    {
         Converter converter;
         try {
             converter = RendererUtils.findUISelectManyConverter(
-                    facesContext, (UISelectMany) uiComponent);
+                    facesContext, (UISelectMany) uiComponent, considerValueType);
         } catch (FacesException e) {
             log.log(Level.SEVERE, "Error finding Converter for component with id "
                       + uiComponent.getClientId(facesContext), e);
@@ -801,9 +811,16 @@ public final class HtmlRendererUtils {
         writer.writeAttribute(HTML.ID_ATTR, clientId, null);
         writer.writeAttribute(HTML.NAME_ATTR, clientId, null);
     }
+    
+    public static void renderDisplayValueOnlyForSelects(FacesContext facesContext,
+            UIComponent uiComponent) throws IOException
+    {
+        // invoke renderDisplayValueOnlyForSelects with considerValueType = false
+        renderDisplayValueOnlyForSelects(facesContext, uiComponent, false);
+    }
 
-    public static void renderDisplayValueOnlyForSelects(FacesContext facesContext, UIComponent
-            uiComponent)
+    public static void renderDisplayValueOnlyForSelects(FacesContext facesContext,
+            UIComponent uiComponent, boolean considerValueType)
             throws IOException
     {
         ResponseWriter writer = facesContext.getResponseWriter();
@@ -830,7 +847,7 @@ public final class HtmlRendererUtils {
                 isSelectOne = false;
                 selectItemList = RendererUtils
                         .getSelectItemList((UISelectMany) uiComponent, facesContext);
-                converter = findUISelectManyConverterFailsafe(facesContext, uiComponent);
+                converter = findUISelectManyConverterFailsafe(facesContext, uiComponent, considerValueType);
             } else if(uiComponent instanceof UISelectOne){
                 isSelectOne = true;
                 selectItemList = RendererUtils

Added: myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlSelectManyCheckbox.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlSelectManyCheckbox.java?rev=955214&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlSelectManyCheckbox.java (added)
+++ myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlSelectManyCheckbox.java Wed Jun 16 12:16:02 2010
@@ -0,0 +1,127 @@
+/*
+ * 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.component.html.ext;
+
+import javax.faces.context.FacesContext;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFComponent;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty;
+import org.apache.myfaces.component.AltProperty;
+import org.apache.myfaces.component.DataProperties;
+import org.apache.myfaces.component.DisplayValueOnlyAware;
+import org.apache.myfaces.component.EscapeAware;
+import org.apache.myfaces.component.ForceIdAware;
+import org.apache.myfaces.component.UserRoleAware;
+import org.apache.myfaces.component.UserRoleUtils;
+import org.apache.myfaces.component.html.util.HtmlComponentUtils;
+import org.apache.myfaces.custom.ExtendedComponentBase;
+import org.apache.myfaces.shared_tomahawk.component.DisplayValueOnlyCapable;
+import org.apache.myfaces.shared_tomahawk.component.EscapeCapable;
+
+/**
+ * Extends standard selectManyCheckbox with user role support and
+ * a valueType attribute. 
+ * 
+ * Additionally this extended selectManyCheckbox accepts a layout 
+ * attribute of value "spread" (see custom checkbox tag).
+ *  
+ * Unless otherwise specified, all attributes accept static values or EL expressions.
+ * 
+ * @since 1.1.7
+ * @author Manfred Geiler (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+@JSFComponent(
+    name = "t:selectManyCheckbox",
+    clazz = "org.apache.myfaces.component.html.ext.HtmlSelectManyCheckbox",
+    tagClass = "org.apache.myfaces.generated.taglib.html.ext.HtmlSelectManyCheckboxTag")
+public abstract class AbstractHtmlSelectManyCheckbox
+        extends javax.faces.component.html.HtmlSelectManyCheckbox
+        implements UserRoleAware, DisplayValueOnlyCapable,  
+        EscapeCapable, DisplayValueOnlyAware, EscapeAware,
+        ForceIdAware, DataProperties, AltProperty,
+        ExtendedComponentBase
+{
+    public static final String COMPONENT_TYPE = "org.apache.myfaces.HtmlSelectManyCheckbox";
+    public static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.Checkbox";
+
+    public String getClientId(FacesContext context)
+    {
+        String clientId = HtmlComponentUtils.getClientId(this, getRenderer(context), context);
+        if (clientId == null)
+        {
+            clientId = super.getClientId(context);
+        }
+
+        return clientId;
+    }
+
+    public boolean isRendered()
+    {
+        if (!UserRoleUtils.isVisibleOnUserRole(this)) return false;
+        return super.isRendered();
+    }
+
+    public boolean isSetDisplayValueOnly(){
+        return getDisplayValueOnly() != null ? true : false;  
+    }
+    
+    public boolean isDisplayValueOnly(){
+        return getDisplayValueOnly() != null ? getDisplayValueOnly().booleanValue() : false;
+    }
+    
+    public void setDisplayValueOnly(boolean displayValueOnly){
+        this.setDisplayValueOnly((Boolean) Boolean.valueOf(displayValueOnly));
+    }
+
+    /**
+     * A integer representing the number of checkbox rows if the 
+     * layout is lineDirection and checkbox columns if the layout 
+     * is pageDirection.
+     */
+    @JSFProperty
+    public abstract String getLayoutWidth();
+    
+    /**
+     * Specifies the value type of the selectable items. This attribute is
+     * similar to the collectionType attribute introduced in JSF 2.0. 
+     * It can be used to declare the type of the selectable items when using
+     * a Collection to store the values in the managed bean, because it is 
+     * not possible in Java to get the value type of a type-safe Collection
+     * (in contrast to arrays where this is possible). 
+     * 
+     * @since 2.0
+     */
+    @JSFProperty
+    public abstract String getValueType(); 
+    
+    private static boolean booleanFromObject(Object obj, boolean defaultValue)
+    {
+        if(obj instanceof Boolean)
+        {
+            return ((Boolean) obj).booleanValue();
+        }
+        else if(obj instanceof String)
+        {
+            return Boolean.valueOf(((String) obj)).booleanValue();
+        }
+
+        return defaultValue;
+    }
+}

Propchange: myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlSelectManyCheckbox.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlSelectManyCheckbox.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlSelectManyCheckbox.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlSelectManyListbox.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlSelectManyListbox.java?rev=955214&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlSelectManyListbox.java (added)
+++ myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlSelectManyListbox.java Wed Jun 16 12:16:02 2010
@@ -0,0 +1,99 @@
+/*
+ * 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.component.html.ext;
+
+import javax.faces.context.FacesContext;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFComponent;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty;
+import org.apache.myfaces.component.DataProperties;
+import org.apache.myfaces.component.DisplayValueOnlyAware;
+import org.apache.myfaces.component.EscapeAware;
+import org.apache.myfaces.component.ForceIdAware;
+import org.apache.myfaces.component.UserRoleAware;
+import org.apache.myfaces.component.UserRoleUtils;
+import org.apache.myfaces.component.html.util.HtmlComponentUtils;
+import org.apache.myfaces.shared_tomahawk.component.DisplayValueOnlyCapable;
+import org.apache.myfaces.shared_tomahawk.component.EscapeCapable;
+
+/**
+ * Extends standard selectManyListbox with user role support and
+ * a valueType attribute.
+ * 
+ * Unless otherwise specified, all attributes accept static values or EL expressions.
+ * 
+ * @since 1.1.7
+ * @author Martin Marinschek (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+@JSFComponent(
+    name = "t:selectManyListbox",
+    clazz = "org.apache.myfaces.component.html.ext.HtmlSelectManyListbox",
+    tagClass = "org.apache.myfaces.generated.taglib.html.ext.HtmlSelectManyListboxTag")
+public abstract class AbstractHtmlSelectManyListbox
+        extends javax.faces.component.html.HtmlSelectManyListbox
+        implements UserRoleAware, DisplayValueOnlyCapable, EscapeCapable,
+        EscapeAware, DisplayValueOnlyAware, ForceIdAware, DataProperties
+{
+    public static final String COMPONENT_TYPE = "org.apache.myfaces.HtmlSelectManyListbox";
+    public static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.Listbox";
+
+    public String getClientId(FacesContext context)
+    {
+        String clientId = HtmlComponentUtils.getClientId(this, getRenderer(context), context);
+        if (clientId == null)
+        {
+            clientId = super.getClientId(context);
+        }
+
+        return clientId;
+    }
+    
+    public boolean isRendered()
+    {
+        if (!UserRoleUtils.isVisibleOnUserRole(this)) return false;
+        return super.isRendered();
+    }
+
+    public boolean isSetDisplayValueOnly(){
+        return getDisplayValueOnly() != null ? true : false;  
+    }
+    
+    public boolean isDisplayValueOnly(){
+        return getDisplayValueOnly() != null ? getDisplayValueOnly().booleanValue() : false;
+    }
+    
+    public void setDisplayValueOnly(boolean displayValueOnly){
+        this.setDisplayValueOnly((Boolean) Boolean.valueOf(displayValueOnly));
+    }
+    
+    /**
+     * Specifies the value type of the selectable items. This attribute is
+     * similar to the collectionType attribute introduced in JSF 2.0. 
+     * It can be used to declare the type of the selectable items when using
+     * a Collection to store the values in the managed bean, because it is 
+     * not possible in Java to get the value type of a type-safe Collection
+     * (in contrast to arrays where this is possible). 
+     * 
+     * @since 2.0
+     */
+    @JSFProperty
+    public abstract String getValueType(); 
+
+}

Propchange: myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlSelectManyListbox.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlSelectManyListbox.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlSelectManyListbox.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlSelectManyMenu.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlSelectManyMenu.java?rev=955214&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlSelectManyMenu.java (added)
+++ myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlSelectManyMenu.java Wed Jun 16 12:16:02 2010
@@ -0,0 +1,100 @@
+/*
+ * 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.component.html.ext;
+
+import javax.faces.context.FacesContext;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFComponent;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty;
+import org.apache.myfaces.component.DataProperties;
+import org.apache.myfaces.component.DisplayValueOnlyAware;
+import org.apache.myfaces.component.EscapeAware;
+import org.apache.myfaces.component.ForceIdAware;
+import org.apache.myfaces.component.UserRoleAware;
+import org.apache.myfaces.component.UserRoleUtils;
+import org.apache.myfaces.component.html.util.HtmlComponentUtils;
+import org.apache.myfaces.shared_tomahawk.component.DisplayValueOnlyCapable;
+import org.apache.myfaces.shared_tomahawk.component.EscapeCapable;
+
+/**
+ * Extends standard selectManyMenu with user role support and
+ * a valueType attribute.
+ * 
+ * Unless otherwise specified, all attributes accept static values or EL expressions.
+ * 
+ * @since 1.1.7
+ * @author Martin Marinschek (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+@JSFComponent(
+    name = "t:selectManyMenu",
+    clazz = "org.apache.myfaces.component.html.ext.HtmlSelectManyMenu",
+    tagClass = "org.apache.myfaces.generated.taglib.html.ext.HtmlSelectManyMenuTag")
+public abstract class AbstractHtmlSelectManyMenu
+        extends javax.faces.component.html.HtmlSelectManyMenu
+        implements UserRoleAware, DisplayValueOnlyCapable,
+        EscapeCapable, DisplayValueOnlyAware, EscapeAware,
+        ForceIdAware, DataProperties
+{
+    public static final String COMPONENT_TYPE = "org.apache.myfaces.HtmlSelectManyMenu";
+    public static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.Menu";
+    
+    public String getClientId(FacesContext context)
+    {
+        String clientId = HtmlComponentUtils.getClientId(this, getRenderer(context), context);
+        if (clientId == null)
+        {
+            clientId = super.getClientId(context);
+        }
+
+        return clientId;
+    }
+
+    public boolean isRendered()
+    {
+        if (!UserRoleUtils.isVisibleOnUserRole(this)) return false;
+        return super.isRendered();
+    }
+
+    public boolean isSetDisplayValueOnly(){
+        return getDisplayValueOnly() != null ? true : false;  
+    }
+    
+    public boolean isDisplayValueOnly(){
+        return getDisplayValueOnly() != null ? getDisplayValueOnly().booleanValue() : false;
+    }
+    
+    public void setDisplayValueOnly(boolean displayValueOnly){
+        this.setDisplayValueOnly((Boolean) Boolean.valueOf(displayValueOnly));
+    }
+    
+    /**
+     * Specifies the value type of the selectable items. This attribute is
+     * similar to the collectionType attribute introduced in JSF 2.0. 
+     * It can be used to declare the type of the selectable items when using
+     * a Collection to store the values in the managed bean, because it is 
+     * not possible in Java to get the value type of a type-safe Collection
+     * (in contrast to arrays where this is possible). 
+     * 
+     * @since 2.0
+     */
+    @JSFProperty
+    public abstract String getValueType(); 
+
+}

Propchange: myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlSelectManyMenu.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlSelectManyMenu.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlSelectManyMenu.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/picklist/AbstractHtmlSelectManyPicklist.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/picklist/AbstractHtmlSelectManyPicklist.java?rev=955214&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/picklist/AbstractHtmlSelectManyPicklist.java (added)
+++ myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/picklist/AbstractHtmlSelectManyPicklist.java Wed Jun 16 12:16:02 2010
@@ -0,0 +1,146 @@
+/*
+ * 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.custom.picklist;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFComponent;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty;
+import org.apache.myfaces.component.html.ext.HtmlSelectManyListbox;
+
+/**
+ * A picklist component that allows to select items from one list to another
+ * <p>
+ * In other words, is a selection component where a set of items 
+ * can be selected from a list that contains all the available items to a list
+ * that contains the selected items.
+ * </p>
+ * <p>
+ * The component is based on the t:selectManyListbox component, so it contains
+ * the same attributes. Soon, more specific attributes will be added.
+ * </p>
+ * 
+ * @since 1.1.7
+ * @author Bruno Aranda (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+@JSFComponent(
+    name = "t:selectManyPicklist",
+    clazz = "org.apache.myfaces.custom.picklist.HtmlSelectManyPicklist",
+    tagClass = "org.apache.myfaces.custom.picklist.HtmlSelectManyPicklistTag")
+public abstract class AbstractHtmlSelectManyPicklist extends HtmlSelectManyListbox
+{
+    public static final String COMPONENT_TYPE = "org.apache.myfaces.HtmlSelectManyPicklist";
+    public static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.PicklistRenderer";
+    
+    /**
+     * Define the text that goes inside the add button
+     * 
+     * @JSFProperty
+     */
+    public abstract String getAddButtonText();
+    
+    /**
+     * Define the text that goes inside the add all button
+     * 
+     * @JSFProperty
+     */
+    public abstract String getAddAllButtonText();    
+    
+    /**
+     * Define the text that goes inside the remove button
+     * 
+     * @JSFProperty
+     */
+    public abstract String getRemoveButtonText();
+    
+    /**
+     * Define the text that goes inside the remove all button
+     * 
+     * @JSFProperty
+     */
+    public abstract String getRemoveAllButtonText();    
+    
+    /**
+     * CSS style to be applied to the add button
+     * 
+     * @JSFProperty
+     */
+    public abstract String getAddButtonStyle();
+    
+    /**
+     * CSS style to be applied to the add all button
+     * 
+     * @JSFProperty
+     */
+    public abstract String getAddAllButtonStyle();    
+    
+    /**
+     * CSS style to be applied to the remove button
+     * 
+     * @JSFProperty
+     */
+    public abstract String getRemoveButtonStyle();
+    
+    /**
+     * CSS style to be applied to the remove all button
+     * 
+     * @JSFProperty
+     */
+    public abstract String getRemoveAllButtonStyle();    
+    
+    /**
+     * CSS styleClass to be applied to the add button
+     * 
+     * @JSFProperty
+     */
+    public abstract String getAddButtonStyleClass();
+    
+    /**
+     * CSS styleClass to be applied to the add all button
+     * 
+     * @JSFProperty
+     */
+    public abstract String getAddAllButtonStyleClass();    
+    
+    /**
+     * CSS styleClass to be applied to the remove button
+     * 
+     * @JSFProperty
+     */
+    public abstract String getRemoveButtonStyleClass();
+    
+    /**
+     * CSS styleClass to be applied to the remove all button
+     * 
+     * @JSFProperty
+     */
+    public abstract String getRemoveAllButtonStyleClass();    
+    
+    /**
+     * Specifies the value type of the selectable items. This attribute is
+     * similar to the collectionType attribute introduced in JSF 2.0. 
+     * It can be used to declare the type of the selectable items when using
+     * a Collection to store the values in the managed bean, because it is 
+     * not possible in Java to get the value type of a type-safe Collection
+     * (in contrast to arrays where this is possible). 
+     * 
+     * @since 2.0
+     */
+    @JSFProperty
+    public abstract String getValueType(); 
+}

Propchange: myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/picklist/AbstractHtmlSelectManyPicklist.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/picklist/AbstractHtmlSelectManyPicklist.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/picklist/AbstractHtmlSelectManyPicklist.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain