myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bom...@apache.org
Subject svn commit: r1665549 - /myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyCheckboxRenderer.java
Date Tue, 10 Mar 2015 13:49:29 GMT
Author: bommel
Date: Tue Mar 10 13:49:28 2015
New Revision: 1665549

URL: http://svn.apache.org/r1665549
Log:
TOBAGO-1446
Different behavior in render classes
submitted value is used for select***

Modified:
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyCheckboxRenderer.java

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyCheckboxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyCheckboxRenderer.java?rev=1665549&r1=1665548&r2=1665549&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyCheckboxRenderer.java
(original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyCheckboxRenderer.java
Tue Mar 10 13:49:28 2015
@@ -22,6 +22,7 @@ package org.apache.myfaces.tobago.render
 import org.apache.myfaces.tobago.component.UISelectManyCheckbox;
 import org.apache.myfaces.tobago.config.Configurable;
 import org.apache.myfaces.tobago.context.Markup;
+import org.apache.myfaces.tobago.internal.util.ObjectUtils;
 import org.apache.myfaces.tobago.layout.Measure;
 import org.apache.myfaces.tobago.renderkit.SelectManyRendererBase;
 import org.apache.myfaces.tobago.renderkit.css.Classes;
@@ -74,17 +75,23 @@ public class SelectManyCheckboxRenderer
     }
     boolean first = true;
     final Object[] values = select.getSelectedValues();
+    final String[] submittedValues = getSubmittedValues(select);
     int i = 0;
     for (final SelectItem item : SelectItemUtils.getItemIterator(facesContext, select)) {
       final String itemId = id + ComponentUtils.SUB_SEPARATOR + i++;
       writer.startElement(HtmlElements.LI, select);
       writer.startElement(HtmlElements.INPUT, select);
       writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.CHECKBOX, false);
-      final boolean checked = RenderUtils.contains(values, item.getValue());
+      final String formattedValue = RenderUtils.getFormattedValue(facesContext, select, item.getValue());
+      boolean checked;
+      if (submittedValues == null) {
+        checked = RenderUtils.contains(values, item.getValue());
+      } else {
+        checked = RenderUtils.contains(submittedValues, formattedValue);
+      }
       writer.writeAttribute(HtmlAttributes.CHECKED, checked);
       writer.writeNameAttribute(id);
       writer.writeIdAttribute(itemId);
-      final String formattedValue = RenderUtils.getFormattedValue(facesContext, select, item.getValue());
       writer.writeAttribute(HtmlAttributes.VALUE, formattedValue, true);
       writer.writeAttribute(HtmlAttributes.DISABLED, item.isDisabled() || disabled);
       writer.writeAttribute(HtmlAttributes.READONLY, readonly);



Mime
View raw message