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/08/29 11:12:33 UTC

svn commit: r1621268 - 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/MenuCommandRenderer.java

Author: lofwyr
Date: Fri Aug 29 09:12:32 2014
New Revision: 1621268

URL: http://svn.apache.org/r1621268
Log:
Merged from trunk
TOBAGO-1418: Possibly leave out the file extension of images and icons
- fix [from revision 1621264]

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

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

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/MenuCommandRenderer.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/MenuCommandRenderer.java?rev=1621268&r1=1621267&r2=1621268&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/MenuCommandRenderer.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/MenuCommandRenderer.java Fri Aug 29 09:12:32 2014
@@ -103,7 +103,16 @@ public class MenuCommandRenderer extends
       encodeHidden(writer, hiddenId, getCurrentValue(facesContext, radio));
     } else {
       // normal menu command
-      final String image = command.getImage();
+      final String customImage = command.getImage();
+      final String image;
+      if (customImage != null) {
+        final int dot = ResourceManagerUtils.indexOfExtension(customImage);
+        final int pos = dot == -1 ? customImage.length() : dot; // avoid exception if no '.' in name
+        image = customImage.substring(0, pos);
+        // XXX here we lost the name of the extension
+      } else {
+        image = null;
+      }
       final CommandMap map = new CommandMap(new Command(facesContext, command));
       final LabelWithAccessKey label = new LabelWithAccessKey(command);
       encodeItem(
@@ -181,7 +190,7 @@ public class MenuCommandRenderer extends
       } else {
         final Style style = new Style();
         style.setBackgroundImage("url('"
-            + ResourceManagerUtils.getImageOrDisabledImageWithPath(facesContext, image, disabled)
+            + ResourceManagerUtils.getImageOrDisabledImage(facesContext, image, disabled)
             + "')");
         writer.writeStyleAttribute(style);
       }