You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Mike Kienenberger <mk...@gmail.com> on 2006/08/25 03:58:02 UTC

Re: svn commit: r434574 [1/2] - in /myfaces: 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/core/src/main/java/org/apache/myfaces/custom/na

Thomas,

In case you missed the thread, please open Jira issues when making
non-trivial changes so we can track them :-)


On 8/24/06, tomsp@apache.org <to...@apache.org> wrote:
> Author: tomsp
> Date: Thu Aug 24 16:52:09 2006
> New Revision: 434574
>
> URL: http://svn.apache.org/viewvc?rev=434574&view=rev
> Log:
> fix for Trinidad / Tomahawk commandlink problem
>
> Modified:
>     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/html/HtmlButtonRendererBase.java
>     myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
>     myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java
>     myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/navmenu/jscookmenu/HtmlJSCookMenuRenderer.java
>     myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/fisheye/HtmlFishEyeNavigationMenuRenderer.java
>     myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/dojo/debugconsole.jsp
>
> 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=434574&r1=434573&r2=434574&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 Thu Aug 24 16:52:09 2006
> @@ -45,81 +45,74 @@
>   * @author Manfred Geiler (latest modification by $Author$)
>   * @version $Revision$ $Date$
>   */
> -public final class RendererUtils
> -{
> -       private RendererUtils(){
> -               //nope
> -       }
> -
> +public final class RendererUtils {
> +    private RendererUtils() {
> +        //nope
> +    }
> +
>      private static final Log log = LogFactory.getLog(RendererUtils.class);
>
>      public static final String SELECT_ITEM_LIST_ATTR = RendererUtils.class.getName() + ".LIST";
>      public static final String EMPTY_STRING = "";
> -    public static final Object NOTHING = new Serializable() {};
> +    public static final Object NOTHING = new Serializable() {
> +    };
>
>      public static final String ACTION_FOR_LIST = "org.apache.myfaces.ActionForList";
>      public static final String ACTION_FOR_PHASE_LIST = "org.apache.myfaces.ActionForPhaseList";
>
>      public static final String SEQUENCE_PARAM = "jsf_sequence";
>
> -    public static String getPathToComponent(UIComponent component)
> -    {
> +    public static String getPathToComponent(UIComponent component) {
>          StringBuffer buf = new StringBuffer();
>
> -        if(component == null)
> -        {
> +        if (component == null) {
>              buf.append("{Component-Path : ");
>              buf.append("[null]}");
>              return buf.toString();
>          }
>
> -        getPathToComponent(component,buf);
> +        getPathToComponent(component, buf);
>
> -        buf.insert(0,"{Component-Path : ");
> +        buf.insert(0, "{Component-Path : ");
>          buf.append("}");
>
>          return buf.toString();
>      }
>
> -    private static void getPathToComponent(UIComponent component, StringBuffer buf)
> -    {
> -        if(component == null)
> +    private static void getPathToComponent(UIComponent component, StringBuffer buf) {
> +        if (component == null)
>              return;
>
>          StringBuffer intBuf = new StringBuffer();
>
>          intBuf.append("[Class: ");
>          intBuf.append(component.getClass().getName());
> -        if(component instanceof UIViewRoot)
> -        {
> +        if (component instanceof UIViewRoot) {
>              intBuf.append(",ViewId: ");
>              intBuf.append(((UIViewRoot) component).getViewId());
>          }
> -        else
> -        {
> +        else {
>              intBuf.append(",Id: ");
>              intBuf.append(component.getId());
>          }
>          intBuf.append("]");
>
> -        buf.insert(0,intBuf.toString());
> +        buf.insert(0, intBuf.toString());
>
>          getPathToComponent(component.getParent(), buf);
>      }
>
>      public static String getConcatenatedId(FacesContext context, UIComponent container,
> -                                           String clientId)
> -    {
> +                                           String clientId) {
>          UIComponent child = container.findComponent(clientId);
>
> -        if(child == null)
> -                return clientId;
> +        if (child == null)
> +            return clientId;
>
>          return getConcatenatedId(context, child);
>      }
>
> -    public static String getConcatenatedId(FacesContext context, UIComponent component)
> -    {
> +    public static String getConcatenatedId(FacesContext context, UIComponent component) {
>          if (context == null) throw new NullPointerException("context");
>
>          StringBuffer idBuf = new StringBuffer();
> @@ -128,133 +121,105 @@
>
>          UIComponent parent;
>
> -        while((parent = component.getParent())!=null)
> -        {
> -            if(parent instanceof NamingContainer)
> -            {
> -                idBuf.insert(0,NamingContainer.SEPARATOR_CHAR);
> -                idBuf.insert(0,parent.getId());
> +        while ((parent = component.getParent()) != null) {
> +            if (parent instanceof NamingContainer) {
> +                idBuf.insert(0, NamingContainer.SEPARATOR_CHAR);
> +                idBuf.insert(0, parent.getId());
>              }
>          }
>
>          return idBuf.toString();
>      }
>
> -    public static Boolean getBooleanValue(UIComponent component)
> -    {
> +    public static Boolean getBooleanValue(UIComponent component) {
>          Object value = getObjectValue(component);
> -        if (value==null || value instanceof Boolean)
> -        {
> +        if (value == null || value instanceof Boolean) {
>              return (Boolean) value;
>          }
> -        else
> -        {
> -            throw new IllegalArgumentException("Expected submitted value of type Boolean for Component : "+
> -                    getPathToComponent(component));
> +        else {
> +            throw new IllegalArgumentException("Expected submitted value of type Boolean for Component : " +
> +                getPathToComponent(component));
>          }
>      }
>
> -    public static Date getDateValue(UIComponent component)
> -    {
> +    public static Date getDateValue(UIComponent component) {
>          Object value = getObjectValue(component);
> -        if (value==null || value instanceof Date)
> -        {
> +        if (value == null || value instanceof Date) {
>              return (Date) value;
>          }
> -        else
> -        {
> +        else {
>              throw new IllegalArgumentException("Expected submitted value of type Date for component : "
> -                +getPathToComponent(component));
> +                + getPathToComponent(component));
>          }
>      }
>
> -    public static Object getObjectValue(UIComponent component)
> -    {
> -        if (!(component instanceof ValueHolder))
> -        {
> -            throw new IllegalArgumentException("Component : "+
> -                    getPathToComponent(component)+"is not a ValueHolder");
> +    public static Object getObjectValue(UIComponent component) {
> +        if (!(component instanceof ValueHolder)) {
> +            throw new IllegalArgumentException("Component : " +
> +                getPathToComponent(component) + "is not a ValueHolder");
>          }
>
> -        if (component instanceof EditableValueHolder)
> -        {
> -            Object value = ((EditableValueHolder)component).getSubmittedValue();
> -            if(value != null && !NOTHING.equals(value))
> -            {
> +        if (component instanceof EditableValueHolder) {
> +            Object value = ((EditableValueHolder) component).getSubmittedValue();
> +            if (value != null && !NOTHING.equals(value)) {
>                  return value;
>              }
>          }
>
> -        return ((ValueHolder)component).getValue();
> +        return ((ValueHolder) component).getValue();
>      }
>
>      public static String getStringValue(FacesContext facesContext,
> -                                        UIComponent component)
> -    {
> -        try
> -        {
> -            if (!(component instanceof ValueHolder))
> -            {
> -                throw new IllegalArgumentException("Component : "+getPathToComponent(component)+"is not a ValueHolder");
> +                                        UIComponent component) {
> +        try {
> +            if (!(component instanceof ValueHolder)) {
> +                throw new IllegalArgumentException("Component : " + getPathToComponent(component) + "is not a ValueHolder");
>              }
>
> -            if (component instanceof EditableValueHolder)
> -            {
> -                Object submittedValue = ((EditableValueHolder)component).getSubmittedValue();
> -                if (submittedValue != null)
> -                {
> -                    if (submittedValue instanceof String)
> -                    {
> -                        return (String)submittedValue;
> +            if (component instanceof EditableValueHolder) {
> +                Object submittedValue = ((EditableValueHolder) component).getSubmittedValue();
> +                if (submittedValue != null) {
> +                    if (submittedValue instanceof String) {
> +                        return (String) submittedValue;
>                      }
> -                    else
> -                    {
> +                    else {
>                          throw new IllegalArgumentException("Expected submitted value of type String for component : "
> -                            +getPathToComponent(component));
> +                            + getPathToComponent(component));
>                      }
>                  }
>              }
>
> -            Object value = ((ValueHolder)component).getValue();
> +            Object value = ((ValueHolder) component).getValue();
>
> -            Converter converter = ((ValueHolder)component).getConverter();
> -            if (converter == null  && value != null)
> -            {
> -                if (value instanceof String)
> -                {
> +            Converter converter = ((ValueHolder) component).getConverter();
> +            if (converter == null && value != null) {
> +                if (value instanceof String) {
>                      return (String) value;
>                  }
>
> -                try
> -                {
> +                try {
>                      converter = facesContext.getApplication().createConverter(value.getClass());
>                  }
> -                catch (FacesException e)
> -                {
> +                catch (FacesException e) {
>                      log.error("No converter for class " + value.getClass().getName() + " found (component id=" + component.getId() + ").");
>                      // converter stays null
>                  }
>              }
>
> -            if (converter == null)
> -            {
> -                if (value == null)
> -                {
> +            if (converter == null) {
> +                if (value == null) {
>                      return "";
>                  }
> -                else
> -                {
> +                else {
>                      return value.toString();
>                  }
>              }
> -            else
> -            {
> +            else {
>                  return converter.getAsString(facesContext, component, value);
>              }
>          }
> -        catch(PropertyNotFoundException ex)
> -        {
> -            log.error("Property not found - called by component : "+getPathToComponent(component),ex);
> +        catch (PropertyNotFoundException ex) {
> +            log.error("Property not found - called by component : " + getPathToComponent(component), ex);
>
>              throw ex;
>          }
> @@ -262,44 +227,35 @@
>
>      /**
>       * See JSF Spec. 8.5 Table 8-1
> +     *
>       * @param value
>       * @return boolean
>       */
> -    public static boolean isDefaultAttributeValue(Object value)
> -    {
> -        if (value == null)
> -        {
> +    public static boolean isDefaultAttributeValue(Object value) {
> +        if (value == null) {
>              return true;
>          }
> -        else if (value instanceof Boolean)
> -        {
> +        else if (value instanceof Boolean) {
>              return !((Boolean) value).booleanValue();
>          }
> -        else if (value instanceof Number)
> -        {
> -            if (value instanceof Integer)
> -            {
> -                return ((Number)value).intValue() == Integer.MIN_VALUE;
> -            }
> -            else if (value instanceof Double)
> -            {
> -                return ((Number)value).doubleValue() == Double.MIN_VALUE;
> -            }
> -            else if (value instanceof Long)
> -            {
> -                return ((Number)value).longValue() == Long.MIN_VALUE;
> -            }
> -            else if (value instanceof Byte)
> -            {
> -                return ((Number)value).byteValue() == Byte.MIN_VALUE;
> -            }
> -            else if (value instanceof Float)
> -            {
> -                return ((Number)value).floatValue() == Float.MIN_VALUE;
> -            }
> -            else if (value instanceof Short)
> -            {
> -                return ((Number)value).shortValue() == Short.MIN_VALUE;
> +        else if (value instanceof Number) {
> +            if (value instanceof Integer) {
> +                return ((Number) value).intValue() == Integer.MIN_VALUE;
> +            }
> +            else if (value instanceof Double) {
> +                return ((Number) value).doubleValue() == Double.MIN_VALUE;
> +            }
> +            else if (value instanceof Long) {
> +                return ((Number) value).longValue() == Long.MIN_VALUE;
> +            }
> +            else if (value instanceof Byte) {
> +                return ((Number) value).byteValue() == Byte.MIN_VALUE;
> +            }
> +            else if (value instanceof Float) {
> +                return ((Number) value).floatValue() == Float.MIN_VALUE;
> +            }
> +            else if (value instanceof Short) {
> +                return ((Number) value).shortValue() == Short.MIN_VALUE;
>              }
>          }
>          return false;
> @@ -307,13 +263,13 @@
>
>      /**
>       * Find the proper Converter for the given UIOutput component.
> +     *
>       * @return the Converter or null if no Converter specified or needed
>       * @throws FacesException if the Converter could not be created
>       */
>      public static Converter findUIOutputConverter(FacesContext facesContext,
>                                                    UIOutput component)
> -            throws FacesException
> -    {
> +        throws FacesException {
>          return _SharedRendererUtils.findUIOutputConverter(facesContext, component);
>      }
>
> @@ -321,12 +277,12 @@
>      /**
>       * Find proper Converter for the entries in the associated List or Array of
>       * the given UISelectMany as specified in API Doc of UISelectMany.
> +     *
>       * @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) {
>          Converter converter = component.getConverter();
>          if (converter != null) return converter;
>
> @@ -337,8 +293,7 @@
>          Class valueType = vb.getType(facesContext);
>          if (valueType == null) return null;
>
> -        if (List.class.isAssignableFrom(valueType))
> -        {
> +        if (List.class.isAssignableFrom(valueType)) {
>              //According to API Doc of UISelectMany the assumed entry type for a List is String
>              //--> so basically no converter needed
>
> @@ -349,19 +304,15 @@
>
>              List selectItems = RendererUtils.internalGetSelectItemList(component);
>
> -            if (selectItems != null && selectItems.size() > 0)
> -            {
> +            if (selectItems != null && selectItems.size() > 0) {
>                  SelectItem selectItem = (SelectItem) selectItems.get(0);
>                  Class listComponentType = selectItem.getValue().getClass();
>
> -                if (!(String.class.equals(listComponentType)))
> -                {
> -                    try
> -                    {
> +                if (!(String.class.equals(listComponentType))) {
> +                    try {
>                          return facesContext.getApplication().createConverter(listComponentType);
>                      }
> -                    catch (FacesException e)
> -                    {
> +                    catch (FacesException e) {
>                          log.error("No Converter for type " + listComponentType.getName() + " found", e);
>                          return null;
>                      }
> @@ -371,52 +322,44 @@
>              return null;
>          }
>
> -        if (!valueType.isArray())
> -        {
> -            throw new IllegalArgumentException("ValueBinding for UISelectMany : "+getPathToComponent(component)+" must be of type List or Array");
> +        if (!valueType.isArray()) {
> +            throw new IllegalArgumentException("ValueBinding for UISelectMany : " + getPathToComponent(component) + " must be of type List or Array");
>          }
>
>          Class arrayComponentType = valueType.getComponentType();
>          if (String.class.equals(arrayComponentType)) return null;    //No converter needed for String type
>          if (Object.class.equals(arrayComponentType)) return null;    //There is no converter for Object class
>
> -        try
> -        {
> +        try {
>              return facesContext.getApplication().createConverter(arrayComponentType);
>          }
> -        catch (FacesException e)
> -        {
> +        catch (FacesException e) {
>              log.error("No Converter for type " + arrayComponentType.getName() + " found", e);
>              return null;
>          }
>      }
>
>
> -    public static void checkParamValidity(FacesContext facesContext, UIComponent uiComponent, Class compClass)
> -    {
> -        if(facesContext == null)
> +    public static void checkParamValidity(FacesContext facesContext, UIComponent uiComponent, Class compClass) {
> +        if (facesContext == null)
>              throw new NullPointerException("facesContext may not be null");
> -        if(uiComponent == null)
> +        if (uiComponent == null)
>              throw new NullPointerException("uiComponent may not be null");
>
>          //if (compClass != null && !(compClass.isAssignableFrom(uiComponent.getClass())))
>          // why isAssignableFrom with additional getClass method call if isInstance does the same?
> -        if (compClass != null && !(compClass.isInstance(uiComponent)))
> -        {
> -            throw new IllegalArgumentException("uiComponent : "+getPathToComponent(uiComponent)+
> -                    " is not instance of "+compClass.getName()+" as it should be");
> +        if (compClass != null && !(compClass.isInstance(uiComponent))) {
> +            throw new IllegalArgumentException("uiComponent : " + getPathToComponent(uiComponent) +
> +                " is not instance of " + compClass.getName() + " as it should be");
>          }
>      }
>
>
>      public static void renderChildren(FacesContext facesContext, UIComponent component)
> -            throws IOException
> -    {
> -        if (component.getChildCount() > 0)
> -        {
> -            for (Iterator it = component.getChildren().iterator(); it.hasNext(); )
> -            {
> -                UIComponent child = (UIComponent)it.next();
> +        throws IOException {
> +        if (component.getChildCount() > 0) {
> +            for (Iterator it = component.getChildren().iterator(); it.hasNext();) {
> +                UIComponent child = (UIComponent) it.next();
>                  renderChild(facesContext, child);
>              }
>          }
> @@ -424,33 +367,27 @@
>
>
>      public static void renderChild(FacesContext facesContext, UIComponent child)
> -            throws IOException
> -    {
> -        if (!child.isRendered())
> -        {
> +        throws IOException {
> +        if (!child.isRendered()) {
>              return;
>          }
>
>          child.encodeBegin(facesContext);
> -        if (child.getRendersChildren())
> -        {
> +        if (child.getRendersChildren()) {
>              child.encodeChildren(facesContext);
>          }
> -        else
> -        {
> +        else {
>              renderChildren(facesContext, child);
>          }
>          child.encodeEnd(facesContext);
>      }
>
>
> -
>      /**
>       * @param uiSelectOne
>       * @return List of SelectItem Objects
>       */
> -    public static List getSelectItemList(UISelectOne uiSelectOne)
> -    {
> +    public static List getSelectItemList(UISelectOne uiSelectOne) {
>          return internalGetSelectItemList(uiSelectOne);
>      }
>
> @@ -458,13 +395,11 @@
>       * @param uiSelectMany
>       * @return List of SelectItem Objects
>       */
> -    public static List getSelectItemList(UISelectMany uiSelectMany)
> -    {
> +    public static List getSelectItemList(UISelectMany uiSelectMany) {
>          return internalGetSelectItemList(uiSelectMany);
>      }
>
> -    private static List internalGetSelectItemList(UIComponent uiComponent)
> -    {
> +    private static List internalGetSelectItemList(UIComponent uiComponent) {
>          /* TODO: Shall we cache the list in a component attribute?
>          ArrayList list = (ArrayList)uiComponent.getAttributes().get(SELECT_ITEM_LIST_ATTR);
>          if (list != null)
> @@ -472,13 +407,12 @@
>              return list;
>          }
>           */
> -
> +
>          List list = new ArrayList();
> -
> -        for (Iterator iter = new SelectItemsIterator(uiComponent); iter.hasNext();)
> -        {
> -            list.add(iter.next());
> -        }
> +
> +        for (Iterator iter = new SelectItemsIterator(uiComponent); iter.hasNext();) {
> +            list.add(iter.next());
> +        }
>          return list;
>      }
>
> @@ -489,14 +423,13 @@
>       * easily used to determine if a select item is currently selected.
>       * Calling the contains method of this Set with the renderable (String converted) item value
>       * as argument returns true if this item is selected.
> +     *
>       * @param uiSelectMany
>       * @return Set containing all currently selected values
>       */
> -    public static Set getSubmittedValuesAsSet(FacesContext context, UIComponent component, Converter converter, UISelectMany uiSelectMany)
> -    {
> +    public static Set getSubmittedValuesAsSet(FacesContext context, UIComponent component, Converter converter, UISelectMany uiSelectMany) {
>          Object submittedValues = uiSelectMany.getSubmittedValue();
> -        if (submittedValues == null)
> -        {
> +        if (submittedValues == null) {
>              return null;
>          }
>
> @@ -510,11 +443,11 @@
>       * easily used to determine if a value is currently selected.
>       * Calling the contains method of this Set with the item value
>       * as argument returns true if this item is selected.
> +     *
>       * @param uiSelectMany
>       * @return Set containing all currently selected values
>       */
> -    public static Set getSelectedValuesAsSet(FacesContext context, UIComponent component, Converter converter, UISelectMany uiSelectMany)
> -    {
> +    public static Set getSelectedValuesAsSet(FacesContext context, UIComponent component, Converter converter, UISelectMany uiSelectMany) {
>          Object selectedValues = uiSelectMany.getValue();
>
>          return internalSubmittedOrSelectedValuesAsSet(context, component, converter, uiSelectMany, selectedValues);
> @@ -527,18 +460,20 @@
>       * Especially usefull for dealing with primitive types.
>       */
>      public static String getConvertedStringValue(FacesContext context,
> -            UIComponent component, Converter converter, Object value) {
> +                                                 UIComponent component, Converter converter, Object value) {
>          if (converter == null) {
>              if (value == null) {
>                  return "";
> -            } else if (value instanceof String) {
> +            }
> +            else if (value instanceof String) {
>                  return (String) value;
> -            } else {
> +            }
> +            else {
>                  throw new IllegalArgumentException(
> -                        "Value is no String (class=" + value.getClass().getName() + ", value=" + value + ") and component "
> -                                + component.getClientId(context) +"with path: "
> -                                + getPathToComponent(component)
> -                                + " does not have a Converter");
> +                    "Value is no String (class=" + value.getClass().getName() + ", value=" + value + ") and component "
> +                        + component.getClientId(context) + "with path: "
> +                        + getPathToComponent(component)
> +                        + " does not have a Converter");
>              }
>          }
>
> @@ -552,104 +487,85 @@
>       * Especially usefull for dealing with primitive types.
>       */
>      public static String getConvertedStringValue(FacesContext context,
> -            UIComponent component, Converter converter, SelectItem selectItem) {
> +                                                 UIComponent component, Converter converter, SelectItem selectItem) {
>          return getConvertedStringValue(context, component, converter, selectItem.getValue());
>      }
>
>
>      private static Set internalSubmittedOrSelectedValuesAsSet(FacesContext context,
> -            UIComponent component, Converter converter, UISelectMany uiSelectMany,
> -            Object values)
> -    {
> -        if (values == null || EMPTY_STRING.equals(values))
> -        {
> +                                                              UIComponent component, Converter converter, UISelectMany uiSelectMany,
> +                                                              Object values) {
> +        if (values == null || EMPTY_STRING.equals(values)) {
>              return Collections.EMPTY_SET;
>          }
> -        else if (values instanceof Object[])
> -        {
> +        else if (values instanceof Object[]) {
>              //Object array
> -            Object[] ar = (Object[])values;
> -            if (ar.length == 0)
> -            {
> +            Object[] ar = (Object[]) values;
> +            if (ar.length == 0) {
>                  return Collections.EMPTY_SET;
>              }
>
>              HashSet set = new HashSet(HashMapUtils.calcCapacity(ar.length));
> -            for (int i = 0; i < ar.length; i++)
> -            {
> -                set.add( getConvertedStringValue(context, component, converter, ar[i]) );
> +            for (int i = 0; i < ar.length; i++) {
> +                set.add(getConvertedStringValue(context, component, converter, ar[i]));
>              }
>              return set;
>          }
> -        else if (values.getClass().isArray())
> -        {
> +        else if (values.getClass().isArray()) {
>              //primitive array
>              int len = Array.getLength(values);
>              HashSet set = new HashSet(org.apache.myfaces.shared.util.HashMapUtils.calcCapacity(len));
> -            for (int i = 0; i < len; i++)
> -            {
> -                set.add( getConvertedStringValue(context, component, converter, Array.get(values,i)) );
> +            for (int i = 0; i < len; i++) {
> +                set.add(getConvertedStringValue(context, component, converter, Array.get(values, i)));
>              }
>              return set;
>          }
> -        else if (values instanceof List)
> -        {
> -            List lst = (List)values;
> -            if (lst.size() == 0)
> -            {
> +        else if (values instanceof List) {
> +            List lst = (List) values;
> +            if (lst.size() == 0) {
>                  return Collections.EMPTY_SET;
>              }
> -            else
> -            {
> +            else {
>                  HashSet set = new HashSet(HashMapUtils.calcCapacity(lst.size()));
> -                for(Iterator i =lst.iterator(); i.hasNext(); )
> -                    set.add( getConvertedStringValue(context, component, converter, i.next()) );
> +                for (Iterator i = lst.iterator(); i.hasNext();)
> +                    set.add(getConvertedStringValue(context, component, converter, i.next()));
>
>                  return set;
>              }
>          }
> -        else
> -        {
> +        else {
>              throw new IllegalArgumentException("Value of UISelectMany component with path : " + getPathToComponent(uiSelectMany) + " is not of type Array or List");
>          }
>      }
>
>
> -
>      public static Object getConvertedUIOutputValue(FacesContext facesContext,
>                                                     UIOutput output,
>                                                     Object submittedValue)
> -        throws ConverterException
> -    {
> -        if (submittedValue!=null && !(submittedValue instanceof String))
> -        {
> -            if(RendererUtils.NOTHING.equals(submittedValue))
> -            {
> +        throws ConverterException {
> +        if (submittedValue != null && !(submittedValue instanceof String)) {
> +            if (RendererUtils.NOTHING.equals(submittedValue)) {
>                  return null;
>              }
> -            throw new IllegalArgumentException("Submitted value of type String for component : "+
> -                    getPathToComponent(output)+"expected");
> +            throw new IllegalArgumentException("Submitted value of type String for component : " +
> +                getPathToComponent(output) + "expected");
>          }
>
>          Converter converter;
> -        try
> -        {
> +        try {
>              converter = findUIOutputConverter(facesContext, output);
>          }
> -        catch (FacesException e)
> -        {
> +        catch (FacesException e) {
>              throw new ConverterException(e);
>          }
>
> -        if (converter == null)
> -        {
> +        if (converter == null) {
>              //No conversion needed
>              return submittedValue;
>          }
> -        else
> -        {
> +        else {
>              //Conversion
> -            return converter.getAsObject(facesContext, output, (String)submittedValue);
> +            return converter.getAsObject(facesContext, output, (String) submittedValue);
>          }
>      }
>
> @@ -657,39 +573,33 @@
>      public static Object getConvertedUISelectManyValue(FacesContext facesContext,
>                                                         UISelectMany selectMany,
>                                                         Object submittedValue)
> -            throws ConverterException
> -    {
> -        if (submittedValue == null)
> -        {
> +        throws ConverterException {
> +        if (submittedValue == null) {
>              return null;
>          }
> -        else
> -        {
> -            if (!(submittedValue instanceof String[]))
> -            {
> +        else {
> +            if (!(submittedValue instanceof String[])) {
>                  throw new ConverterException("Submitted value of type String[] for component : "
> -                                             + getPathToComponent(selectMany) + "expected");
> +                    + getPathToComponent(selectMany) + "expected");
>              }
>          }
>          return org.apache.myfaces.shared.renderkit._SharedRendererUtils.getConvertedUISelectManyValue(facesContext,
> -                                                                  selectMany,
> -                                                                  (String[])submittedValue);
> +                                                                                                      selectMany,
> +                                                                                                      (String[]) submittedValue);
>      }
>
>
>      public static boolean getBooleanAttribute(UIComponent component,
>                                                String attrName,
> -                                              boolean defaultValue)
> -    {
> -        Boolean b = (Boolean)component.getAttributes().get(attrName);
> +                                              boolean defaultValue) {
> +        Boolean b = (Boolean) component.getAttributes().get(attrName);
>          return b != null ? b.booleanValue() : defaultValue;
>      }
>
>      public static int getIntegerAttribute(UIComponent component,
>                                            String attrName,
> -                                          int defaultValue)
> -    {
> -        Integer i = (Integer)component.getAttributes().get(attrName);
> +                                          int defaultValue) {
> +        Integer i = (Integer) component.getAttributes().get(attrName);
>          return i != null ? i.intValue() : defaultValue;
>      }
>
> @@ -698,12 +608,13 @@
>      private static final String ADF_FORM_COMPONENT_FAMILY = "oracle.adf.Form";
>
>
> -    /**Find the enclosing form of a component
> +    /**
> +     * Find the enclosing form of a component
>       * in the view-tree.
>       * All known form-families are searched for.
>       * Currently those are the standard form family,
>       * the Trinidad form family, and the (old) ADF Faces form family.
> -     *
> +     * <p/>
>       * There might be additional form families
>       * which have to be explicitly entered here.
>       *
> @@ -711,18 +622,15 @@
>       * @param facesContext
>       * @return FormInfo Information about the form - the form itself and its name.
>       */
> -    public static FormInfo findNestingForm(UIComponent uiComponent, FacesContext facesContext)
> -    {
> +    public static FormInfo findNestingForm(UIComponent uiComponent, FacesContext facesContext) {
>          UIComponent parent = uiComponent.getParent();
>          while (parent != null && (!FORM_COMPONENT_FAMILY.equals(parent.getFamily()) &&
> -                !ADF_FORM_COMPONENT_FAMILY.equals(parent.getFamily()) &&
> -                !TRINIDAD_FORM_COMPONENT_FAMILY.equals(parent.getFamily())))
> -        {
> +            !ADF_FORM_COMPONENT_FAMILY.equals(parent.getFamily()) &&
> +            !TRINIDAD_FORM_COMPONENT_FAMILY.equals(parent.getFamily()))) {
>              parent = parent.getParent();
>          }
>
> -        if (parent != null)
> -        {
> +        if (parent != null) {
>              //link is nested inside a form
>              String formName = parent.getClientId(facesContext);
>              return new FormInfo(parent, formName);
> @@ -732,20 +640,16 @@
>      }
>
>
> -    public static boolean getBooleanValue(String attribute, Object value, boolean defaultValue)
> -    {
> -        if(value instanceof Boolean)
> -        {
> +    public static boolean getBooleanValue(String attribute, Object value, boolean defaultValue) {
> +        if (value instanceof Boolean) {
>              return ((Boolean) value).booleanValue();
>          }
> -        else if(value instanceof String)
> -        {
> +        else if (value instanceof String) {
>              return Boolean.valueOf((String) value).booleanValue();
>          }
> -        else if(value != null)
> -        {
> -            log.error("value for attribute "+attribute+
> -                    " must be instanceof 'Boolean' or 'String', is of type : "+value.getClass());
> +        else if (value != null) {
> +            log.error("value for attribute " + attribute +
> +                " must be instanceof 'Boolean' or 'String', is of type : " + value.getClass());
>
>              return defaultValue;
>          }
> @@ -753,15 +657,13 @@
>          return defaultValue;
>      }
>
> -    public static void copyHtmlInputTextAttributes(HtmlInputText src, HtmlInputText dest)
> -    {
> +    public static void copyHtmlInputTextAttributes(HtmlInputText src, HtmlInputText dest) {
>          dest.setId(src.getId());
>          boolean forceId = getBooleanValue(
> -                JSFAttr.FORCE_ID_ATTR,
> -                src.getAttributes().get(JSFAttr.FORCE_ID_ATTR),
> -                false);
> -        if (forceId)
> -        {
> +            JSFAttr.FORCE_ID_ATTR,
> +            src.getAttributes().get(JSFAttr.FORCE_ID_ATTR),
> +            false);
> +        if (forceId) {
>              dest.getAttributes().put(JSFAttr.FORCE_ID_ATTR, Boolean.TRUE);
>          }
>          dest.setImmediate(src.isImmediate());
> @@ -799,57 +701,48 @@
>          dest.setValidator(src.getValidator());
>      }
>
> -    public static Integer getViewSequence(FacesContext facescontext)
> -    {
> +    public static Integer getViewSequence(FacesContext facescontext) {
>          Map map = facescontext.getExternalContext().getRequestMap();
>          Integer sequence = (Integer) map.get(SEQUENCE_PARAM);
> -        if(sequence == null)
> -        {
> +        if (sequence == null) {
>              sequence = new Integer(1);
>              map.put(SEQUENCE_PARAM, sequence);
>
> -            synchronized(facescontext.getExternalContext().getSession(true))
> -            {
> +            synchronized (facescontext.getExternalContext().getSession(true)) {
>                  facescontext.getExternalContext().getSessionMap().put(RendererUtils.SEQUENCE_PARAM, sequence);
>              }
>          }
>          return sequence;
>      }
>
> -    public static UIComponent findComponent(UIComponent headerComp, Class clazz)
> -    {
> -        if(clazz.isAssignableFrom(headerComp.getClass()))
> -        {
> +    public static UIComponent findComponent(UIComponent headerComp, Class clazz) {
> +        if (clazz.isAssignableFrom(headerComp.getClass())) {
>              return headerComp;
>          }
>
>          List li = headerComp.getChildren();
>
> -        for (int i = 0; i < li.size(); i++)
> -        {
> +        for (int i = 0; i < li.size(); i++) {
>              UIComponent comp = (UIComponent) li.get(i);
>
>              //recursively iterate through children to find the component
> -            UIComponent lookupComp = findComponent(comp,clazz);
> +            UIComponent lookupComp = findComponent(comp, clazz);
>
> -            if(lookupComp!=null)
> +            if (lookupComp != null)
>                  return lookupComp;
>          }
>
>          return null;
>      }
>
> -    public static void addOrReplaceChild(UIInput component, UIComponent child)
> -    {
> +    public static void addOrReplaceChild(UIInput component, UIComponent child) {
>          List li = component.getChildren();
>
> -        for (int i = 0; i < li.size(); i++)
> -        {
> +        for (int i = 0; i < li.size(); i++) {
>              UIComponent oldChild = (UIComponent) li.get(i);
>
> -            if(oldChild.getId()!=null&&oldChild.getId().equals(child.getId()))
> -            {
> -                li.set(i,child);
> +            if (oldChild.getId() != null && oldChild.getId().equals(child.getId())) {
> +                li.set(i, child);
>                  return;
>              }
>          }
> @@ -857,138 +750,119 @@
>          component.getChildren().add(child);
>      }
>
> -    public static String getClientId(FacesContext facesContext, UIComponent uiComponent, String forAttr)
> -    {
> +    public static String getClientId(FacesContext facesContext, UIComponent uiComponent, String forAttr) {
>          UIComponent forComponent = uiComponent.findComponent(forAttr);
> -        if (forComponent == null)
> -        {
> -            if (log.isInfoEnabled())
> -            {
> +        if (forComponent == null) {
> +            if (log.isInfoEnabled()) {
>                  log.info("Unable to find component '" + forAttr +
> -                        "' (calling findComponent on component '" + uiComponent.getClientId(facesContext) + "')."+
> -                        " We'll try to return a guessed client-id anyways -"+
> -                        " this will be a problem if you put the referenced component"+
> -                        " into a different naming-container. If this is the case, you can always use the full client-id.");
> +                    "' (calling findComponent on component '" + uiComponent.getClientId(facesContext) + "')." +
> +                    " We'll try to return a guessed client-id anyways -" +
> +                    " this will be a problem if you put the referenced component" +
> +                    " into a different naming-container. If this is the case, you can always use the full client-id.");
>              }
> -            if (forAttr.length() > 0 && forAttr.charAt(0) == UINamingContainer.SEPARATOR_CHAR)
> -            {
> +            if (forAttr.length() > 0 && forAttr.charAt(0) == UINamingContainer.SEPARATOR_CHAR) {
>                  //absolute id path
>                  return forAttr.substring(1);
>              }
> -            else
> -            {
> +            else {
>                  //relative id path, we assume a component on the same level as the label component
>                  String labelClientId = uiComponent.getClientId(facesContext);
>                  int colon = labelClientId.lastIndexOf(UINamingContainer.SEPARATOR_CHAR);
> -                if (colon == -1)
> -                {
> +                if (colon == -1) {
>                      return forAttr;
>                  }
> -                else
> -                {
> -                    return labelClientId.substring(0, colon + 1)+forAttr;
> +                else {
> +                    return labelClientId.substring(0, colon + 1) + forAttr;
>                  }
>              }
>          }
> -        else
> -        {
> +        else {
>              return forComponent.getClientId(facesContext);
>          }
>      }
>
> -    public static List convertIdsToClientIds(String actionFor, FacesContext facesContext, UIComponent component)
> -    {
> +    public static List convertIdsToClientIds(String actionFor, FacesContext facesContext, UIComponent component) {
>          List li = new ArrayList();
>
>          String[] ids = actionFor.split(",");
>
> -        for (int i = 0; i < ids.length; i++)
> -        {
> -            if(ids[i].equals("none"))
> +        for (int i = 0; i < ids.length; i++) {
> +            if (ids[i].equals("none"))
>                  li.add(ids[i]);
>              else
> -                li.add(RendererUtils.getClientId(facesContext,component,ids[i]));
> +                li.add(RendererUtils.getClientId(facesContext, component, ids[i]));
>          }
>          return li;
>      }
>
> -    public static List convertPhasesToPhasesIds(String actionForPhase)
> -    {
> +    public static List convertPhasesToPhasesIds(String actionForPhase) {
>          List li = new ArrayList();
>
> -        if(actionForPhase==null)
> -        {
> +        if (actionForPhase == null) {
>              return li;
>          }
>
>          String[] ids = actionForPhase.split(",");
>
> -        for (int i = 0; i < ids.length; i++)
> -        {
> -            if(ids[i].equals("PROCESS_VALIDATIONS"))
> -            {
> +        for (int i = 0; i < ids.length; i++) {
> +            if (ids[i].equals("PROCESS_VALIDATIONS")) {
>                  li.add(PhaseId.PROCESS_VALIDATIONS);
>              }
> -            else if(ids[i].equals("UPDATE_MODEL_VALUES"))
> -            {
> +            else if (ids[i].equals("UPDATE_MODEL_VALUES")) {
>                  li.add(PhaseId.UPDATE_MODEL_VALUES);
>              }
>          }
>          return li;
>      }
> -
> +
>      /**
>       * Helper method which loads a resource file (such as css) by a given context path and a file name.
>       * Useful to provide css files (or js files) inline.
> -     *
> -     * @param ctx <code>FacesContext</code> object to calculate the context path of the web application.
> +     *
> +     * @param ctx  <code>FacesContext</code> object to calculate the context path of the web application.
>       * @param file name of the resource file (e.g. <code>foo.css</code>).
>       * @return the content of the resource file, or <code>null</code> if no such file is available.
>       */
> -    public static Object loadResourceFile(FacesContext ctx, String file)
> -    {
> -
> -      String href = ctx.getExternalContext().getRequestContextPath()+file;
> -      if(log.isDebugEnabled())
> -         log.debug("loadFile: " + href);
> -
> -
> -      File resourceFile = new File(href);
> -      String content;
> -
> -
> -
> -      if (resourceFile.canRead())
> -      {
> -        FileInputStream in;
> -        try {
> -          in = new FileInputStream(resourceFile);
> -          byte[] fileBuffer = new byte[(int) resourceFile.length()];
> -          in.read(fileBuffer);
> -          in.close();
> -          content = new String(fileBuffer);
> -        }
> -        catch (FileNotFoundException e) {
> -               if(log.isWarnEnabled())
> -                       log.warn("no such file", e);
> -          content=null;
> -        }
> -        catch (IOException e) {
> -               if(log.isWarnEnabled())
> -                       log.warn("problems during writing file", e);
> -          e.printStackTrace();
> -          content=null;
> -        }
> -
> -      }
> -      else
> -      {
> -         if(log.isErrorEnabled())
> -                 log.error("File not readable: " + href);
> -         content=null;
> -      }
> -
> -      return content;
> +    public static Object loadResourceFile(FacesContext ctx, String file) {
> +
> +        String href = ctx.getExternalContext().getRequestContextPath() + file;
> +        if (log.isDebugEnabled())
> +            log.debug("loadFile: " + href);
> +
> +
> +        File resourceFile = new File(href);
> +        String content;
> +
> +
> +        if (resourceFile.canRead()) {
> +            FileInputStream in;
> +            try {
> +                in = new FileInputStream(resourceFile);
> +                byte[] fileBuffer = new byte[(int) resourceFile.length()];
> +                in.read(fileBuffer);
> +                in.close();
> +                content = new String(fileBuffer);
> +            }
> +            catch (FileNotFoundException e) {
> +                if (log.isWarnEnabled())
> +                    log.warn("no such file", e);
> +                content = null;
> +            }
> +            catch (IOException e) {
> +                if (log.isWarnEnabled())
> +                    log.warn("problems during writing file", e);
> +                e.printStackTrace();
> +                content = null;
> +            }
> +
> +        }
> +        else {
> +            if (log.isErrorEnabled())
> +                log.error("File not readable: " + href);
> +            content = null;
> +        }
> +
> +        return content;
>      }
>
>      /**
> @@ -996,24 +870,27 @@
>       * and initialize the request-map accordingly.
>       * SubForms will work with this information.
>       */
> -    public static void initPartialValidationAndModelUpdate(UIComponent component, FacesContext facesContext)
> -    {
> +    public static void initPartialValidationAndModelUpdate(UIComponent component, FacesContext facesContext) {
>          String actionFor = (String) component.getAttributes().get("actionFor");
>
> -        if(actionFor!=null)
> -        {
> +        if (actionFor != null) {
>              List li = convertIdsToClientIds(actionFor, facesContext, component);
>
> -            facesContext.getExternalContext().getRequestMap().put(ACTION_FOR_LIST,li);
> +            facesContext.getExternalContext().getRequestMap().put(ACTION_FOR_LIST, li);
>
>              String actionForPhase = (String) component.getAttributes().get("actionForPhase");
>
> -            if(actionForPhase!=null)
> -            {
> +            if (actionForPhase != null) {
>                  List phaseList = convertPhasesToPhasesIds(actionForPhase);
>
> -                facesContext.getExternalContext().getRequestMap().put(ACTION_FOR_PHASE_LIST,phaseList);
> +                facesContext.getExternalContext().getRequestMap().put(ACTION_FOR_PHASE_LIST, phaseList);
>              }
>          }
>      }
> +
> +    public static boolean isAdfOrTrinidadForm(UIComponent component) {
> +        return ADF_FORM_COMPONENT_FAMILY.equals(component.getFamily()) ||
> +            TRINIDAD_FORM_COMPONENT_FAMILY.equals(component.getFamily());
> +    }
> +
>  }
>
> Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java
> URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java?rev=434574&r1=434573&r2=434574&view=diff
> ==============================================================================
> --- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java (original)
> +++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java Thu Aug 24 16:52:09 2006
> @@ -41,41 +41,35 @@
>   * @version $Revision$ $Date$
>   */
>  public class HtmlButtonRendererBase
> -    extends HtmlRenderer
> -{
> +    extends HtmlRenderer {
>      private static final String IMAGE_BUTTON_SUFFIX_X = ".x";
>      private static final String IMAGE_BUTTON_SUFFIX_Y = ".y";
>
>      public static final String ACTION_FOR_LIST = "org.apache.myfaces.ActionForList";
>
> -    public void decode(FacesContext facesContext, UIComponent uiComponent)
> -    {
> +    public void decode(FacesContext facesContext, UIComponent uiComponent) {
>          org.apache.myfaces.shared.renderkit.RendererUtils.checkParamValidity(facesContext, uiComponent, UICommand.class);
>
>          //super.decode must not be called, because value is handled here
> -        if (!isReset(uiComponent) && isSubmitted(facesContext, uiComponent))
> -        {
> +        if (!isReset(uiComponent) && isSubmitted(facesContext, uiComponent)) {
>              uiComponent.queueEvent(new ActionEvent(uiComponent));
>
>              org.apache.myfaces.shared.renderkit.RendererUtils.initPartialValidationAndModelUpdate(uiComponent, facesContext);
>          }
>      }
>
> -    private static boolean isReset(UIComponent uiComponent)
> -    {
> +    private static boolean isReset(UIComponent uiComponent) {
>          return "reset".equalsIgnoreCase((String) uiComponent.getAttributes().get(HTML.TYPE_ATTR));
>      }
>
> -    private static boolean isSubmitted(FacesContext facesContext, UIComponent uiComponent)
> -    {
> +    private static boolean isSubmitted(FacesContext facesContext, UIComponent uiComponent) {
>          String clientId = uiComponent.getClientId(facesContext);
>          Map paramMap = facesContext.getExternalContext().getRequestParameterMap();
>          return paramMap.containsKey(clientId) || paramMap.containsKey(clientId + IMAGE_BUTTON_SUFFIX_X) || paramMap.containsKey(clientId + IMAGE_BUTTON_SUFFIX_Y);
>      }
>
>      public void encodeEnd(FacesContext facesContext, UIComponent uiComponent)
> -            throws IOException
> -    {
> +        throws IOException {
>          org.apache.myfaces.shared.renderkit.RendererUtils.checkParamValidity(facesContext, uiComponent, UICommand.class);
>
>          String clientId = uiComponent.getClientId(facesContext);
> @@ -91,143 +85,120 @@
>
>          ExternalContext externalContext = facesContext.getExternalContext();
>
> -        if (image != null)
> -        {
> +        if (image != null) {
>              writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_IMAGE, org.apache.myfaces.shared.renderkit.JSFAttr.TYPE_ATTR);
>              String src = facesContext.getApplication().getViewHandler().getResourceURL(
> -                    facesContext, image);
> +                facesContext, image);
>              writer.writeURIAttribute(HTML.SRC_ATTR, externalContext.encodeResourceURL(src),
>                                       org.apache.myfaces.shared.renderkit.JSFAttr.IMAGE_ATTR);
>          }
> -        else
> -        {
> +        else {
>              String type = getType(uiComponent);
>
> -            if (type == null)
> -            {
> +            if (type == null) {
>                  type = HTML.INPUT_TYPE_SUBMIT;
>              }
>              writer.writeAttribute(HTML.TYPE_ATTR, type, org.apache.myfaces.shared.renderkit.JSFAttr.TYPE_ATTR);
>              Object value = getValue(uiComponent);
> -            if (value != null)
> -            {
> +            if (value != null) {
>                  writer.writeAttribute(org.apache.myfaces.shared.renderkit.html.HTML.VALUE_ATTR, value, org.apache.myfaces.shared.renderkit.JSFAttr.VALUE_ATTR);
>              }
>          }
> -        if (JavascriptUtils.isJavascriptAllowed(externalContext))
> -        {
> +        if (JavascriptUtils.isJavascriptAllowed(externalContext)) {
>              StringBuffer onClick = buildOnClick(uiComponent, facesContext, writer);
>              writer.writeAttribute(HTML.ONCLICK_ATTR, onClick.toString(), null);
>              HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent,
>                                                     HTML.BUTTON_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_ONCLICK);
>          }
> -        else
> -        {
> +        else {
>              HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent,
>                                                     HTML.BUTTON_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED);
>          }
>
> -        if (isDisabled(facesContext, uiComponent))
> -        {
> +        if (isDisabled(facesContext, uiComponent)) {
>              writer.writeAttribute(HTML.DISABLED_ATTR, Boolean.TRUE, org.apache.myfaces.shared.renderkit.JSFAttr.DISABLED_ATTR);
>          }
>
>          writer.endElement(HTML.INPUT_ELEM);
>
>          HtmlFormRendererBase.renderScrollHiddenInputIfNecessary(
> -                findNestingForm(uiComponent, facesContext).getForm(),facesContext,writer);
> +            findNestingForm(uiComponent, facesContext).getForm(), facesContext, writer);
>      }
>
>
>      protected StringBuffer buildOnClick(UIComponent uiComponent, FacesContext facesContext, ResponseWriter writer)
> -        throws IOException
> -    {
> -       FormInfo formInfo = findNestingForm(uiComponent, facesContext);
> -       if (formInfo == null)
> -       {
> +        throws IOException {
> +        FormInfo formInfo = findNestingForm(uiComponent, facesContext);
> +        if (formInfo == null) {
>              throw new IllegalArgumentException("Component " + uiComponent.getClientId(facesContext) + " must be embedded in an form");
> -       }
> -       String formName = formInfo.getFormName();
> -       UIComponent nestingForm = formInfo.getForm();
> -
> +        }
> +        String formName = formInfo.getFormName();
> +        UIComponent nestingForm = formInfo.getForm();
> +
>          StringBuffer onClick = new StringBuffer();
> -        String commandOnClick = (String)uiComponent.getAttributes().get(HTML.ONCLICK_ATTR);
> +        String commandOnClick = (String) uiComponent.getAttributes().get(HTML.ONCLICK_ATTR);
>
> -        if (commandOnClick != null)
> -        {
> +        if (commandOnClick != null) {
>              onClick.append(commandOnClick);
>              onClick.append(';');
>          }
>
>          //call the script to clear the form (clearFormHiddenParams_<formName>) method
> -        HtmlRendererUtils.appendClearHiddenCommandFormParamsFunctionCall(onClick,formName);
> +        HtmlRendererUtils.appendClearHiddenCommandFormParamsFunctionCall(onClick, formName);
>
> -        if (MyfacesConfig.getCurrentInstance(facesContext.getExternalContext()).isAutoScroll())
> -        {
> +        if (MyfacesConfig.getCurrentInstance(facesContext.getExternalContext()).isAutoScroll()) {
>              org.apache.myfaces.shared.renderkit.html.util.JavascriptUtils.appendAutoScrollAssignment(onClick, formName);
>          }
>
>          //add hidden field for the case there is no commandLink in the form
> -        String hiddenFieldName = HtmlRendererUtils.getHiddenCommandLinkFieldName(formName);
> +        String hiddenFieldName = HtmlRendererUtils.getHiddenCommandLinkFieldName(formInfo);
>          addHiddenCommandParameter(facesContext, nestingForm, hiddenFieldName);
>
>          return onClick;
>      }
>
> -       protected void addHiddenCommandParameter(FacesContext facesContext, UIComponent nestingForm, String hiddenFieldName)
> -       {
> -               if (nestingForm != null)
> -        {
> +    protected void addHiddenCommandParameter(FacesContext facesContext, UIComponent nestingForm, String hiddenFieldName) {
> +        if (nestingForm != null) {
>              HtmlFormRendererBase.addHiddenCommandParameter(facesContext, nestingForm, hiddenFieldName);
>          }
> -       }
> +    }
>
>      /**
>       * find nesting form<br />
>       * need to be overrideable to deal with dummyForm stuff in tomahawk.
>       */
> -    protected FormInfo findNestingForm(UIComponent uiComponent, FacesContext facesContext)
> -    {
> -       return _ComponentUtils.findNestingForm(uiComponent, facesContext);
> +    protected FormInfo findNestingForm(UIComponent uiComponent, FacesContext facesContext) {
> +        return _ComponentUtils.findNestingForm(uiComponent, facesContext);
>      }
>
> -    protected boolean isDisabled(FacesContext facesContext, UIComponent uiComponent)
> -    {
> +    protected boolean isDisabled(FacesContext facesContext, UIComponent uiComponent) {
>          //TODO: overwrite in extended HtmlButtonRenderer and check for enabledOnUserRole
> -        if (uiComponent instanceof HtmlCommandButton)
> -        {
> -            return ((HtmlCommandButton)uiComponent).isDisabled();
> +        if (uiComponent instanceof HtmlCommandButton) {
> +            return ((HtmlCommandButton) uiComponent).isDisabled();
>          }
> -        else
> -        {
> +        else {
>              return org.apache.myfaces.shared.renderkit.RendererUtils.getBooleanAttribute(uiComponent, HTML.DISABLED_ATTR, false);
>          }
>      }
>
>
> -    private String getImage(UIComponent uiComponent)
> -    {
> -        if (uiComponent instanceof HtmlCommandButton)
> -        {
> -            return ((HtmlCommandButton)uiComponent).getImage();
> +    private String getImage(UIComponent uiComponent) {
> +        if (uiComponent instanceof HtmlCommandButton) {
> +            return ((HtmlCommandButton) uiComponent).getImage();
>          }
> -        return (String)uiComponent.getAttributes().get(JSFAttr.IMAGE_ATTR);
> +        return (String) uiComponent.getAttributes().get(JSFAttr.IMAGE_ATTR);
>      }
>
> -    private String getType(UIComponent uiComponent)
> -    {
> -        if (uiComponent instanceof HtmlCommandButton)
> -        {
> -            return ((HtmlCommandButton)uiComponent).getType();
> +    private String getType(UIComponent uiComponent) {
> +        if (uiComponent instanceof HtmlCommandButton) {
> +            return ((HtmlCommandButton) uiComponent).getType();
>          }
> -        return (String)uiComponent.getAttributes().get(org.apache.myfaces.shared.renderkit.JSFAttr.TYPE_ATTR);
> +        return (String) uiComponent.getAttributes().get(org.apache.myfaces.shared.renderkit.JSFAttr.TYPE_ATTR);
>      }
>
> -    private Object getValue(UIComponent uiComponent)
> -    {
> -        if (uiComponent instanceof ValueHolder)
> -        {
> -            return ((ValueHolder)uiComponent).getValue();
> +    private Object getValue(UIComponent uiComponent) {
> +        if (uiComponent instanceof ValueHolder) {
> +            return ((ValueHolder) uiComponent).getValue();
>          }
>          return uiComponent.getAttributes().get(JSFAttr.VALUE_ATTR);
>      }
>
> Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
> URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java?rev=434574&r1=434573&r2=434574&view=diff
> ==============================================================================
> --- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java (original)
> +++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java Thu Aug 24 16:52:09 2006
> @@ -43,64 +43,55 @@
>   * @version $Revision$ $Date$
>   */
>  public abstract class HtmlLinkRendererBase
> -    extends HtmlRenderer
> -{
> -    public static final String URL_STATE_MARKER      = "JSF_URL_STATE_MARKER=DUMMY";
> -    public static final int    URL_STATE_MARKER_LEN  = URL_STATE_MARKER.length();
> +    extends HtmlRenderer {
> +    public static final String URL_STATE_MARKER = "JSF_URL_STATE_MARKER=DUMMY";
> +    public static final int URL_STATE_MARKER_LEN = URL_STATE_MARKER.length();
>
>      //private static final Log log = LogFactory.getLog(HtmlLinkRenderer.class);
>
> -    public boolean getRendersChildren()
> -    {
> +    public boolean getRendersChildren() {
>          // We must be able to render the children without a surrounding anchor
>          // if the Link is disabled
>          return true;
>      }
>
> -    public void decode(FacesContext facesContext, UIComponent component)
> -    {
> +    public void decode(FacesContext facesContext, UIComponent component) {
>          super.decode(facesContext, component);  //check for NP
>
> -        if (component instanceof UICommand)
> -        {
> +        if (component instanceof UICommand) {
>              String clientId = component.getClientId(facesContext);
> -            String reqValue = (String)facesContext.getExternalContext().getRequestParameterMap().get(HtmlRendererUtils.getHiddenCommandLinkFieldName(findNestingForm(component, facesContext).getFormName()));
> -            if (reqValue != null && reqValue.equals(clientId))
> -            {
> +            FormInfo formInfo = findNestingForm(component, facesContext);
> +            String reqValue = (String) facesContext.getExternalContext().getRequestParameterMap().get(
> +                HtmlRendererUtils.getHiddenCommandLinkFieldName(formInfo));
> +            if (reqValue != null && reqValue.equals(clientId)) {
>                  component.queueEvent(new ActionEvent(component));
>
>                  RendererUtils.initPartialValidationAndModelUpdate(component, facesContext);
>              }
>          }
> -        else if (component instanceof UIOutput)
> -        {
> +        else if (component instanceof UIOutput) {
>              //do nothing
>          }
> -        else
> -        {
> +        else {
>              throw new IllegalArgumentException("Unsupported component class " + component.getClass().getName());
>          }
>      }
>
>
> -    public void encodeBegin(FacesContext facesContext, UIComponent component) throws IOException
> -    {
> +    public void encodeBegin(FacesContext facesContext, UIComponent component) throws IOException {
>          super.encodeBegin(facesContext, component);  //check for NP
>
> -        if (component instanceof UICommand)
> -        {
> +        if (component instanceof UICommand) {
>              renderCommandLinkStart(facesContext, component,
>                                     component.getClientId(facesContext),
> -                                   ((UICommand)component).getValue(),
> +                                   ((UICommand) component).getValue(),
>                                     getStyle(facesContext, component),
>                                     getStyleClass(facesContext, component));
>          }
> -        else if (component instanceof UIOutput)
> -        {
> -            renderOutputLinkStart(facesContext, (UIOutput)component);
> +        else if (component instanceof UIOutput) {
> +            renderOutputLinkStart(facesContext, (UIOutput) component);
>          }
> -        else
> -        {
> +        else {
>              throw new IllegalArgumentException("Unsupported component class " + component.getClass().getName());
>          }
>      }
> @@ -109,55 +100,44 @@
>      /**
>       * Can be overwritten by derived classes to overrule the style to be used.
>       */
> -    protected String getStyle(FacesContext facesContext, UIComponent link)
> -    {
> -        if (link instanceof HtmlCommandLink)
> -        {
> -            return ((HtmlCommandLink)link).getStyle();
> -        }
> -        else
> -        {
> -            return (String)link.getAttributes().get(HTML.STYLE_ATTR);
> +    protected String getStyle(FacesContext facesContext, UIComponent link) {
> +        if (link instanceof HtmlCommandLink) {
> +            return ((HtmlCommandLink) link).getStyle();
> +        }
> +        else {
> +            return (String) link.getAttributes().get(HTML.STYLE_ATTR);
>          }
>      }
>
>      /**
>       * Can be overwritten by derived classes to overrule the style class to be used.
>       */
> -    protected String getStyleClass(FacesContext facesContext, UIComponent link)
> -    {
> -        if (link instanceof HtmlCommandLink)
> -        {
> -            return ((HtmlCommandLink)link).getStyleClass();
> +    protected String getStyleClass(FacesContext facesContext, UIComponent link) {
> +        if (link instanceof HtmlCommandLink) {
> +            return ((HtmlCommandLink) link).getStyleClass();
>          }
> -        else
> -        {
> -            return (String)link.getAttributes().get(HTML.STYLE_CLASS_ATTR);
> +        else {
> +            return (String) link.getAttributes().get(HTML.STYLE_CLASS_ATTR);
>          }
>      }
>
> -    public void encodeChildren(FacesContext facesContext, UIComponent component) throws IOException
> -    {
> +    public void encodeChildren(FacesContext facesContext, UIComponent component) throws IOException {
>          RendererUtils.renderChildren(facesContext, component);
>      }
>
> -    public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException
> -    {
> +    public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
>          super.encodeEnd(facesContext, component);  //check for NP
>
> -        if (component instanceof UICommand)
> -        {
> -                renderCommandLinkEnd(facesContext, component);
> +        if (component instanceof UICommand) {
> +            renderCommandLinkEnd(facesContext, component);
>
> -                HtmlFormRendererBase.renderScrollHiddenInputIfNecessary(
> -                        findNestingForm(component,facesContext).getForm(),facesContext,facesContext.getResponseWriter());
> +            HtmlFormRendererBase.renderScrollHiddenInputIfNecessary(
> +                findNestingForm(component, facesContext).getForm(), facesContext, facesContext.getResponseWriter());
>          }
> -        else if (component instanceof UIOutput)
> -        {
> +        else if (component instanceof UIOutput) {
>              renderOutputLinkEnd(facesContext, component);
>          }
> -        else
> -        {
> +        else {
>              throw new IllegalArgumentException("Unsupported component class " + component.getClass().getName());
>          }
>      }
> @@ -167,18 +147,15 @@
>                                            Object value,
>                                            String style,
>                                            String styleClass)
> -            throws IOException
> -    {
> +        throws IOException {
>          ResponseWriter writer = facesContext.getResponseWriter();
>
>          String[] anchorAttrsToRender;
> -        if (JavascriptUtils.isJavascriptAllowed(facesContext.getExternalContext()))
> -        {
> +        if (JavascriptUtils.isJavascriptAllowed(facesContext.getExternalContext())) {
>              renderJavaScriptAnchorStart(facesContext, writer, component, clientId);
>              anchorAttrsToRender = HTML.ANCHOR_PASSTHROUGH_ATTRIBUTES_WITHOUT_ONCLICK_WITHOUT_STYLE;
>          }
> -        else
> -        {
> +        else {
>              renderNonJavaScriptAnchorStart(facesContext, writer, component, clientId);
>              anchorAttrsToRender = HTML.ANCHOR_PASSTHROUGH_ATTRIBUTES_WITHOUT_STYLE;
>          }
> @@ -192,8 +169,7 @@
>                                                styleClass);
>
>          // render value as required by JSF 1.1 renderkitdocs
> -        if(value != null)
> -        {
> +        if (value != null) {
>              writer.writeText(value.toString(), JSFAttr.VALUE_ATTR);
>          }
>      }
> @@ -202,93 +178,93 @@
>                                                 ResponseWriter writer,
>                                                 UIComponent component,
>                                                 String clientId)
> -        throws IOException
> -    {
> +        throws IOException {
>          //Find form
> -       FormInfo formInfo = findNestingForm(component, facesContext);
> -       if (formInfo == null)
> -       {
> +        FormInfo formInfo = findNestingForm(component, facesContext);
> +        if (formInfo == null) {
>              String path = RendererUtils.getPathToComponent(component);
>              String msg = "Link is not embedded in a form. Change component/tag '" + clientId + "' from javax.faces.*/<h:tagName /> " +
> -                    "to org.apache.myfaces.*/<t:tagName />, or embed it in a form.  This is not a bug. " +
> -                    "Please see: http://wiki.apache.org/myfaces/Upgrading_to_Tomahawk_1.1.3 " +
> -                    "The path to this component is " + path +". If you need to render a special form and a JSF-form's attributes are not enough,"+
> -                    "consider using the s:form tag of the MyFaces sandbox.";
> +                "to org.apache.myfaces.*/<t:tagName />, or embed it in a form.  This is not a bug. " +
> +                "Please see: http://wiki.apache.org/myfaces/Upgrading_to_Tomahawk_1.1.3 " +
> +                "The path to this component is " + path + ". If you need to render a special form and a JSF-form's attributes are not enough," +
> +                "consider using the s:form tag of the MyFaces sandbox.";
>              throw new IllegalArgumentException(msg);
> -       }
> -       UIComponent nestingForm = formInfo.getForm();
> +        }
> +        UIComponent nestingForm = formInfo.getForm();
>          String formName = formInfo.getFormName();
>
>          StringBuffer onClick = new StringBuffer();
>
>          String commandOnclick;
> -        if (component instanceof HtmlCommandLink)
> -        {
> -            commandOnclick = ((HtmlCommandLink)component).getOnclick();
> -        }
> -        else
> -        {
> -            commandOnclick = (String)component.getAttributes().get(HTML.ONCLICK_ATTR);
> +        if (component instanceof HtmlCommandLink) {
> +            commandOnclick = ((HtmlCommandLink) component).getOnclick();
> +        }
> +        else {
> +            commandOnclick = (String) component.getAttributes().get(HTML.ONCLICK_ATTR);
>          }
> -        if (commandOnclick != null)
> -        {
> +        if (commandOnclick != null) {
>              onClick.append(commandOnclick);
>              onClick.append(';');
>          }
>
> -        //call the script to clear the form (clearFormHiddenParams_<formName>) method
> -        HtmlRendererUtils.appendClearHiddenCommandFormParamsFunctionCall(onClick,formName);
> +        if (RendererUtils.isAdfOrTrinidadForm(formInfo.getForm())) {
> +            onClick.append("submitForm('");
> +            onClick.append(formInfo.getForm().getClientId(facesContext));
> +            onClick.append("',1,{source:'");
> +            onClick.append(component.getClientId(facesContext));
> +            onClick.append("'});return false;");
> +        }
> +        else {
> +            //call the script to clear the form (clearFormHiddenParams_<formName>) method
> +            HtmlRendererUtils.appendClearHiddenCommandFormParamsFunctionCall(onClick, formName);
>
> -        String jsForm = "document.forms['" + formName + "']";
> +            String jsForm = "document.forms['" + formName + "']";
>
> -        if (MyfacesConfig.getCurrentInstance(facesContext.getExternalContext()).isAutoScroll())
> -        {
> -            org.apache.myfaces.shared.renderkit.html.util.JavascriptUtils.appendAutoScrollAssignment(onClick, formName);
> -        }
> +            if (MyfacesConfig.getCurrentInstance(facesContext.getExternalContext()).isAutoScroll()) {
> +                org.apache.myfaces.shared.renderkit.html.util.JavascriptUtils.appendAutoScrollAssignment(onClick, formName);
> +            }
>
> -        //add id parameter for decode
> -        String hiddenFieldName = HtmlRendererUtils.getHiddenCommandLinkFieldName(formName);
> -        onClick.append(jsForm);
> -        onClick.append(".elements['").append(hiddenFieldName).append("']");
> -        onClick.append(".value='").append(clientId).append("';");
> -        addHiddenCommandParameter(facesContext, nestingForm, hiddenFieldName);
> -
> -        //add child parameters
> -        for (Iterator it = getChildren(component).iterator(); it.hasNext(); )
> -        {
> -            UIComponent child = (UIComponent)it.next();
> -            if (child instanceof UIParameter)
> -            {
> -                String name = ((UIParameter)child).getName();
> -                Object value = ((UIParameter)child).getValue();
> +            //add id parameter for decode
> +            String hiddenFieldName = HtmlRendererUtils.getHiddenCommandLinkFieldName(formInfo);
> +            onClick.append(jsForm);
> +            onClick.append(".elements['").append(hiddenFieldName).append("']");
> +            onClick.append(".value='").append(clientId).append("';");
> +            addHiddenCommandParameter(facesContext, nestingForm, hiddenFieldName);
> +
> +            //add child parameters
> +            for (Iterator it = getChildren(component).iterator(); it.hasNext();) {
> +                UIComponent child = (UIComponent) it.next();
> +                if (child instanceof UIParameter) {
> +                    String name = ((UIParameter) child).getName();
> +                    Object value = ((UIParameter) child).getValue();
>
> -                renderLinkParameter(name, value, onClick, jsForm, nestingForm);
> +                    renderLinkParameter(name, value, onClick, jsForm, nestingForm);
> +                }
>              }
> -        }
>
> -        // for performance reason: double check for the target attribute
> -        String target = null;
> -        if (component instanceof HtmlCommandLink)
> -        {
> -            target = ((HtmlCommandLink)component).getTarget();
> -        }
> -        else
> -        {
> -            target = (String)component.getAttributes().get(HTML.TARGET_ATTR);
> -        }
> -        if (target != null && target.trim().length() > 0) {
> +            // for performance reason: double check for the target attribute
> +            String target = null;
> +            if (component instanceof HtmlCommandLink) {
> +                target = ((HtmlCommandLink) component).getTarget();
> +            }
> +            else {
> +                target = (String) component.getAttributes().get(HTML.TARGET_ATTR);
> +            }
> +            if (target != null && target.trim().length() > 0) {
> +                onClick.append(jsForm);
> +                onClick.append(".target='");
> +                onClick.append(target);
> +                onClick.append("';");
> +            }
> +
> +            // onSubmit
> +            onClick.append("if(").append(jsForm).append(".onsubmit){var result=").append(jsForm).append(".onsubmit();  if( (typeof result == 'undefined') || result ) {" + jsForm + ".submit();}}else{");
> +
> +            //submit
>              onClick.append(jsForm);
> -            onClick.append(".target='");
> -            onClick.append(target);
> -            onClick.append("';");
> +            onClick.append(".submit();}return false;");  //return false, so that browser does not handle the click
>          }
>
> -        // onSubmit
> -        onClick.append("if(").append(jsForm).append(".onsubmit){var result=").append(jsForm).append(".onsubmit();  if( (typeof result == 'undefined') || result ) {"+jsForm+".submit();}}else{");
> -
> -        //submit
> -        onClick.append(jsForm);
> -        onClick.append(".submit();}return false;");  //return false, so that browser does not handle the click
>
>          writer.startElement(HTML.ANCHOR_ELEM, component);
>          writer.writeURIAttribute(HTML.HREF_ATTR, "#", null);
> @@ -299,26 +275,22 @@
>       * find nesting form<br />
>       * need to be overrideable to deal with dummyForm stuff in tomahawk.
>       */
> -    protected FormInfo findNestingForm(UIComponent uiComponent, FacesContext facesContext)
> -    {
> -       return _ComponentUtils.findNestingForm(uiComponent, facesContext);
> -    }
> -
> -       protected void addHiddenCommandParameter(FacesContext facesContext, UIComponent nestingForm, String hiddenFieldName)
> -       {
> -               if (nestingForm != null)
> -        {
> +    protected FormInfo findNestingForm(UIComponent uiComponent, FacesContext facesContext) {
> +        return _ComponentUtils.findNestingForm(uiComponent, facesContext);
> +    }
> +
> +    protected void addHiddenCommandParameter(FacesContext facesContext, UIComponent nestingForm, String hiddenFieldName) {
> +        if (nestingForm != null) {
>              HtmlFormRendererBase.addHiddenCommandParameter(facesContext, nestingForm, hiddenFieldName);
>          }
> -       }
> +    }
>
>
>      protected void renderNonJavaScriptAnchorStart(FacesContext facesContext,
>                                                    ResponseWriter writer,
>                                                    UIComponent component,
>                                                    String clientId)
> -        throws IOException
> -    {
> +        throws IOException {
>          ViewHandler viewHandler = facesContext.getApplication().getViewHandler();
>          String viewId = facesContext.getViewRoot().getViewId();
>          String path = viewHandler.getActionURL(facesContext, viewId);
> @@ -327,21 +299,18 @@
>
>          //add clientId parameter for decode
>
> -        if (path.indexOf('?') == -1)
> -        {
> +        if (path.indexOf('?') == -1) {
>              hrefBuf.append('?');
>          }
> -        else
> -        {
> +        else {
>              hrefBuf.append('&');
>          }
> -        String hiddenFieldName = HtmlRendererUtils.getHiddenCommandLinkFieldName(findNestingForm(component, facesContext).getFormName());
> +        String hiddenFieldName = HtmlRendererUtils.getHiddenCommandLinkFieldName(findNestingForm(component, facesContext));
>          hrefBuf.append(hiddenFieldName);
>          hrefBuf.append('=');
>          hrefBuf.append(clientId);
>
> -        if (getChildCount(component) > 0)
> -        {
> +        if (getChildCount(component) > 0) {
>              addChildParametersToHref(component, hrefBuf,
>                                       false, //not the first url parameter
>                                       writer.getCharacterEncoding());
> @@ -349,12 +318,10 @@
>
>          StateManager stateManager = facesContext.getApplication().getStateManager();
>          hrefBuf.append("&");
> -        if (stateManager.isSavingStateInClient(facesContext))
> -        {
> +        if (stateManager.isSavingStateInClient(facesContext)) {
>              hrefBuf.append(URL_STATE_MARKER);
>          }
> -        else
> -        {
> +        else {
>              hrefBuf.append(RendererUtils.SEQUENCE_PARAM);
>              hrefBuf.append('=');
>              hrefBuf.append(org.apache.myfaces.shared.renderkit.RendererUtils.getViewSequence(facesContext));
> @@ -370,15 +337,12 @@
>                                            StringBuffer hrefBuf,
>                                            boolean firstParameter,
>                                            String charEncoding)
> -            throws IOException
> -    {
> -        for (Iterator it = getChildren(linkComponent).iterator(); it.hasNext(); )
> -        {
> -            UIComponent child = (UIComponent)it.next();
> -            if (child instanceof UIParameter)
> -            {
> -                String name = ((UIParameter)child).getName();
> -                Object value = ((UIParameter)child).getValue();
> +        throws IOException {
> +        for (Iterator it = getChildren(linkComponent).iterator(); it.hasNext();) {
> +            UIComponent child = (UIComponent) it.next();
> +            if (child instanceof UIParameter) {
> +                String name = ((UIParameter) child).getName();
> +                Object value = ((UIParameter) child).getValue();
>
>                  addParameterToHref(name, value, hrefBuf, firstParameter, charEncoding);
>                  firstParameter = false;
> @@ -387,14 +351,12 @@
>      }
>
>      protected void renderOutputLinkStart(FacesContext facesContext, UIOutput output)
> -            throws IOException
> -    {
> +        throws IOException {
>          ResponseWriter writer = facesContext.getResponseWriter();
>
>          //calculate href
>          String href = org.apache.myfaces.shared.renderkit.RendererUtils.getStringValue(facesContext, output);
> -        if (getChildCount(output) > 0)
> -        {
> +        if (getChildCount(output) > 0) {
>              StringBuffer hrefBuf = new StringBuffer(href);
>              addChildParametersToHref(output, hrefBuf,
>                                       (href.indexOf('?') == -1), //first url parameter?
> @@ -418,10 +380,8 @@
>                                       Object value,
>                                       StringBuffer onClick,
>                                       String jsForm,
> -                                     UIComponent nestingForm)
> -    {
> -        if (name == null)
> -        {
> +                                     UIComponent nestingForm) {
> +        if (name == null) {
>              throw new IllegalArgumentException("Unnamed parameter value not allowed within command link.");
>          }
>          onClick.append(jsForm);
> @@ -434,18 +394,15 @@
>      }
>
>      private static void addParameterToHref(String name, Object value, StringBuffer hrefBuf, boolean firstParameter, String charEncoding)
> -            throws UnsupportedEncodingException
> -    {
> -        if (name == null)
> -        {
> +        throws UnsupportedEncodingException {
> +        if (name == null) {
>              throw new IllegalArgumentException("Unnamed parameter value not allowed within command link.");
>          }
>
>          hrefBuf.append(firstParameter ? '?' : '&');
>          hrefBuf.append(URLEncoder.encode(name, charEncoding));
>          hrefBuf.append('=');
> -        if (value != null)
> -        {
> +        if (value != null) {
>              //UIParameter is no ConvertibleValueHolder, so no conversion possible
>              hrefBuf.append(URLEncoder.encode(value.toString(), charEncoding));
>          }
> @@ -453,8 +410,7 @@
>
>
>      protected void renderOutputLinkEnd(FacesContext facesContext, UIComponent component)
> -            throws IOException
> -    {
> +        throws IOException {
>          ResponseWriter writer = facesContext.getResponseWriter();
>          // force separate end tag
>          writer.writeText("", null);
> @@ -462,9 +418,8 @@
>      }
>
>      protected void renderCommandLinkEnd(FacesContext facesContext, UIComponent component)
> -            throws IOException
> -    {
> -            renderOutputLinkEnd(facesContext, component);
> +        throws IOException {
> +        renderOutputLinkEnd(facesContext, component);
>      }
>
>  }
>
>
>