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

svn commit: r1200044 [4/7] - in /myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared: application/ component/ config/ context/flash/ renderkit/ renderkit/html/ renderkit/html/util/ resource/ taglib/ test/ util/ util/el/ util/servlet/ view...

Modified: myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java?rev=1200044&r1=1200043&r2=1200044&view=diff
==============================================================================
--- myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java (original)
+++ myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java Wed Nov  9 23:44:02 2011
@@ -78,9 +78,11 @@ import org.apache.myfaces.shared.renderk
  * @author Manfred Geiler (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
-public final class HtmlRendererUtils {
+public final class HtmlRendererUtils
+{
     //private static final Log log = LogFactory.getLog(HtmlRendererUtils.class);
-    private static final Logger log = Logger.getLogger(HtmlRendererUtils.class.getName());
+    private static final Logger log = Logger.getLogger(HtmlRendererUtils.class
+            .getName());
 
     //private static final String[] EMPTY_STRING_ARRAY = new String[0];
     private static final String LINE_SEPARATOR = System.getProperty(
@@ -91,8 +93,7 @@ public final class HtmlRendererUtils {
     public static final String HIDDEN_COMMANDLINK_FIELD_NAME_MYFACES_OLD = "_link_hidden_";
     public static final String HIDDEN_COMMANDLINK_FIELD_NAME_TRINIDAD = "source";
 
-    public static final String CLEAR_HIDDEN_FIELD_FN_NAME =
-            "clearFormHiddenParams";
+    public static final String CLEAR_HIDDEN_FIELD_FN_NAME = "clearFormHiddenParams";
     public static final String SUBMIT_FORM_FN_NAME = "oamSubmitForm";
     public static final String SUBMIT_FORM_FN_NAME_JSF2 = "myfaces.oam.submitForm";
     public static final String ALLOW_CDATA_SECTION_ON = "org.apache.myfaces.ResponseWriter.CdataSectionOn";
@@ -106,7 +107,7 @@ public final class HtmlRendererUtils {
 
     private static final String FIRST_SUBMIT_SCRIPT_ON_PAGE = "org.apache.MyFaces.FIRST_SUBMIT_SCRIPT_ON_PAGE";
 
-    public static final String NON_SUBMITTED_VALUE_WARNING
+    public static final String NON_SUBMITTED_VALUE_WARNING 
             = "There should always be a submitted value for an input if it is rendered,"
             + " its form is submitted, and it was not originally rendered disabled or read-only."
             + "  You cannot submit a form after disabling an input element via javascript."
@@ -114,8 +115,8 @@ public final class HtmlRendererUtils {
             + " or resetting the disabled value back to false prior to form submission.";
     private static final String STR_EMPTY = "";
 
-
-    private HtmlRendererUtils() {
+    private HtmlRendererUtils()
+    {
         // utility class, do not instantiate
     }
 
@@ -128,8 +129,10 @@ public final class HtmlRendererUtils {
      * set if the submitted form contained that component.
      */
     public static void decodeUIInput(FacesContext facesContext,
-                                     UIComponent component) {
-        if (!(component instanceof EditableValueHolder)) {
+            UIComponent component)
+    {
+        if (!(component instanceof EditableValueHolder))
+        {
             throw new IllegalArgumentException("Component "
                     + component.getClientId(facesContext)
                     + " is not an EditableValueHolder");
@@ -143,13 +146,15 @@ public final class HtmlRendererUtils {
             return;
         }
 
-        if (paramMap.containsKey(clientId)) {
+        if (paramMap.containsKey(clientId))
+        {
             ((EditableValueHolder) component).setSubmittedValue(paramMap
                     .get(clientId));
-        } else {
-            log.warning(NON_SUBMITTED_VALUE_WARNING +
-                    " Component : " +
-                    RendererUtils.getPathToComponent(component));
+        }
+        else
+        {
+            log.warning(NON_SUBMITTED_VALUE_WARNING + " Component : "
+                    + RendererUtils.getPathToComponent(component));
         }
     }
 
@@ -160,8 +165,10 @@ public final class HtmlRendererUtils {
      * @param component
      */
     public static void decodeUISelectBoolean(FacesContext facesContext,
-                                             UIComponent component) {
-        if (!(component instanceof EditableValueHolder)) {
+            UIComponent component)
+    {
+        if (!(component instanceof EditableValueHolder))
+        {
             throw new IllegalArgumentException("Component "
                     + component.getClientId(facesContext)
                     + " is not an EditableValueHolder");
@@ -175,39 +182,48 @@ public final class HtmlRendererUtils {
         Map paramMap = facesContext.getExternalContext()
                 .getRequestParameterMap();
         String clientId = component.getClientId(facesContext);
-        if (paramMap.containsKey(clientId)) {
+        if (paramMap.containsKey(clientId))
+        {
             String reqValue = (String) paramMap.get(clientId);
             if ((reqValue.equalsIgnoreCase("on")
                     || reqValue.equalsIgnoreCase("yes") || reqValue
-                    .equalsIgnoreCase("true"))) {
+                    .equalsIgnoreCase("true")))
+            {
                 ((EditableValueHolder) component)
                         .setSubmittedValue(Boolean.TRUE);
-            } else {
+            }
+            else
+            {
                 ((EditableValueHolder) component)
                         .setSubmittedValue(Boolean.FALSE);
             }
-        } else {
-            ((EditableValueHolder) component)
-                    .setSubmittedValue(Boolean.FALSE);
+        }
+        else
+        {
+            ((EditableValueHolder) component).setSubmittedValue(Boolean.FALSE);
         }
     }
 
-    public static boolean isDisabledOrReadOnly(UIComponent component) {
-        return isDisplayValueOnly(component) ||
-                isDisabled(component) ||
-                isReadOnly(component);
+    public static boolean isDisabledOrReadOnly(UIComponent component)
+    {
+        return isDisplayValueOnly(component) || isDisabled(component)
+                || isReadOnly(component);
     }
 
-    public static boolean isDisabled(UIComponent component) {
+    public static boolean isDisabled(UIComponent component)
+    {
         return isTrue(component.getAttributes().get("disabled"));
     }
 
-    public static boolean isReadOnly(UIComponent component) {
+    public static boolean isReadOnly(UIComponent component)
+    {
         return isTrue(component.getAttributes().get("readonly"));
     }
 
-    private static boolean isTrue(Object obj) {
-        if (obj instanceof String) {
+    private static boolean isTrue(Object obj)
+    {
+        if (obj instanceof String)
+        {
             return new Boolean((String) obj);
         }
 
@@ -226,8 +242,10 @@ public final class HtmlRendererUtils {
      * @param component
      */
     public static void decodeUISelectMany(FacesContext facesContext,
-                                          UIComponent component) {
-        if (!(component instanceof EditableValueHolder)) {
+            UIComponent component)
+    {
+        if (!(component instanceof EditableValueHolder))
+        {
             throw new IllegalArgumentException("Component "
                     + component.getClientId(facesContext)
                     + " is not an EditableValueHolder");
@@ -241,17 +259,21 @@ public final class HtmlRendererUtils {
             return;
         }
 
-        if (paramValuesMap.containsKey(clientId)) {
+        if (paramValuesMap.containsKey(clientId))
+        {
             String[] reqValues = (String[]) paramValuesMap.get(clientId);
             ((EditableValueHolder) component).setSubmittedValue(reqValues);
-        } else {
+        }
+        else
+        {
             /* request parameter not found, nothing to decode - set submitted value to an empty array
                as we should get here only if the component is on a submitted form, is rendered
                and if the component is not readonly or has not been disabled.
 
                So in fact, there must be component value at this location, but for listboxes, comboboxes etc.
                the submitted value is not posted if no item is selected. */
-            ((EditableValueHolder) component).setSubmittedValue(new String[]{});
+            ((EditableValueHolder) component)
+                    .setSubmittedValue(new String[] {});
         }
     }
 
@@ -262,8 +284,10 @@ public final class HtmlRendererUtils {
      * @param component
      */
     public static void decodeUISelectOne(FacesContext facesContext,
-                                         UIComponent component) {
-        if (!(component instanceof EditableValueHolder)) {
+            UIComponent component)
+    {
+        if (!(component instanceof EditableValueHolder))
+        {
             throw new IllegalArgumentException("Component "
                     + component.getClientId(facesContext)
                     + " is not an EditableValueHolder");
@@ -277,11 +301,14 @@ public final class HtmlRendererUtils {
         Map paramMap = facesContext.getExternalContext()
                 .getRequestParameterMap();
         String clientId = component.getClientId(facesContext);
-        if (paramMap.containsKey(clientId)) {
+        if (paramMap.containsKey(clientId))
+        {
             //request parameter found, set submitted value
             ((EditableValueHolder) component).setSubmittedValue(paramMap
                     .get(clientId));
-        } else {
+        }
+        else
+        {
             //see reason for this action at decodeUISelectMany
             ((EditableValueHolder) component).setSubmittedValue(STR_EMPTY);
         }
@@ -293,27 +320,37 @@ public final class HtmlRendererUtils {
      * @since 4.0.0
      */
     public static void decodeClientBehaviors(FacesContext facesContext,
-                                             UIComponent component) {
-        if (component instanceof ClientBehaviorHolder) {
+            UIComponent component)
+    {
+        if (component instanceof ClientBehaviorHolder)
+        {
             ClientBehaviorHolder clientBehaviorHolder = (ClientBehaviorHolder) component;
 
-            Map<String, List<ClientBehavior>> clientBehaviors =
-                    clientBehaviorHolder.getClientBehaviors();
+            Map<String, List<ClientBehavior>> clientBehaviors = clientBehaviorHolder
+                    .getClientBehaviors();
 
-            if (clientBehaviors != null && !clientBehaviors.isEmpty()) {
-                Map<String, String> paramMap = facesContext.getExternalContext().
-                        getRequestParameterMap();
+            if (clientBehaviors != null && !clientBehaviors.isEmpty())
+            {
+                Map<String, String> paramMap = facesContext
+                        .getExternalContext().getRequestParameterMap();
 
-                String behaviorEventName = paramMap.get("javax.faces.behavior.event");
+                String behaviorEventName = paramMap
+                        .get("javax.faces.behavior.event");
 
-                if (behaviorEventName != null) {
-                    List<ClientBehavior> clientBehaviorList = clientBehaviors.get(behaviorEventName);
+                if (behaviorEventName != null)
+                {
+                    List<ClientBehavior> clientBehaviorList = clientBehaviors
+                            .get(behaviorEventName);
 
-                    if (clientBehaviorList != null && !clientBehaviorList.isEmpty()) {
+                    if (clientBehaviorList != null
+                            && !clientBehaviorList.isEmpty())
+                    {
                         String clientId = paramMap.get("javax.faces.source");
 
-                        if (component.getClientId().equals(clientId)) {
-                            for (ClientBehavior clientBehavior : clientBehaviorList) {
+                        if (component.getClientId().equals(clientId))
+                        {
+                            for (ClientBehavior clientBehavior : clientBehaviorList)
+                            {
                                 clientBehavior.decode(facesContext, component);
                             }
                         }
@@ -323,111 +360,121 @@ public final class HtmlRendererUtils {
         }
     }
 
-    /*
-     * public static void renderCheckbox(FacesContext facesContext, UIComponent
-     * uiComponent, String value, String label, boolean checked) throws
-     * IOException { String clientId = uiComponent.getClientId(facesContext);
-     *
-     * ResponseWriter writer = facesContext.getResponseWriter();
-     *
-     * writer.startElement(HTML.INPUT_ELEM, uiComponent);
-     * writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_CHECKBOX, null);
-     * writer.writeAttribute(HTML.NAME_ATTR, clientId, null);
-     * writer.writeAttribute(HTML.ID_ATTR, clientId, null);
-     *
-     * if (checked) { writer.writeAttribute(HTML.CHECKED_ATTR,
-     * HTML.CHECKED_ATTR, null); }
-     *
-     * if ((value != null) && (value.length() > 0)) {
-     * writer.writeAttribute(HTML.VALUE_ATTR, value, null); }
-     *
-     * renderHTMLAttributes(writer, uiComponent,
-     * HTML.INPUT_PASSTHROUGH_ATTRIBUTES); renderDisabledOnUserRole(writer,
-     * uiComponent, facesContext);
-     *
-     * if ((label != null) && (label.length() > 0)) {
-     * writer.write(HTML.NBSP_ENTITY); writer.writeText(label, null); }
-     *
-     * writer.endElement(HTML.INPUT_ELEM); }
-     */
-
-    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,
+            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, Converter converter)
-            throws IOException {
-        internalRenderSelect(facesContext, selectMany, disabled, size, true, converter);
+    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, Converter converter) throws IOException {
-        internalRenderSelect(facesContext, selectOne, disabled, 1, false, converter);
+    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, Converter converter) throws IOException {
-        internalRenderSelect(facesContext, selectMany, disabled, 1, true, converter);
+    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, Converter converter) throws IOException {
+            UIComponent uiComponent, boolean disabled, int size,
+            boolean selectMany, Converter converter) throws IOException
+    {
         ResponseWriter writer = facesContext.getResponseWriter();
 
         writer.startElement(HTML.SELECT_ELEM, uiComponent);
         if (uiComponent instanceof ClientBehaviorHolder
-                && JavascriptUtils.isJavascriptAllowed(facesContext.getExternalContext())
-                && !((ClientBehaviorHolder) uiComponent).getClientBehaviors().isEmpty()) {
+                && JavascriptUtils.isJavascriptAllowed(facesContext
+                        .getExternalContext())
+                && !((ClientBehaviorHolder) uiComponent).getClientBehaviors()
+                        .isEmpty())
+        {
             writer.writeAttribute(HTML.ID_ATTR,
                     uiComponent.getClientId(facesContext), null);
-        } else {
-            HtmlRendererUtils.writeIdIfNecessary(writer, uiComponent, facesContext);
+        }
+        else
+        {
+            HtmlRendererUtils.writeIdIfNecessary(writer, uiComponent,
+                    facesContext);
         }
         writer.writeAttribute(HTML.NAME_ATTR,
                 uiComponent.getClientId(facesContext), null);
 
         List selectItemList;
-        if (selectMany) {
+        if (selectMany)
+        {
             writer.writeAttribute(HTML.MULTIPLE_ATTR, HTML.MULTIPLE_ATTR, null);
             selectItemList = org.apache.myfaces.shared.renderkit.RendererUtils
                     .getSelectItemList((UISelectMany) uiComponent, facesContext);
-        } else {
-            selectItemList = RendererUtils
-                    .getSelectItemList((UISelectOne) uiComponent, facesContext);
+        }
+        else
+        {
+            selectItemList = RendererUtils.getSelectItemList(
+                    (UISelectOne) uiComponent, facesContext);
         }
 
-        if (size == Integer.MIN_VALUE) {
+        if (size == Integer.MIN_VALUE)
+        {
             //No size given (Listbox) --> size is number of select items
-            writer.writeAttribute(HTML.SIZE_ATTR, Integer
-                    .toString(selectItemList.size()), null);
-        } else {
+            writer.writeAttribute(HTML.SIZE_ATTR,
+                    Integer.toString(selectItemList.size()), null);
+        }
+        else
+        {
             writer.writeAttribute(HTML.SIZE_ATTR, Integer.toString(size), null);
         }
         Map<String, List<ClientBehavior>> behaviors = null;
-        if (uiComponent instanceof ClientBehaviorHolder && JavascriptUtils.isJavascriptAllowed(facesContext.getExternalContext())) {
-            behaviors = ((ClientBehaviorHolder) uiComponent).getClientBehaviors();
-            renderBehaviorizedOnchangeEventHandler(facesContext, writer, uiComponent, behaviors);
-            renderBehaviorizedEventHandlers(facesContext, writer, uiComponent, behaviors);
-            renderBehaviorizedFieldEventHandlersWithoutOnchange(facesContext, writer, uiComponent, behaviors);
-            renderHTMLAttributes(writer, uiComponent, HTML.SELECT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_EVENTS);
-        } else {
+        if (uiComponent instanceof ClientBehaviorHolder
+                && JavascriptUtils.isJavascriptAllowed(facesContext
+                        .getExternalContext()))
+        {
+            behaviors = ((ClientBehaviorHolder) uiComponent)
+                    .getClientBehaviors();
+            renderBehaviorizedOnchangeEventHandler(facesContext, writer,
+                    uiComponent, behaviors);
+            renderBehaviorizedEventHandlers(facesContext, writer, uiComponent,
+                    behaviors);
+            renderBehaviorizedFieldEventHandlersWithoutOnchange(facesContext,
+                    writer, uiComponent, behaviors);
+            renderHTMLAttributes(
+                    writer,
+                    uiComponent,
+                    HTML.SELECT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_EVENTS);
+        }
+        else
+        {
             renderHTMLAttributes(writer, uiComponent,
                     HTML.SELECT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED);
         }
 
-        if (disabled) {
+        if (disabled)
+        {
             writer.writeAttribute(HTML.DISABLED_ATTR, Boolean.TRUE, null);
         }
 
-        if (isReadOnly(uiComponent)) {
+        if (isReadOnly(uiComponent))
+        {
             writer.writeAttribute(HTML.READONLY_ATTR, HTML.READONLY_ATTR, null);
         }
 
-        Set lookupSet = getSubmittedOrSelectedValuesAsSet(selectMany, uiComponent, facesContext, converter);
+        Set lookupSet = getSubmittedOrSelectedValuesAsSet(selectMany,
+                uiComponent, facesContext, converter);
 
         renderSelectOptions(facesContext, uiComponent, converter, lookupSet,
                 selectItemList);
@@ -436,58 +483,88 @@ public final class HtmlRendererUtils {
         writer.endElement(HTML.SELECT_ELEM);
     }
 
-    public static Set getSubmittedOrSelectedValuesAsSet(boolean selectMany, UIComponent uiComponent, FacesContext facesContext, Converter converter) {
+    public static Set getSubmittedOrSelectedValuesAsSet(boolean selectMany,
+            UIComponent uiComponent, FacesContext facesContext,
+            Converter converter)
+    {
         Set lookupSet;
 
-        if (selectMany) {
+        if (selectMany)
+        {
             UISelectMany uiSelectMany = (UISelectMany) uiComponent;
-            lookupSet = RendererUtils.getSubmittedValuesAsSet(facesContext, uiComponent, converter, uiSelectMany);
-            if (lookupSet == null) {
-                lookupSet = RendererUtils.getSelectedValuesAsSet(facesContext, uiComponent, converter, uiSelectMany);
+            lookupSet = RendererUtils.getSubmittedValuesAsSet(facesContext,
+                    uiComponent, converter, uiSelectMany);
+            if (lookupSet == null)
+            {
+                lookupSet = RendererUtils.getSelectedValuesAsSet(facesContext,
+                        uiComponent, converter, uiSelectMany);
             }
-        } else {
+        }
+        else
+        {
             UISelectOne uiSelectOne = (UISelectOne) uiComponent;
             Object lookup = uiSelectOne.getSubmittedValue();
-            if (lookup == null) {
+            if (lookup == null)
+            {
                 lookup = uiSelectOne.getValue();
-                String lookupString = RendererUtils.getConvertedStringValue(facesContext, uiComponent, converter, lookup);
+                String lookupString = RendererUtils.getConvertedStringValue(
+                        facesContext, uiComponent, converter, lookup);
                 lookupSet = Collections.singleton(lookupString);
-            } else if (STR_EMPTY.equals(lookup)) {
+            }
+            else if (STR_EMPTY.equals(lookup))
+            {
                 lookupSet = Collections.EMPTY_SET;
-            } else {
+            }
+            else
+            {
                 lookupSet = Collections.singleton(lookup);
             }
         }
         return lookupSet;
     }
 
-    public static Converter findUISelectManyConverterFailsafe(FacesContext facesContext, UIComponent uiComponent) {
+    public static Converter findUISelectManyConverterFailsafe(
+            FacesContext facesContext, UIComponent uiComponent)
+    {
         // invoke with considerValueType = false
-        return findUISelectManyConverterFailsafe(facesContext, uiComponent, false);
+        return findUISelectManyConverterFailsafe(facesContext, uiComponent,
+                false);
     }
 
-    public static Converter findUISelectManyConverterFailsafe(FacesContext facesContext,
-                                                              UIComponent uiComponent, boolean considerValueType) {
+    public static Converter findUISelectManyConverterFailsafe(
+            FacesContext facesContext, UIComponent uiComponent,
+            boolean considerValueType)
+    {
         Converter converter;
-        try {
-            converter = RendererUtils.findUISelectManyConverter(
-                    facesContext, (UISelectMany) uiComponent, considerValueType);
-        } catch (FacesException e) {
-            log.log(Level.SEVERE, "Error finding Converter for component with id "
-                    + uiComponent.getClientId(facesContext), e);
+        try
+        {
+            converter = RendererUtils.findUISelectManyConverter(facesContext,
+                    (UISelectMany) uiComponent, considerValueType);
+        }
+        catch (FacesException e)
+        {
+            log.log(Level.SEVERE,
+                    "Error finding Converter for component with id "
+                            + uiComponent.getClientId(facesContext), e);
             converter = null;
         }
         return converter;
     }
 
-    public static Converter findUIOutputConverterFailSafe(FacesContext facesContext, UIComponent uiComponent) {
+    public static Converter findUIOutputConverterFailSafe(
+            FacesContext facesContext, UIComponent uiComponent)
+    {
         Converter converter;
-        try {
+        try
+        {
             converter = RendererUtils.findUIOutputConverter(facesContext,
                     (UIOutput) uiComponent);
-        } catch (FacesException e) {
-            log.log(Level.SEVERE, "Error finding Converter for component with id "
-                    + uiComponent.getClientId(facesContext), e);
+        }
+        catch (FacesException e)
+        {
+            log.log(Level.SEVERE,
+                    "Error finding Converter for component with id "
+                            + uiComponent.getClientId(facesContext), e);
             converter = null;
         }
         return converter;
@@ -507,17 +584,20 @@ public final class HtmlRendererUtils {
      * @throws IOException
      */
     public static void renderSelectOptions(FacesContext context,
-                                           UIComponent component, Converter converter, Set lookupSet,
-                                           List selectItemList) throws IOException {
+            UIComponent component, Converter converter, Set lookupSet,
+            List selectItemList) throws IOException
+    {
         ResponseWriter writer = context.getResponseWriter();
 
         // check for the hideNoSelectionOption attribute
         boolean hideNoSelectionOption = isHideNoSelectionOption(component);
 
-        for (Iterator it = selectItemList.iterator(); it.hasNext();) {
+        for (Iterator it = selectItemList.iterator(); it.hasNext();)
+        {
             SelectItem selectItem = (SelectItem) it.next();
 
-            if (selectItem instanceof SelectItemGroup) {
+            if (selectItem instanceof SelectItemGroup)
+            {
                 writer.startElement(HTML.OPTGROUP_ELEM, component);
                 writer.writeAttribute(HTML.LABEL_ATTR, selectItem.getLabel(),
                         null);
@@ -526,10 +606,15 @@ public final class HtmlRendererUtils {
                 renderSelectOptions(context, component, converter, lookupSet,
                         Arrays.asList(selectItems));
                 writer.endElement(HTML.OPTGROUP_ELEM);
-            } else {
-                String itemStrValue = org.apache.myfaces.shared.renderkit.RendererUtils.getConvertedStringValue(context, component,
-                        converter, selectItem);
-                boolean selected = lookupSet.contains(itemStrValue); //TODO/FIX: we always compare the String vales, better fill lookupSet with Strings only when useSubmittedValue==true, else use the real item value Objects
+            }
+            else
+            {
+                String itemStrValue = org.apache.myfaces.shared.renderkit.RendererUtils
+                        .getConvertedStringValue(context, component, converter,
+                                selectItem);
+                boolean selected = lookupSet.contains(itemStrValue); 
+                //TODO/FIX: we always compare the String vales, better fill lookupSet with Strings 
+                //only when useSubmittedValue==true, else use the real item value Objects
 
                 // IF the hideNoSelectionOption attribute of the component is true
                 // AND this selectItem is the "no selection option"
@@ -537,48 +622,60 @@ public final class HtmlRendererUtils {
                 // AND this item (the "no selection option") is not selected
                 // (if there is currently no value on UISelectOne, lookupSet contains "")
                 if (hideNoSelectionOption && selectItem.isNoSelectionOption()
-                        && lookupSet.size() != 0 && !(lookupSet.size() == 1 && lookupSet.contains(""))
-                        && !selected) {
+                        && lookupSet.size() != 0
+                        && !(lookupSet.size() == 1 && lookupSet.contains(""))
+                        && !selected)
+                {
                     // do not render this selectItem
                     continue;
                 }
 
                 writer.write(TABULATOR);
                 writer.startElement(HTML.OPTION_ELEM, component);
-                if (itemStrValue != null) {
+                if (itemStrValue != null)
+                {
                     writer.writeAttribute(HTML.VALUE_ATTR, itemStrValue, null);
                 }
-                else 
+                else
                 {
                     writer.writeAttribute(HTML.VALUE_ATTR, "", null);
                 }
-                
 
-                if (selected) {
+                if (selected)
+                {
                     writer.writeAttribute(HTML.SELECTED_ATTR,
                             HTML.SELECTED_ATTR, null);
                 }
 
                 boolean disabled = selectItem.isDisabled();
-                if (disabled) {
+                if (disabled)
+                {
                     writer.writeAttribute(HTML.DISABLED_ATTR,
                             HTML.DISABLED_ATTR, null);
                 }
 
                 String labelClass = null;
-                boolean componentDisabled = isTrue(component.getAttributes().get("disabled"));
+                boolean componentDisabled = isTrue(component.getAttributes()
+                        .get("disabled"));
 
-                if (componentDisabled || disabled) {
-                    labelClass = (String) component.getAttributes().get(JSFAttr.DISABLED_CLASS_ATTR);
-                } else {
-                    labelClass = (String) component.getAttributes().get(JSFAttr.ENABLED_CLASS_ATTR);
+                if (componentDisabled || disabled)
+                {
+                    labelClass = (String) component.getAttributes().get(
+                            JSFAttr.DISABLED_CLASS_ATTR);
+                }
+                else
+                {
+                    labelClass = (String) component.getAttributes().get(
+                            JSFAttr.ENABLED_CLASS_ATTR);
                 }
-                if (labelClass != null) {
+                if (labelClass != null)
+                {
                     writer.writeAttribute("class", labelClass, "labelClass");
                 }
 
                 boolean escape;
-                if (component instanceof EscapeCapable) {
+                if (component instanceof EscapeCapable)
+                {
                     escape = ((EscapeCapable) component).isEscape();
 
                     // Preserve tomahawk semantic. If escape=false
@@ -586,14 +683,19 @@ public final class HtmlRendererUtils {
                     // is true check if selectItem.isEscape() is
                     // true and do it.
                     // This is done for remain compatibility.
-                    if (escape && selectItem.isEscape()) {
+                    if (escape && selectItem.isEscape())
+                    {
                         writer.writeText(selectItem.getLabel(), null);
-                    } else {
+                    }
+                    else
+                    {
                         writer.write(selectItem.getLabel());
                     }
-                } else {
-                    escape = RendererUtils.getBooleanAttribute(component, JSFAttr.ESCAPE_ATTR,
-                            false);
+                }
+                else
+                {
+                    escape = RendererUtils.getBooleanAttribute(component,
+                            JSFAttr.ESCAPE_ATTR, false);
                     //default is to escape
                     //In JSF 1.2, when a SelectItem is created by default 
                     //selectItem.isEscape() returns true (this property
@@ -601,9 +703,12 @@ public final class HtmlRendererUtils {
                     //so, if we found a escape property on the component
                     //set to true, escape every item, but if not
                     //check if isEscape() = true first.
-                    if (escape || selectItem.isEscape()) {
+                    if (escape || selectItem.isEscape())
+                    {
                         writer.writeText(selectItem.getLabel(), null);
-                    } else {
+                    }
+                    else
+                    {
                         writer.write(selectItem.getLabel());
                     }
                 }
@@ -642,17 +747,21 @@ public final class HtmlRendererUtils {
      */
 
     public static void writePrettyLineSeparator(FacesContext facesContext)
-            throws IOException {
-        if (org.apache.myfaces.shared.config.MyfacesConfig.getCurrentInstance(facesContext.getExternalContext())
-                .isPrettyHtml()) {
+            throws IOException
+    {
+        if (org.apache.myfaces.shared.config.MyfacesConfig.getCurrentInstance(
+                facesContext.getExternalContext()).isPrettyHtml())
+        {
             facesContext.getResponseWriter().write(LINE_SEPARATOR);
         }
     }
 
     public static void writePrettyIndent(FacesContext facesContext)
-            throws IOException {
-        if (org.apache.myfaces.shared.config.MyfacesConfig.getCurrentInstance(facesContext.getExternalContext())
-                .isPrettyHtml()) {
+            throws IOException
+    {
+        if (org.apache.myfaces.shared.config.MyfacesConfig.getCurrentInstance(
+                facesContext.getExternalContext()).isPrettyHtml())
+        {
             facesContext.getResponseWriter().write('\t');
         }
     }
@@ -662,13 +771,14 @@ public final class HtmlRendererUtils {
      * @throws java.io.IOException
      */
     public static boolean renderHTMLAttribute(ResponseWriter writer,
-                                              String componentProperty, String attrName, Object value)
-            throws IOException {
-        if (!RendererUtils.isDefaultAttributeValue(value)) {
+            String componentProperty, String attrName, Object value)
+            throws IOException
+    {
+        if (!RendererUtils.isDefaultAttributeValue(value))
+        {
             // render JSF "styleClass" and "itemStyleClass" attributes as "class"
-            String htmlAttrName =
-                    attrName.equals(HTML.STYLE_CLASS_ATTR) ?
-                            HTML.CLASS_ATTR : attrName;
+            String htmlAttrName = attrName.equals(HTML.STYLE_CLASS_ATTR) ? HTML.CLASS_ATTR
+                    : attrName;
             writer.writeAttribute(htmlAttrName, value, componentProperty);
             return true;
         }
@@ -681,8 +791,9 @@ public final class HtmlRendererUtils {
      * @throws java.io.IOException
      */
     public static boolean renderHTMLAttribute(ResponseWriter writer,
-                                              UIComponent component, String componentProperty, String htmlAttrName)
-            throws IOException {
+            UIComponent component, String componentProperty, String htmlAttrName)
+            throws IOException
+    {
         Object value = component.getAttributes().get(componentProperty);
         return renderHTMLAttribute(writer, componentProperty, htmlAttrName,
                 value);
@@ -693,11 +804,14 @@ public final class HtmlRendererUtils {
      * @throws java.io.IOException
      */
     public static boolean renderHTMLAttributes(ResponseWriter writer,
-                                               UIComponent component, String[] attributes) throws IOException {
+            UIComponent component, String[] attributes) throws IOException
+    {
         boolean somethingDone = false;
-        for (int i = 0, len = attributes.length; i < len; i++) {
+        for (int i = 0, len = attributes.length; i < len; i++)
+        {
             String attrName = attributes[i];
-            if (renderHTMLAttribute(writer, component, attrName, attrName)) {
+            if (renderHTMLAttribute(writer, component, attrName, attrName))
+            {
                 somethingDone = true;
             }
         }
@@ -707,9 +821,13 @@ public final class HtmlRendererUtils {
     public static boolean renderHTMLAttributeWithOptionalStartElement(
             ResponseWriter writer, UIComponent component, String elementName,
             String attrName, Object value, boolean startElementWritten)
-            throws IOException {
-        if (!org.apache.myfaces.shared.renderkit.RendererUtils.isDefaultAttributeValue(value)) {
-            if (!startElementWritten) {
+            throws IOException
+    {
+        if (!org.apache.myfaces.shared.renderkit.RendererUtils
+                .isDefaultAttributeValue(value))
+        {
+            if (!startElementWritten)
+            {
                 writer.startElement(elementName, component);
                 startElementWritten = true;
             }
@@ -720,13 +838,17 @@ public final class HtmlRendererUtils {
 
     public static boolean renderHTMLAttributesWithOptionalStartElement(
             ResponseWriter writer, UIComponent component, String elementName,
-            String[] attributes) throws IOException {
+            String[] attributes) throws IOException
+    {
         boolean startElementWritten = false;
-        for (int i = 0, len = attributes.length; i < len; i++) {
+        for (int i = 0, len = attributes.length; i < len; i++)
+        {
             String attrName = attributes[i];
             Object value = component.getAttributes().get(attrName);
-            if (!RendererUtils.isDefaultAttributeValue(value)) {
-                if (!startElementWritten) {
+            if (!RendererUtils.isDefaultAttributeValue(value))
+            {
+                if (!startElementWritten)
+                {
                     writer.startElement(elementName, component);
                     startElementWritten = true;
                 }
@@ -737,18 +859,22 @@ public final class HtmlRendererUtils {
     }
 
     public static boolean renderOptionalEndElement(ResponseWriter writer,
-                                                   UIComponent component, String elementName, String[] attributes)
-            throws IOException {
+            UIComponent component, String elementName, String[] attributes)
+            throws IOException
+    {
         boolean endElementNeeded = false;
-        for (int i = 0, len = attributes.length; i < len; i++) {
+        for (int i = 0, len = attributes.length; i < len; i++)
+        {
             String attrName = attributes[i];
             Object value = component.getAttributes().get(attrName);
-            if (!RendererUtils.isDefaultAttributeValue(value)) {
+            if (!RendererUtils.isDefaultAttributeValue(value))
+            {
                 endElementNeeded = true;
                 break;
             }
         }
-        if (endElementNeeded) {
+        if (endElementNeeded)
+        {
             writer.endElement(elementName);
             return true;
         }
@@ -756,81 +882,103 @@ public final class HtmlRendererUtils {
         return false;
     }
 
-    public static void writeIdIfNecessary(ResponseWriter writer, UIComponent component,
-                                          FacesContext facesContext)
-            throws IOException {
-        if (component.getId() != null && !component.getId().startsWith(UIViewRoot.UNIQUE_ID_PREFIX)) {
-            writer.writeAttribute(HTML.ID_ATTR, component.getClientId(facesContext), null);
+    public static void writeIdIfNecessary(ResponseWriter writer,
+            UIComponent component, FacesContext facesContext)
+            throws IOException
+    {
+        if (component.getId() != null
+                && !component.getId().startsWith(UIViewRoot.UNIQUE_ID_PREFIX))
+        {
+            writer.writeAttribute(HTML.ID_ATTR,
+                    component.getClientId(facesContext), null);
         }
     }
 
-    public static void writeIdAndNameIfNecessary(ResponseWriter writer, UIComponent component,
-                                                 FacesContext facesContext)
-            throws IOException {
-        if (component.getId() != null && !component.getId().startsWith(UIViewRoot.UNIQUE_ID_PREFIX)) {
+    public static void writeIdAndNameIfNecessary(ResponseWriter writer,
+            UIComponent component, FacesContext facesContext)
+            throws IOException
+    {
+        if (component.getId() != null
+                && !component.getId().startsWith(UIViewRoot.UNIQUE_ID_PREFIX))
+        {
             String clientId = component.getClientId(facesContext);
             writer.writeAttribute(HTML.ID_ATTR, clientId, null);
             writer.writeAttribute(HTML.NAME_ATTR, clientId, null);
         }
     }
 
-    public static void writeIdAndName(ResponseWriter writer, UIComponent component,
-                                      FacesContext facesContext)
-            throws IOException {
+    public static void writeIdAndName(ResponseWriter writer,
+            UIComponent component, FacesContext facesContext)
+            throws IOException
+    {
         String clientId = component.getClientId(facesContext);
         writer.writeAttribute(HTML.ID_ATTR, clientId, null);
         writer.writeAttribute(HTML.NAME_ATTR, clientId, null);
     }
 
-    public static void renderDisplayValueOnlyForSelects(FacesContext facesContext,
-                                                        UIComponent uiComponent) throws IOException {
+    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, boolean considerValueType)
-            throws IOException {
+    public static void renderDisplayValueOnlyForSelects(
+            FacesContext facesContext, UIComponent uiComponent,
+            boolean considerValueType) throws IOException
+    {
         ResponseWriter writer = facesContext.getResponseWriter();
 
         List selectItemList = null;
         Converter converter = null;
         boolean isSelectOne = false;
 
-        if (uiComponent instanceof UISelectBoolean) {
+        if (uiComponent instanceof UISelectBoolean)
+        {
             converter = findUIOutputConverterFailSafe(facesContext, uiComponent);
 
             writer.startElement(HTML.SPAN_ELEM, uiComponent);
             writeIdIfNecessary(writer, uiComponent, facesContext);
             renderDisplayValueOnlyAttributes(uiComponent, writer);
-            writer.writeText(RendererUtils.getConvertedStringValue(facesContext, uiComponent,
-                    converter, ((UISelectBoolean) uiComponent).getValue()), JSFAttr.VALUE_ATTR);
+            writer.writeText(RendererUtils.getConvertedStringValue(
+                    facesContext, uiComponent, converter,
+                    ((UISelectBoolean) uiComponent).getValue()),
+                    JSFAttr.VALUE_ATTR);
             writer.endElement(HTML.SPAN_ELEM);
 
-        } else {
-            if (uiComponent instanceof UISelectMany) {
+        }
+        else
+        {
+            if (uiComponent instanceof UISelectMany)
+            {
                 isSelectOne = false;
-                selectItemList = RendererUtils
-                        .getSelectItemList((UISelectMany) uiComponent, facesContext);
-                converter = findUISelectManyConverterFailsafe(facesContext, uiComponent, considerValueType);
-            } else if (uiComponent instanceof UISelectOne) {
+                selectItemList = RendererUtils.getSelectItemList(
+                        (UISelectMany) uiComponent, facesContext);
+                converter = findUISelectManyConverterFailsafe(facesContext,
+                        uiComponent, considerValueType);
+            }
+            else if (uiComponent instanceof UISelectOne)
+            {
                 isSelectOne = true;
-                selectItemList = RendererUtils
-                        .getSelectItemList((UISelectOne) uiComponent, facesContext);
-                converter = findUIOutputConverterFailSafe(facesContext, uiComponent);
+                selectItemList = RendererUtils.getSelectItemList(
+                        (UISelectOne) uiComponent, facesContext);
+                converter = findUIOutputConverterFailSafe(facesContext,
+                        uiComponent);
             }
 
-            writer.startElement(isSelectOne ? HTML.SPAN_ELEM : HTML.UL_ELEM, uiComponent);
+            writer.startElement(isSelectOne ? HTML.SPAN_ELEM : HTML.UL_ELEM,
+                    uiComponent);
             writeIdIfNecessary(writer, uiComponent, facesContext);
 
             renderDisplayValueOnlyAttributes(uiComponent, writer);
 
             Set lookupSet = getSubmittedOrSelectedValuesAsSet(
-                    uiComponent instanceof UISelectMany,
-                    uiComponent, facesContext, converter);
+                    uiComponent instanceof UISelectMany, uiComponent,
+                    facesContext, converter);
 
-            renderSelectOptionsAsText(facesContext, uiComponent, converter, lookupSet,
-                    selectItemList, isSelectOne);
+            renderSelectOptionsAsText(facesContext, uiComponent, converter,
+                    lookupSet, selectItemList, isSelectOne);
 
             // bug #970747: force separate end tag
             writer.writeText(STR_EMPTY, null);
@@ -839,8 +987,11 @@ public final class HtmlRendererUtils {
 
     }
 
-    public static void renderDisplayValueOnlyAttributes(UIComponent uiComponent, ResponseWriter writer) throws IOException {
-        if (!(uiComponent instanceof org.apache.myfaces.shared.component.DisplayValueOnlyCapable)) {
+    public static void renderDisplayValueOnlyAttributes(
+            UIComponent uiComponent, ResponseWriter writer) throws IOException
+    {
+        if (!(uiComponent instanceof org.apache.myfaces.shared.component.DisplayValueOnlyCapable))
+        {
             log.severe("Wrong type of uiComponent. needs DisplayValueOnlyCapable.");
             renderHTMLAttributes(writer, uiComponent,
                     HTML.COMMON_PASSTROUGH_ATTRIBUTES);
@@ -848,46 +999,67 @@ public final class HtmlRendererUtils {
             return;
         }
 
-        if (getDisplayValueOnlyStyle(uiComponent) != null || getDisplayValueOnlyStyleClass(uiComponent) != null) {
-            if (getDisplayValueOnlyStyle(uiComponent) != null) {
-                writer.writeAttribute(HTML.STYLE_ATTR, getDisplayValueOnlyStyle(uiComponent), null);
-            } else if (uiComponent.getAttributes().get("style") != null) {
-                writer.writeAttribute(HTML.STYLE_ATTR, uiComponent.getAttributes().get("style"), null);
+        if (getDisplayValueOnlyStyle(uiComponent) != null
+                || getDisplayValueOnlyStyleClass(uiComponent) != null)
+        {
+            if (getDisplayValueOnlyStyle(uiComponent) != null)
+            {
+                writer.writeAttribute(HTML.STYLE_ATTR,
+                        getDisplayValueOnlyStyle(uiComponent), null);
+            }
+            else if (uiComponent.getAttributes().get("style") != null)
+            {
+                writer.writeAttribute(HTML.STYLE_ATTR, uiComponent
+                        .getAttributes().get("style"), null);
             }
 
-            if (getDisplayValueOnlyStyleClass(uiComponent) != null) {
-                writer.writeAttribute(HTML.CLASS_ATTR, getDisplayValueOnlyStyleClass(uiComponent), null);
-            } else if (uiComponent.getAttributes().get("styleClass") != null) {
-                writer.writeAttribute(HTML.CLASS_ATTR, uiComponent.getAttributes().get("styleClass"), null);
+            if (getDisplayValueOnlyStyleClass(uiComponent) != null)
+            {
+                writer.writeAttribute(HTML.CLASS_ATTR,
+                        getDisplayValueOnlyStyleClass(uiComponent), null);
+            }
+            else if (uiComponent.getAttributes().get("styleClass") != null)
+            {
+                writer.writeAttribute(HTML.CLASS_ATTR, uiComponent
+                        .getAttributes().get("styleClass"), null);
             }
 
             renderHTMLAttributes(writer, uiComponent,
                     HTML.COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_STYLE);
-        } else {
+        }
+        else
+        {
             renderHTMLAttributes(writer, uiComponent,
                     HTML.COMMON_PASSTROUGH_ATTRIBUTES);
         }
     }
 
     private static void renderSelectOptionsAsText(FacesContext context,
-                                                  UIComponent component, Converter converter, Set lookupSet,
-                                                  List selectItemList, boolean isSelectOne) throws IOException {
+            UIComponent component, Converter converter, Set lookupSet,
+            List selectItemList, boolean isSelectOne) throws IOException
+    {
         ResponseWriter writer = context.getResponseWriter();
 
-        for (Iterator it = selectItemList.iterator(); it.hasNext();) {
+        for (Iterator it = selectItemList.iterator(); it.hasNext();)
+        {
             SelectItem selectItem = (SelectItem) it.next();
 
-            if (selectItem instanceof SelectItemGroup) {
+            if (selectItem instanceof SelectItemGroup)
+            {
                 SelectItem[] selectItems = ((SelectItemGroup) selectItem)
                         .getSelectItems();
-                renderSelectOptionsAsText(context, component, converter, lookupSet,
-                        Arrays.asList(selectItems), isSelectOne);
-            } else {
-                String itemStrValue = RendererUtils.getConvertedStringValue(context, component,
-                        converter, selectItem);
-
-                if (lookupSet.contains(itemStrValue)) {  //TODO/FIX: we always compare the String vales, better fill lookupSet with Strings only when useSubmittedValue==true, else use the real item value Objects
+                renderSelectOptionsAsText(context, component, converter,
+                        lookupSet, Arrays.asList(selectItems), isSelectOne);
+            }
+            else
+            {
+                String itemStrValue = RendererUtils.getConvertedStringValue(
+                        context, component, converter, selectItem);
 
+                if (lookupSet.contains(itemStrValue))
+                {
+                    //TODO/FIX: we always compare the String vales, better fill lookupSet with Strings 
+                    //only when useSubmittedValue==true, else use the real item value Objects
                     if (!isSelectOne)
                     {
                         writer.startElement(HTML.LI_ELEM, component);
@@ -897,8 +1069,8 @@ public final class HtmlRendererUtils {
                     {
                         writer.endElement(HTML.LI_ELEM);
                     }
-
-                    if (isSelectOne) {
+                    if (isSelectOne)
+                    {
                         //take care of several choices with the same value; use only the first one
                         return;
                     }
@@ -908,83 +1080,96 @@ public final class HtmlRendererUtils {
     }
 
     public static void renderTableCaption(FacesContext context,
-                                          ResponseWriter writer,
-                                          UIComponent component)
-            throws IOException {
+            ResponseWriter writer, UIComponent component) throws IOException
+    {
         UIComponent captionFacet = component.getFacet("caption");
         if (captionFacet == null)
         {
             return;
         }
-
         String captionClass;
         String captionStyle;
-
-        if (component instanceof HtmlPanelGrid) {
+        if (component instanceof HtmlPanelGrid)
+        {
             HtmlPanelGrid panelGrid = (HtmlPanelGrid) component;
             captionClass = panelGrid.getCaptionClass();
             captionStyle = panelGrid.getCaptionStyle();
-        } else if (component instanceof HtmlDataTable) {
+        }
+        else if (component instanceof HtmlDataTable)
+        {
             HtmlDataTable dataTable = (HtmlDataTable) component;
             captionClass = dataTable.getCaptionClass();
             captionStyle = dataTable.getCaptionStyle();
-        } else {
-            captionClass = (String) component.getAttributes().get(org.apache.myfaces.shared.renderkit.JSFAttr.CAPTION_CLASS_ATTR);
-            captionStyle = (String) component.getAttributes().get(org.apache.myfaces.shared.renderkit.JSFAttr.CAPTION_STYLE_ATTR);
         }
-
+        else
+        {
+            captionClass = (String) component
+                    .getAttributes()
+                    .get(org.apache.myfaces.shared.renderkit.JSFAttr.CAPTION_CLASS_ATTR);
+            captionStyle = (String) component
+                    .getAttributes()
+                    .get(org.apache.myfaces.shared.renderkit.JSFAttr.CAPTION_STYLE_ATTR);
+        }
         HtmlRendererUtils.writePrettyLineSeparator(context);
         writer.startElement(HTML.CAPTION_ELEM, component);
-
-        if (captionClass != null) {
+        if (captionClass != null)
+        {
             writer.writeAttribute(HTML.CLASS_ATTR, captionClass, null);
         }
 
-        if (captionStyle != null) {
+        if (captionStyle != null)
+        {
             writer.writeAttribute(HTML.STYLE_ATTR, captionStyle, null);
         }
-
         //RendererUtils.renderChild(context, captionFacet);
         captionFacet.encodeAll(context);
-
         writer.endElement(HTML.CAPTION_ELEM);
     }
 
-    public static String getDisplayValueOnlyStyleClass(UIComponent component) {
-
-        if (component instanceof org.apache.myfaces.shared.component.DisplayValueOnlyCapable) {
-            if (((org.apache.myfaces.shared.component.DisplayValueOnlyCapable) component).getDisplayValueOnlyStyleClass() != null)
+    public static String getDisplayValueOnlyStyleClass(UIComponent component)
+    {
+        if (component instanceof org.apache.myfaces.shared.component.DisplayValueOnlyCapable)
+        {
+            if (((org.apache.myfaces.shared.component.DisplayValueOnlyCapable) component)
+                    .getDisplayValueOnlyStyleClass() != null)
             {
-                return ((DisplayValueOnlyCapable) component).getDisplayValueOnlyStyleClass();
+                return ((DisplayValueOnlyCapable) component)
+                        .getDisplayValueOnlyStyleClass();
             }
-
             UIComponent parent = component;
-
-            while ((parent = parent.getParent()) != null) {
-                if (parent instanceof org.apache.myfaces.shared.component.DisplayValueOnlyCapable &&
-                        ((org.apache.myfaces.shared.component.DisplayValueOnlyCapable) parent).getDisplayValueOnlyStyleClass() != null) {
-                    return ((org.apache.myfaces.shared.component.DisplayValueOnlyCapable) parent).getDisplayValueOnlyStyleClass();
+            while ((parent = parent.getParent()) != null)
+            {
+                if (parent instanceof org.apache.myfaces.shared.component.DisplayValueOnlyCapable
+                        && ((org.apache.myfaces.shared.component.DisplayValueOnlyCapable) parent)
+                                .getDisplayValueOnlyStyleClass() != null)
+                {
+                    return ((org.apache.myfaces.shared.component.DisplayValueOnlyCapable) parent)
+                            .getDisplayValueOnlyStyleClass();
                 }
             }
         }
-
         return null;
     }
 
-    public static String getDisplayValueOnlyStyle(UIComponent component) {
-
-        if (component instanceof DisplayValueOnlyCapable) {
-            if (((org.apache.myfaces.shared.component.DisplayValueOnlyCapable) component).getDisplayValueOnlyStyle() != null)
+    public static String getDisplayValueOnlyStyle(UIComponent component)
+    {
+        if (component instanceof DisplayValueOnlyCapable)
+        {
+            if (((org.apache.myfaces.shared.component.DisplayValueOnlyCapable) component)
+                    .getDisplayValueOnlyStyle() != null)
             {
-                return ((DisplayValueOnlyCapable) component).getDisplayValueOnlyStyle();
+                return ((DisplayValueOnlyCapable) component)
+                        .getDisplayValueOnlyStyle();
             }
-
             UIComponent parent = component;
-
-            while ((parent = parent.getParent()) != null) {
-                if (parent instanceof org.apache.myfaces.shared.component.DisplayValueOnlyCapable &&
-                        ((DisplayValueOnlyCapable) parent).getDisplayValueOnlyStyle() != null) {
-                    return ((DisplayValueOnlyCapable) parent).getDisplayValueOnlyStyle();
+            while ((parent = parent.getParent()) != null)
+            {
+                if (parent instanceof org.apache.myfaces.shared.component.DisplayValueOnlyCapable
+                        && ((DisplayValueOnlyCapable) parent)
+                                .getDisplayValueOnlyStyle() != null)
+                {
+                    return ((DisplayValueOnlyCapable) parent)
+                            .getDisplayValueOnlyStyle();
                 }
             }
         }
@@ -992,20 +1177,24 @@ public final class HtmlRendererUtils {
         return null;
     }
 
-    public static boolean isDisplayValueOnly(UIComponent component) {
-
-        if (component instanceof DisplayValueOnlyCapable) {
+    public static boolean isDisplayValueOnly(UIComponent component)
+    {
+        if (component instanceof DisplayValueOnlyCapable)
+        {
             if (((DisplayValueOnlyCapable) component).isSetDisplayValueOnly())
             {
-                return ((DisplayValueOnlyCapable) component).isDisplayValueOnly();
+                return ((DisplayValueOnlyCapable) component)
+                        .isDisplayValueOnly();
             }
-
             UIComponent parent = component;
-
-            while ((parent = parent.getParent()) != null) {
-                if (parent instanceof DisplayValueOnlyCapable &&
-                        ((DisplayValueOnlyCapable) parent).isSetDisplayValueOnly()) {
-                    return ((org.apache.myfaces.shared.component.DisplayValueOnlyCapable) parent).isDisplayValueOnly();
+            while ((parent = parent.getParent()) != null)
+            {
+                if (parent instanceof DisplayValueOnlyCapable
+                        && ((DisplayValueOnlyCapable) parent)
+                                .isSetDisplayValueOnly())
+                {
+                    return ((org.apache.myfaces.shared.component.DisplayValueOnlyCapable) parent)
+                            .isDisplayValueOnly();
                 }
             }
         }
@@ -1013,29 +1202,33 @@ public final class HtmlRendererUtils {
         return false;
     }
 
-    public static void renderDisplayValueOnly(FacesContext facesContext, UIInput input) throws IOException {
+    public static void renderDisplayValueOnly(FacesContext facesContext,
+            UIInput input) throws IOException
+    {
         ResponseWriter writer = facesContext.getResponseWriter();
-        writer.startElement(org.apache.myfaces.shared.renderkit.html.HTML.SPAN_ELEM, input);
-
+        writer.startElement(
+                org.apache.myfaces.shared.renderkit.html.HTML.SPAN_ELEM, input);
         writeIdIfNecessary(writer, input, facesContext);
-
         renderDisplayValueOnlyAttributes(input, writer);
-
         String strValue = RendererUtils.getStringValue(facesContext, input);
         writer.write(HTMLEncoder.encode(strValue, true, true));
-
         writer.endElement(HTML.SPAN_ELEM);
     }
 
-    public static void appendClearHiddenCommandFormParamsFunctionCall(StringBuffer buf, String formName) {
-        appendClearHiddenCommandFormParamsFunctionCall(new ScriptContext(buf, false), formName);
+    public static void appendClearHiddenCommandFormParamsFunctionCall(
+            StringBuffer buf, String formName)
+    {
+        appendClearHiddenCommandFormParamsFunctionCall(new ScriptContext(buf,
+                false), formName);
     }
 
-    private static void appendClearHiddenCommandFormParamsFunctionCall(ScriptContext context, String formName) {
-
-        String functionName = HtmlRendererUtils.getClearHiddenCommandFormParamsFunctionName(formName);
-
-        if (formName == null) {
+    private static void appendClearHiddenCommandFormParamsFunctionCall(
+            ScriptContext context, String formName)
+    {
+        String functionName = HtmlRendererUtils
+                .getClearHiddenCommandFormParamsFunctionName(formName);
+        if (formName == null)
+        {
             context.prettyLine();
             context.append("var clearFn = ");
             context.append(functionName);
@@ -1045,25 +1238,30 @@ public final class HtmlRendererUtils {
             context.append("{");
             context.append("window[clearFn](formName);");
             context.append("}");
-        } else {
+        }
+        else
+        {
             context.prettyLine();
             context.append("if(typeof window.");
             context.append(functionName);
             context.append("=='function')");
             context.append("{");
-            context.append(functionName).append("('").append(formName).append("');");
+            context.append(functionName).append("('").append(formName)
+                    .append("');");
             context.append("}");
         }
     }
 
     @SuppressWarnings("unchecked")
     public static void renderFormSubmitScript(FacesContext facesContext)
-            throws IOException {
+            throws IOException
+    {
 
         Map map = facesContext.getExternalContext().getRequestMap();
         Boolean firstScript = (Boolean) map.get(FIRST_SUBMIT_SCRIPT_ON_PAGE);
 
-        if (firstScript == null || firstScript.equals(Boolean.TRUE)) {
+        if (firstScript == null || firstScript.equals(Boolean.TRUE))
+        {
             map.put(FIRST_SUBMIT_SCRIPT_ON_PAGE, Boolean.FALSE);
             HtmlRendererUtils.renderFormSubmitScriptIfNecessary(facesContext);
 
@@ -1072,14 +1270,19 @@ public final class HtmlRendererUtils {
         }
     }
 
-    private static void renderConfigOptionsIfNecessary(FacesContext facesContext) throws IOException {
+    private static void renderConfigOptionsIfNecessary(FacesContext facesContext)
+            throws IOException
+    {
         ResponseWriter writer = facesContext.getResponseWriter();
-        MyfacesConfig config = MyfacesConfig.getCurrentInstance(facesContext.getExternalContext());
+        MyfacesConfig config = MyfacesConfig.getCurrentInstance(facesContext
+                .getExternalContext());
         ScriptContext script = new ScriptContext(config.isPrettyHtml());
         boolean autoScroll = config.isAutoScroll();
-        boolean autoSave = JavascriptUtils.isSaveFormSubmitLinkIE(facesContext.getExternalContext());
+        boolean autoSave = JavascriptUtils.isSaveFormSubmitLinkIE(facesContext
+                .getExternalContext());
 
-        if (autoScroll || autoSave) {
+        if (autoScroll || autoSave)
+        {
             script.prettyLine();
             script.increaseIndent();
             script.append("(!window.myfaces) ? window.myfaces = {} : null;");
@@ -1087,13 +1290,16 @@ public final class HtmlRendererUtils {
             script.append("(!myfaces.core.config) ? myfaces.core.config = {} : null;");
         }
 
-        if (autoScroll) {
+        if (autoScroll)
+        {
             script.append("myfaces.core.config.autoScroll = true;");
         }
-        if (autoSave) {
+        if (autoSave)
+        {
             script.append("myfaces.core.config.ieAutoSave = true;");
         }
-        if (autoScroll || autoSave) {
+        if (autoScroll || autoSave)
+        {
             writer.startElement(HTML.SCRIPT_ELEM, null);
             writer.writeAttribute(HTML.TYPE_ATTR, "text/javascript", null);
             writer.writeText(script.toString(), null);
@@ -1105,32 +1311,37 @@ public final class HtmlRendererUtils {
      * @param facesContext
      * @throws IOException
      */
-    private static void renderFormSubmitScriptIfNecessary(FacesContext facesContext) throws IOException {
-        final ExternalContext externalContext = facesContext.getExternalContext();
-        final MyfacesConfig currentInstance = MyfacesConfig.getCurrentInstance(externalContext);
+    private static void renderFormSubmitScriptIfNecessary(
+            FacesContext facesContext) throws IOException
+    {
+        final ExternalContext externalContext = facesContext
+                .getExternalContext();
+        final MyfacesConfig currentInstance = MyfacesConfig
+                .getCurrentInstance(externalContext);
         ResponseWriter writer = facesContext.getResponseWriter();
 
         if (currentInstance.isRenderFormSubmitScriptInline())
         {
             writer.startElement(HTML.SCRIPT_ELEM, null);
             writer.writeAttribute(HTML.TYPE_ATTR, "text/javascript", null);
-    
+
             boolean autoScroll = currentInstance.isAutoScroll();
-    
-            ScriptContext context = new ScriptContext(currentInstance
-                    .isPrettyHtml());
+
+            ScriptContext context = new ScriptContext(
+                    currentInstance.isPrettyHtml());
             context.prettyLine();
             context.increaseIndent();
-    
+
             prepareScript(facesContext, context, autoScroll);
-    
+
             writer.writeText(context.toString(), null);
-    
+
             writer.endElement(HTML.SCRIPT_ELEM);
         }
         else
         {
-            ResourceUtils.renderMyfacesJSInlineIfNecessary(facesContext, writer);
+            ResourceUtils
+                    .renderMyfacesJSInlineIfNecessary(facesContext, writer);
         }
     }
 
@@ -1139,14 +1350,18 @@ public final class HtmlRendererUtils {
      * @param context
      * @param autoScroll
      */
-    private static void prepareScript(FacesContext facesContext, ScriptContext context, boolean autoScroll) {
+    private static void prepareScript(FacesContext facesContext,
+            ScriptContext context, boolean autoScroll)
+    {
 
-        final char separatorChar = UINamingContainer.getSeparatorChar(facesContext);
+        final char separatorChar = UINamingContainer
+                .getSeparatorChar(facesContext);
         context.prettyLine();
 
         //render a function to create a hidden input, if it doesn't exist
         context.append("function ");
-        context.append(SET_HIDDEN_INPUT_FN_NAME).append("(formname, name, value)");
+        context.append(SET_HIDDEN_INPUT_FN_NAME).append(
+                "(formname, name, value)");
         context.append("{");
         context.append("var form = document.forms[formname];");
         context.prettyLine();
@@ -1155,7 +1370,8 @@ public final class HtmlRendererUtils {
         context.append("form = document.getElementById(formname);");
         context.append("}");
         context.prettyLine();
-        context.append("if(typeof form.elements[name]!='undefined' && (form.elements[name].nodeName=='INPUT' || form.elements[name].nodeName=='input'))");
+        context.append("if(typeof form.elements[name]!='undefined' && "+
+                "(form.elements[name].nodeName=='INPUT' || form.elements[name].nodeName=='input'))");
         context.append("{");
         context.append("form.elements[name].value=value;");
         context.append("}");
@@ -1165,7 +1381,7 @@ public final class HtmlRendererUtils {
         context.prettyLine();
         context.append("newInput.setAttribute('type','hidden');");
         context.prettyLine();
-        context.append("newInput.setAttribute('id',name);");  // IE hack; See MYFACES-1805
+        context.append("newInput.setAttribute('id',name);"); // IE hack; See MYFACES-1805
         context.prettyLine();
         context.append("newInput.setAttribute('name',name);");
         context.prettyLine();
@@ -1182,7 +1398,8 @@ public final class HtmlRendererUtils {
 
         //render a function to clear a hidden input, if it exists        
         context.append("function ");
-        context.append(CLEAR_HIDDEN_INPUT_FN_NAME).append("(formname, name, value)");
+        context.append(CLEAR_HIDDEN_INPUT_FN_NAME).append(
+                "(formname, name, value)");
         context.append("{");
         context.append("var form = document.forms[formname];");
         context.prettyLine();
@@ -1204,15 +1421,20 @@ public final class HtmlRendererUtils {
         context.prettyLine();
 
         context.append("function ");
-        context.append(SUBMIT_FORM_FN_NAME).append("(formName, linkId, target, params)");
+        context.append(SUBMIT_FORM_FN_NAME).append(
+                "(formName, linkId, target, params)");
         context.append("{");
 
-        //call the script to clear the form (clearFormHiddenParams_<formName>) method - optionally, only necessary for IE5.5.
-        //todo: if IE5.5. is ever desupported, we can get rid of this and instead rely on the last part of this script to
+        //call the script to clear the form (clearFormHiddenParams_<formName>) method - 
+        //optionally, only necessary for IE5.5.
+        //todo: if IE5.5. is ever desupported, we can get rid of this and instead rely on 
+        //the last part of this script to
         //clear the parameters
-        HtmlRendererUtils.appendClearHiddenCommandFormParamsFunctionCall(context, null);
+        HtmlRendererUtils.appendClearHiddenCommandFormParamsFunctionCall(
+                context, null);
 
-        if (autoScroll) {
+        if (autoScroll)
+        {
             appendAutoScrollAssignment(facesContext, context, null);
         }
 
@@ -1226,7 +1448,9 @@ public final class HtmlRendererUtils {
         context.append("}");
         context.prettyLine();
 
-        if (JavascriptUtils.isSaveFormSubmitLinkIE(FacesContext.getCurrentInstance().getExternalContext())) {
+        if (JavascriptUtils.isSaveFormSubmitLinkIE(FacesContext
+                .getCurrentInstance().getExternalContext()))
+        {
             context.append("var agentString = navigator.userAgent.toLowerCase();");
             context.prettyLine();
             //context.append("var isIE = false;");
@@ -1234,16 +1458,17 @@ public final class HtmlRendererUtils {
             context.append("if (agentString.indexOf('msie') != -1)");
 
             context.append("{");
-            context.append("if (!(agentString.indexOf('ppc') != -1 && agentString.indexOf('windows ce') != -1 && version >= 4.0))");
+            context.append("if (!(agentString.indexOf('ppc') != -1 &&"+
+                    " agentString.indexOf('windows ce') != -1 && version >= 4.0))");
             context.append("{");
             context.append("window.external.AutoCompleteSaveForm(form);");
-//        context.append("isIE = false;");
+            //        context.append("isIE = false;");
             context.append("}");
-//        context.append("else");
-//        context.append("{");
-//        context.append("isIE = true;");
-//        context.prettyLine();
-//        context.append("}");
+            //        context.append("else");
+            //        context.append("{");
+            //        context.append("isIE = true;");
+            //        context.prettyLine();
+            //        context.append("}");
 
             context.append("}");
 
@@ -1266,15 +1491,17 @@ public final class HtmlRendererUtils {
         context.prettyLine();
         context.append("for(var i=0, param; (param = params[i]); i++)");
         context.append("{");
-        context.append(SET_HIDDEN_INPUT_FN_NAME).append("(formName,param[0], param[1]);");
+        context.append(SET_HIDDEN_INPUT_FN_NAME).append(
+                "(formName,param[0], param[1]);");
         context.append("}");
         context.append("}");
 
         context.prettyLine();
 
         context.append(SET_HIDDEN_INPUT_FN_NAME);
-        context.append("(formName,formName +'" + separatorChar +
-                "'+'" + HtmlRendererUtils.HIDDEN_COMMANDLINK_FIELD_NAME + "',linkId);");
+        context.append("(formName,formName +'" + separatorChar + "'+'"
+                + HtmlRendererUtils.HIDDEN_COMMANDLINK_FIELD_NAME
+                + "',linkId);");
 
         context.prettyLine();
         context.prettyLine();
@@ -1317,16 +1544,17 @@ public final class HtmlRendererUtils {
         context.prettyLine();
         context.append("for(var i=0, param; (param = params[i]); i++)");
         context.append("{");
-        context.append(CLEAR_HIDDEN_INPUT_FN_NAME).append("(formName,param[0], param[1]);");
+        context.append(CLEAR_HIDDEN_INPUT_FN_NAME).append(
+                "(formName,param[0], param[1]);");
         context.append("}");
         context.append("}");
 
         context.prettyLine();
 
         context.append(CLEAR_HIDDEN_INPUT_FN_NAME);
-        context.append("(formName,formName +'" + separatorChar +
-                "'+'" + HtmlRendererUtils.HIDDEN_COMMANDLINK_FIELD_NAME + "',linkId);");
-
+        context.append("(formName,formName +'" + separatorChar + "'+'"
+                + HtmlRendererUtils.HIDDEN_COMMANDLINK_FIELD_NAME
+                + "',linkId);");
 
         //return false, so that browser does not handle the click
         context.append("return false;");
@@ -1339,28 +1567,40 @@ public final class HtmlRendererUtils {
      * Adds the hidden form input value assignment that is necessary for the autoscroll
      * feature to an html link or button onclick attribute.
      */
-    public static void appendAutoScrollAssignment(StringBuffer onClickValue, String formName) {
-        appendAutoScrollAssignment(FacesContext.getCurrentInstance(), new ScriptContext(onClickValue, false), formName);
+    public static void appendAutoScrollAssignment(StringBuffer onClickValue,
+            String formName)
+    {
+        appendAutoScrollAssignment(FacesContext.getCurrentInstance(),
+                new ScriptContext(onClickValue, false), formName);
     }
-    
+
     /**
      * Adds the hidden form input value assignment that is necessary for the autoscroll
      * feature to an html link or button onclick attribute.
      */
-    public static void appendAutoScrollAssignment(FacesContext context, StringBuffer onClickValue, String formName) {
-        appendAutoScrollAssignment(context, new ScriptContext(onClickValue, false), formName);
-    }    
-
-    private static void appendAutoScrollAssignment(FacesContext context, ScriptContext scriptContext, String formName) {
-        String formNameStr = formName == null ? "formName" : (new StringBuffer("'").append(formName).append("'").toString());
-        String paramName = new StringBuffer().append("'").
-                append(AUTO_SCROLL_PARAM).append("'").toString();
-        String value = new StringBuffer().append(AUTO_SCROLL_FUNCTION).append("()").toString();
+    public static void appendAutoScrollAssignment(FacesContext context,
+            StringBuffer onClickValue, String formName)
+    {
+        appendAutoScrollAssignment(context, new ScriptContext(onClickValue,
+                false), formName);
+    }
+
+    private static void appendAutoScrollAssignment(FacesContext context,
+            ScriptContext scriptContext, String formName)
+    {
+        String formNameStr = formName == null ? "formName" : (new StringBuffer(
+                "'").append(formName).append("'").toString());
+        String paramName = new StringBuffer().append("'")
+                .append(AUTO_SCROLL_PARAM).append("'").toString();
+        String value = new StringBuffer().append(AUTO_SCROLL_FUNCTION)
+                .append("()").toString();
 
         scriptContext.prettyLine();
-        scriptContext.append("if(typeof window." + AUTO_SCROLL_FUNCTION + "!='undefined')");
+        scriptContext.append("if(typeof window." + AUTO_SCROLL_FUNCTION
+                + "!='undefined')");
         scriptContext.append("{");
-        if (MyfacesConfig.getCurrentInstance(context.getExternalContext()).isRenderFormSubmitScriptInline())
+        if (MyfacesConfig.getCurrentInstance(context.getExternalContext())
+                .isRenderFormSubmitScriptInline())
         {
             scriptContext.append(SET_HIDDEN_INPUT_FN_NAME);
         }
@@ -1368,7 +1608,8 @@ public final class HtmlRendererUtils {
         {
             scriptContext.append(SET_HIDDEN_INPUT_FN_NAME_JSF2);
         }
-        scriptContext.append("(").append(formNameStr).append(",").append(paramName).append(",").append(value).append(");");
+        scriptContext.append("(").append(formNameStr).append(",")
+                .append(paramName).append(",").append(value).append(");");
         scriptContext.append("}");
 
     }
@@ -1376,7 +1617,9 @@ public final class HtmlRendererUtils {
     /**
      * Renders the hidden form input that is necessary for the autoscroll feature.
      */
-    public static void renderAutoScrollHiddenInput(FacesContext facesContext, ResponseWriter writer) throws IOException {
+    public static void renderAutoScrollHiddenInput(FacesContext facesContext,
+            ResponseWriter writer) throws IOException
+    {
         writePrettyLineSeparator(facesContext);
         writer.startElement(HTML.INPUT_ELEM, null);
         writer.writeAttribute(HTML.TYPE_ATTR, "hidden", null);
@@ -1389,18 +1632,22 @@ public final class HtmlRendererUtils {
      * Renders the autoscroll javascript function.
      */
     public static void renderAutoScrollFunction(FacesContext facesContext,
-                                                ResponseWriter writer) throws IOException {
+            ResponseWriter writer) throws IOException
+    {
         writePrettyLineSeparator(facesContext);
         writer.startElement(HTML.SCRIPT_ELEM, null);
-        writer.writeAttribute(HTML.SCRIPT_TYPE_ATTR, HTML.SCRIPT_TYPE_TEXT_JAVASCRIPT, null);
+        writer.writeAttribute(HTML.SCRIPT_TYPE_ATTR,
+                HTML.SCRIPT_TYPE_TEXT_JAVASCRIPT, null);
         writer.writeText(getAutoScrollFunction(facesContext), null);
         writer.endElement(HTML.SCRIPT_ELEM);
         writePrettyLineSeparator(facesContext);
     }
 
-    public static String getAutoScrollFunction(FacesContext facesContext) {
-        ScriptContext script = new ScriptContext(
-                MyfacesConfig.getCurrentInstance(facesContext.getExternalContext()).isPrettyHtml());
+    public static String getAutoScrollFunction(FacesContext facesContext)
+    {
+        ScriptContext script = new ScriptContext(MyfacesConfig
+                .getCurrentInstance(facesContext.getExternalContext())
+                .isPrettyHtml());
 
         script.prettyLineIncreaseIndent();
 
@@ -1415,7 +1662,8 @@ public final class HtmlRendererUtils {
         script.prettyLine();
         script.append("y = self.pageYOffset;");
         script.append("}");
-        script.append(" else if ((document.documentElement && document.documentElement.scrollLeft)||(document.documentElement && document.documentElement.scrollTop))");
+        script.append(" else if ((document.documentElement && document.documentElement.scrollLeft)||"+
+                "(document.documentElement && document.documentElement.scrollTop))");
         script.append("{");
         script.append("x = document.documentElement.scrollLeft;");
         script.prettyLine();
@@ -1432,90 +1680,124 @@ public final class HtmlRendererUtils {
 
         ExternalContext externalContext = facesContext.getExternalContext();
         String oldViewId = JavascriptUtils.getOldViewId(externalContext);
-        if (oldViewId != null && oldViewId.equals(facesContext.getViewRoot().getViewId())) {
+        if (oldViewId != null
+                && oldViewId.equals(facesContext.getViewRoot().getViewId()))
+        {
             //ok, we stayed on the same page, so let's scroll it to the former place
-            String scrolling = (String) externalContext.getRequestParameterMap().get(AUTO_SCROLL_PARAM);
-            if (scrolling != null && scrolling.length() > 0) {
+            String scrolling = (String) externalContext
+                    .getRequestParameterMap().get(AUTO_SCROLL_PARAM);
+            if (scrolling != null && scrolling.length() > 0)
+            {
                 int x = 0;
                 int y = 0;
                 int comma = scrolling.indexOf(',');
-                if (comma == -1) {
-                    log.warning("Illegal autoscroll request parameter: " + scrolling);
-                } else {
-                    try {
+                if (comma == -1)
+                {
+                    log.warning("Illegal autoscroll request parameter: "
+                            + scrolling);
+                }
+                else
+                {
+                    try
+                    {
                         //we convert to int against XSS vulnerability
                         x = Integer.parseInt(scrolling.substring(0, comma));
-                    } catch (NumberFormatException e) {
-                        log.warning("Error getting x offset for autoscroll feature. Bad param value: " + scrolling);
+                    }
+                    catch (NumberFormatException e)
+                    {
+                        log.warning("Error getting x offset for autoscroll feature. Bad param value: "
+                                + scrolling);
                         x = 0; //ignore false numbers
                     }
 
-                    try {
+                    try
+                    {
                         //we convert to int against XSS vulnerability
                         y = Integer.parseInt(scrolling.substring(comma + 1));
-                    } catch (NumberFormatException e) {
-                        log.warning("Error getting y offset for autoscroll feature. Bad param value: " + scrolling);
+                    }
+                    catch (NumberFormatException e)
+                    {
+                        log.warning("Error getting y offset for autoscroll feature. Bad param value: "
+                                + scrolling);
                         y = 0; //ignore false numbers
                     }
                 }
-                script.append("window.scrollTo(").append(x).append(",").append(y).append(");\n");
+                script.append("window.scrollTo(").append(x).append(",")
+                        .append(y).append(");\n");
             }
         }
 
         return script.toString();
     }
 
-    public static boolean isAllowedCdataSection(FacesContext fc) {
+    public static boolean isAllowedCdataSection(FacesContext fc)
+    {
         Boolean value = null;
 
-        if (fc != null) {
-            value = (Boolean) fc.getExternalContext().getRequestMap().get(ALLOW_CDATA_SECTION_ON);
+        if (fc != null)
+        {
+            value = (Boolean) fc.getExternalContext().getRequestMap()
+                    .get(ALLOW_CDATA_SECTION_ON);
         }
 
         return value != null && ((Boolean) value).booleanValue();
     }
 
-    public static void allowCdataSection(FacesContext fc, boolean cdataSectionAllowed) {
-        fc.getExternalContext().getRequestMap().put(ALLOW_CDATA_SECTION_ON, Boolean.valueOf(cdataSectionAllowed));
+    public static void allowCdataSection(FacesContext fc,
+            boolean cdataSectionAllowed)
+    {
+        fc.getExternalContext()
+                .getRequestMap()
+                .put(ALLOW_CDATA_SECTION_ON,
+                        Boolean.valueOf(cdataSectionAllowed));
     }
 
-    public static class LinkParameter {
+    public static class LinkParameter
+    {
         private String _name;
 
         private Object _value;
 
-        public String getName() {
+        public String getName()
+        {
             return _name;
         }
 
-        public void setName(String name) {
+        public void setName(String name)
+        {
             _name = name;
         }
 
-        public Object getValue() {
+        public Object getValue()
+        {
             return _value;
         }
 
-        public void setValue(Object value) {
+        public void setValue(Object value)
+        {
             _value = value;
         }
 
     }
 
     public static void renderHiddenCommandFormParams(ResponseWriter writer,
-                                                     Set dummyFormParams) throws IOException {
-        for (Iterator it = dummyFormParams.iterator(); it.hasNext();) {
+            Set dummyFormParams) throws IOException
+    {
+        for (Iterator it = dummyFormParams.iterator(); it.hasNext();)
+        {
             Object name = it.next();
             renderHiddenInputField(writer, name, null);
         }
     }
 
-    public static void renderHiddenInputField(ResponseWriter writer, Object name, Object value)
-            throws IOException {
+    public static void renderHiddenInputField(ResponseWriter writer,
+            Object name, Object value) throws IOException
+    {
         writer.startElement(HTML.INPUT_ELEM, null);
         writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_HIDDEN, null);
         writer.writeAttribute(HTML.NAME_ATTR, name, null);
-        if (value != null) {
+        if (value != null)
+        {
             writer.writeAttribute(HTML.VALUE_ATTR, value, null);
         }
         writer.endElement(HTML.INPUT_ELEM);
@@ -1532,25 +1814,32 @@ public final class HtmlRendererUtils {
      */
     @Deprecated
     public static void renderLabel(ResponseWriter writer,
-                                   UIComponent component,
-                                   String forClientId,
-                                   String labelValue,
-                                   boolean disabled) throws IOException {
+            UIComponent component, String forClientId, String labelValue,
+            boolean disabled) throws IOException
+    {
         writer.startElement(HTML.LABEL_ELEM, component);
         writer.writeAttribute(HTML.FOR_ATTR, forClientId, null);
 
         String labelClass = null;
 
-        if (disabled) {
-            labelClass = (String) component.getAttributes().get(JSFAttr.DISABLED_CLASS_ATTR);
-        } else {
-            labelClass = (String) component.getAttributes().get(org.apache.myfaces.shared.renderkit.JSFAttr.ENABLED_CLASS_ATTR);
+        if (disabled)
+        {
+            labelClass = (String) component.getAttributes().get(
+                    JSFAttr.DISABLED_CLASS_ATTR);
         }
-        if (labelClass != null) {
+        else
+        {
+            labelClass = (String) component
+                    .getAttributes()
+                    .get(org.apache.myfaces.shared.renderkit.JSFAttr.ENABLED_CLASS_ATTR);
+        }
+        if (labelClass != null)
+        {
             writer.writeAttribute("class", labelClass, "labelClass");
         }
 
-        if ((labelValue != null) && (labelValue.length() > 0)) {
+        if ((labelValue != null) && (labelValue.length() > 0))
+        {
             writer.write(HTML.NBSP_ENTITY);
             writer.writeText(labelValue, null);
         }
@@ -1562,31 +1851,41 @@ public final class HtmlRendererUtils {
      * Renders a label HTML element
      */
     public static void renderLabel(ResponseWriter writer,
-                                   UIComponent component,
-                                   String forClientId,
-                                   SelectItem item,
-                                   boolean disabled) throws IOException {
+            UIComponent component, String forClientId, SelectItem item,
+            boolean disabled) throws IOException
+    {
         writer.startElement(HTML.LABEL_ELEM, component);
         writer.writeAttribute(HTML.FOR_ATTR, forClientId, null);
 
         String labelClass = null;
 
-        if (disabled) {

[... 2188 lines stripped ...]