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 08:34:50 UTC

svn commit: r1571945 - in /myfaces/tobago/trunk: tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/ tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style...

Author: lofwyr
Date: Wed Feb 26 07:34:50 2014
New Revision: 1571945

URL: http://svn.apache.org/r1571945
Log:
TOBAGO-1371: Radio buttons should render icons, if available

Added:
    myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/EUR-14.png   (with props)
    myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/EUR.png   (with props)
    myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/JPY-14.png   (with props)
    myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/JPY.png   (with props)
    myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/TTD-14.png   (with props)
    myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/TTD.png   (with props)
    myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/USD-14.png   (with props)
    myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/USD.png   (with props)
Modified:
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneRadioRenderer.java

Added: myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/EUR-14.png
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/EUR-14.png?rev=1571945&view=auto
==============================================================================
Binary file - no diff available.

Propchange: myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/EUR-14.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/EUR.png
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/EUR.png?rev=1571945&view=auto
==============================================================================
Binary file - no diff available.

Propchange: myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/EUR.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/JPY-14.png
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/JPY-14.png?rev=1571945&view=auto
==============================================================================
Binary file - no diff available.

Propchange: myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/JPY-14.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/JPY.png
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/JPY.png?rev=1571945&view=auto
==============================================================================
Binary file - no diff available.

Propchange: myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/JPY.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/TTD-14.png
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/TTD-14.png?rev=1571945&view=auto
==============================================================================
Binary file - no diff available.

Propchange: myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/TTD-14.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/TTD.png
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/TTD.png?rev=1571945&view=auto
==============================================================================
Binary file - no diff available.

Propchange: myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/TTD.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/USD-14.png
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/USD-14.png?rev=1571945&view=auto
==============================================================================
Binary file - no diff available.

Propchange: myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/USD-14.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/USD.png
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/USD.png?rev=1571945&view=auto
==============================================================================
Binary file - no diff available.

Propchange: myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/USD.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css?rev=1571945&r1=1571944&r2=1571945&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css Wed Feb 26 07:34:50 2014
@@ -897,6 +897,11 @@ li.tobago-menu-markup-selected {
   margin: 0;
 }
 
+.tobago-selectOneRadio img {
+  margin-right: 5px;
+  margin-left: 5px;
+}
+
 .tobago-selectOneRadio-markup-disabled {
   color: #778899;
 }

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneRadioRenderer.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/SelectOneRadioRenderer.java?rev=1571945&r1=1571944&r2=1571945&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneRadioRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneRadioRenderer.java Wed Feb 26 07:34:50 2014
@@ -22,6 +22,7 @@ package org.apache.myfaces.tobago.render
 import org.apache.myfaces.tobago.component.UISelectOneRadio;
 import org.apache.myfaces.tobago.config.Configurable;
 import org.apache.myfaces.tobago.context.Markup;
+import org.apache.myfaces.tobago.context.ResourceManagerUtils;
 import org.apache.myfaces.tobago.layout.Measure;
 import org.apache.myfaces.tobago.renderkit.SelectOneRendererBase;
 import org.apache.myfaces.tobago.renderkit.css.Classes;
@@ -56,7 +57,7 @@ public class SelectOneRadioRenderer exte
     final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
 
     final String id = select.getClientId(facesContext);
-    final Iterable<SelectItem> items = SelectItemUtils.getItems(facesContext, select);
+    final Iterable<SelectItem> items = SelectItemUtils.getItemIterator(facesContext, select);
     final String title = HtmlRendererUtils.getTitleFromTipAndMessages(facesContext, select);
     final boolean disabled = select.isDisabled();
     final boolean readonly = select.isReadonly();
@@ -100,6 +101,19 @@ public class SelectOneRadioRenderer exte
       HtmlRendererUtils.renderCommandFacet(select, itemId, facesContext, writer);
       writer.endElement(HtmlElements.INPUT);
 
+      if (item instanceof org.apache.myfaces.tobago.model.SelectItem) {
+        org.apache.myfaces.tobago.model.SelectItem tobagoItem = (org.apache.myfaces.tobago.model.SelectItem) item;
+        final String image = tobagoItem.getImage();
+        if (image != null) {
+          final String imageToRender
+              = ResourceManagerUtils.getImageOrDisabledImageWithPath(facesContext, image, item.isDisabled());
+          writer.startElement(HtmlElements.IMG, select);
+          writer.writeAttribute(HtmlAttributes.SRC, imageToRender, true);
+          writer.writeAttribute(HtmlAttributes.ALT, "", false);
+          writer.endElement(HtmlElements.IMG);
+        }
+      }
+
       final String label = item.getLabel();
       if (label != null) {
         writer.startElement(HtmlElements.LABEL, select);
@@ -122,7 +136,7 @@ public class SelectOneRadioRenderer exte
       return heightOfOne;
     } else {
       int count = 0;
-      for(SelectItem ignored : SelectItemUtils.getItems(facesContext, (UISelectOne) component)) {
+      for(SelectItem ignored : SelectItemUtils.getItemIterator(facesContext, (UISelectOne) component)) {
         count++;
       }
       return heightOfOne.multiply(count);