You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by de...@apache.org on 2015/06/10 08:38:18 UTC

svn commit: r1684572 - in /myfaces/tobago/branches/tobago-3.0.x: ./ tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tob...

Author: deki
Date: Wed Jun 10 06:38:17 2015
New Revision: 1684572

URL: http://svn.apache.org/r1684572
Log:
Merged from trunk
TOBAGO-1446
Different behavior in render classes
submitted value is used for select*** [from revision 1665521]
TOBAGO-1446
Different behavior in render classes
submitted value is used for select*** [from revision 1665549]
TOBAGO-1446
Different behavior in render classes
submitted value is used for select*** [from revision 1665570]

Modified:
    myfaces/tobago/branches/tobago-3.0.x/   (props changed)
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyCheckboxRenderer.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneChoiceRenderer.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java

Propchange: myfaces/tobago/branches/tobago-3.0.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jun 10 06:38:17 2015
@@ -1,3 +1,3 @@
 /myfaces/tobago/branches/tobago-1.5.x:1356585,1357124
 /myfaces/tobago/branches/tobago-tree-table:1226794-1341423
-/myfaces/tobago/trunk:1571193,1571804,1571816,1571941,1571945,1571962,1571966,1576730,1589960,1591854,1600239,1600818,1601860,1602151,1602154,1602343,1604224,1606201,1607642,1609696-1609697,1609718,1610942,1610948,1610970,1610989,1611011,1611259,1611264,1611276,1611329,1611338-1611339,1611571,1613015,1613032,1614827,1614853,1615053,1615114,1615121,1617310,1619789,1621101,1621107,1621134,1621156,1621264,1621282,1621332,1622222,1622243,1622508,1623934,1624033,1625968,1625972,1626270,1628899,1628953,1636842,1636911,1640117,1640147,1640541,1640548,1640638,1640761,1640917,1641575,1641635,1641772,1641775,1641777,1656502,1657180,1657269,1657276,1657279,1658909,1658912,1659026,1659031,1660696,1660699,1660708,1660714,1665486,1665569,1666464,1668147,1668153,1668249,1675330,1675565,1675584,1675588-1675589,1675636,1679031,1680197,1681981,1682448,1682545,1682548,1683231,1683306,1683373
+/myfaces/tobago/trunk:1571193,1571804,1571816,1571941,1571945,1571962,1571966,1576730,1589960,1591854,1600239,1600818,1601860,1602151,1602154,1602343,1604224,1606201,1607642,1609696-1609697,1609718,1610942,1610948,1610970,1610989,1611011,1611259,1611264,1611276,1611329,1611338-1611339,1611571,1613015,1613032,1614827,1614853,1615053,1615114,1615121,1617310,1619789,1621101,1621107,1621134,1621156,1621264,1621282,1621332,1622222,1622243,1622508,1623934,1624033,1625968,1625972,1626270,1628899,1628953,1636842,1636911,1640117,1640147,1640541,1640548,1640638,1640761,1640917,1641575,1641635,1641772,1641775,1641777,1656502,1657180,1657269,1657276,1657279,1658909,1658912,1659026,1659031,1660696,1660699,1660708,1660714,1665486,1665521,1665549,1665569-1665570,1666464,1668147,1668153,1668249,1675330,1675565,1675584,1675588-1675589,1675636,1679031,1680197,1681981,1682448,1682545,1682548,1683231,1683306,1683373

Modified: myfaces/tobago/branches/tobago-3.0.x/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/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyCheckboxRenderer.java?rev=1684572&r1=1684571&r2=1684572&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyCheckboxRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyCheckboxRenderer.java Wed Jun 10 06:38:17 2015
@@ -75,6 +75,7 @@ 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 boolean itemDisabled = item.isDisabled() || disabled;
@@ -88,11 +89,16 @@ public class SelectManyCheckboxRenderer
       writer.startElement(HtmlElements.LABEL, 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, itemDisabled);
       writer.writeAttribute(HtmlAttributes.READONLY, readonly);

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneChoiceRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneChoiceRenderer.java?rev=1684572&r1=1684571&r2=1684572&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneChoiceRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneChoiceRenderer.java Wed Jun 10 06:38:17 2015
@@ -79,7 +79,8 @@ public class SelectOneChoiceRenderer ext
     HtmlRendererUtils.renderCommandFacet(select, facesContext , writer);
     HtmlRendererUtils.renderFocus(id, select.isFocus(), ComponentUtils.isError(select), facesContext, writer);
     
