You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2014/02/26 10:10:45 UTC

svn commit: r1571970 - 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/ToolBarRendererBase.java

Author: lofwyr
Date: Wed Feb 26 09:10:44 2014
New Revision: 1571970

URL: http://svn.apache.org/r1571970
Log:
Merged from trunk
TOBAGO-1362: Support dynamic list of objects for f:selectItems
 - Iterator can only be used one time [from revision 1571816]

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/ToolBarRendererBase.java

Propchange: myfaces/tobago/branches/tobago-3.0.x/
------------------------------------------------------------------------------
  Merged /myfaces/tobago/trunk:r1571816

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/ToolBarRendererBase.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/ToolBarRendererBase.java?rev=1571970&r1=1571969&r2=1571970&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/ToolBarRendererBase.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/ToolBarRendererBase.java Wed Feb 26 09:10:44 2014
@@ -60,6 +60,8 @@ import javax.faces.component.UIComponent
 import javax.faces.context.FacesContext;
 import javax.faces.model.SelectItem;
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
 
 public abstract class ToolBarRendererBase extends LayoutComponentRendererBase {
 
@@ -132,15 +134,20 @@ public abstract class ToolBarRendererBas
       items = SelectItemUtils.getItems(facesContext, radio);
     }
 
+    List<SelectItem> list = new ArrayList<SelectItem>();
+    for (final SelectItem item : items) {
+      list.add(item);
+    }
+
     if (radio != null) {
       writer.startElement(HtmlElements.SPAN, radio);
       writer.writeClassAttribute(Classes.create(toolBar, "selectOne"));
       final Object value = radio.getValue();
 
       String currentValue = "";
-      boolean markFirst = !hasSelectedValue(items, value);
+      boolean markFirst = !hasSelectedValue(list, value);
       final String radioId = radio.getClientId(facesContext);
-      for (final SelectItem item : items) {
+      for (final SelectItem item : list) {
         final String labelText = item.getLabel();
         if (labelText != null) {
           command.getAttributes().put(Attributes.LABEL, labelText);
@@ -151,8 +158,6 @@ public abstract class ToolBarRendererBas
         String image = null;
         if (item instanceof org.apache.myfaces.tobago.model.SelectItem) {
           image = ((org.apache.myfaces.tobago.model.SelectItem) item).getImage();
-        } else if (LOG.isDebugEnabled()) {
-          LOG.debug("select item is not " + org.apache.myfaces.tobago.model.SelectItem.class.getName());
         }
         if (image == null) {
           image = "image/1x1.gif";