-    HtmlRendererUtils.renderSelectItems(select, items, select.getValue(), (String) select.getSubmittedValue(), writer, facesContext);
+    HtmlRendererUtils.renderSelectItems(select, items, select.getValue(), (String) select.getSubmittedValue(), writer,
+        facesContext);
 
     writer.endElement(HtmlElements.SELECT);
     super.encodeEnd(facesContext, select);

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java?rev=1684572&r1=1684571&r2=1684572&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java Wed Jun 10 06:38:17 2015
@@ -192,27 +192,30 @@ public final class HtmlRendererUtils {
   }
 
   public static void renderSelectItems(final UIInput component, final Iterable<SelectItem> items, final Object[] values,
-      final String[] submittedValues, final TobagoResponseWriter writer, final FacesContext facesContext) throws IOException {
+      final String[] submittedValues, final TobagoResponseWriter writer, final FacesContext facesContext)
+      throws IOException {
     renderSelectItems(component, items, values, submittedValues, null, writer, facesContext);
   }
 
   public static void renderSelectItems(final UIInput component, final Iterable<SelectItem> items, final Object value,
-      final String submittedValue, final TobagoResponseWriter writer, final FacesContext facesContext) throws IOException {
-    renderSelectItems(component, items, value != null ? new Object[] {value}: null, submittedValue != null ?  new String[] {submittedValue}: null, null, writer, facesContext);
+      final String submittedValue, final TobagoResponseWriter writer, final FacesContext facesContext)
+      throws IOException {
+    renderSelectItems(component, items, value != null ? new Object[] {value}: null,
+        submittedValue != null ?  new String[] {submittedValue}: null, null, writer, facesContext);
   }
 
   /**
    * @deprecated Since Tobago 2.0.7
    */
   @Deprecated
-  public static void renderSelectItems(
-      final UIInput component, final Iterable<SelectItem> items, final Object[] values,
-      final Boolean onlySelected, final TobagoResponseWriter writer, final FacesContext facesContext) throws IOException {
+  public static void renderSelectItems(final UIInput component, final Iterable<SelectItem> items, final Object[] values,
+      final Boolean onlySelected, final TobagoResponseWriter writer, final FacesContext facesContext)
+      throws IOException {
     renderSelectItems(component, items, values, null, onlySelected, writer, facesContext);
   }
-  public static void renderSelectItems(
-      final UIInput component, final Iterable<SelectItem> items, final Object[] values, final String[] submittedValues,
-      final Boolean onlySelected, final TobagoResponseWriter writer, final FacesContext facesContext) throws IOException {
+  public static void renderSelectItems(final UIInput component, final Iterable<SelectItem> items, final Object[] values,
+      final String[] submittedValues, final Boolean onlySelected, final TobagoResponseWriter writer,
+      final FacesContext facesContext) throws IOException {
 
     if (LOG.isDebugEnabled()) {
       LOG.debug("component id = '{}'", component.getId());
@@ -227,7 +230,8 @@ public final class HtmlRendererUtils {
           writer.writeAttribute(HtmlAttributes.DISABLED, true);
         }
         final SelectItem[] selectItems = ((SelectItemGroup) item).getSelectItems();
-        renderSelectItems(component, Arrays.asList(selectItems), values, submittedValues, onlySelected, writer, facesContext);
+        renderSelectItems(component, Arrays.asList(selectItems), values, submittedValues,
+            onlySelected, writer, facesContext);
         writer.endElement(HtmlElements.OPTGROUP);
       } else {