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:08:06 UTC
svn commit: r1621264 -
/myfaces/tobago/trunk/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:08:06 2014
New Revision: 1621264
URL: http://svn.apache.org/r1621264
Log:
TOBAGO-1418: Possibly leave out the file extension of images and icons
- fix
Modified:
myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MenuCommandRenderer.java
Modified: myfaces/tobago/trunk/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/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MenuCommandRenderer.java?rev=1621264&r1=1621263&r2=1621264&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MenuCommandRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MenuCommandRenderer.java Fri Aug 29 09:08:06 2014
@@ -89,7 +89,7 @@ public class MenuCommandRenderer extends
final String hiddenId = radio.getClientId(facesContext);
for (final SelectItem item : SelectItemUtils.getItemIterator(facesContext, radio)) {
final boolean checked = ObjectUtils.equals(item.getValue(), radio.getValue());
- final String image = checked ? "image/MenuRadioChecked.gif" : null;
+ final String image = checked ? "image/MenuRadioChecked" : null;
final String labelText = item.getLabel();
final LabelWithAccessKey label = new LabelWithAccessKey(labelText);
final String formattedValue = RenderUtils.getFormattedValue(facesContext, radio, item.getValue());
@@ -101,7 +101,16 @@ public class MenuCommandRenderer extends
encodeHidden(writer, hiddenId, getCurrentValue(facesContext, radio));
} else {
// normal menu command
- final String image = menu.getImage();
+ final String customImage = menu.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, menu));
final LabelWithAccessKey label = new LabelWithAccessKey(menu);
encodeItem(facesContext, writer, menu, label, map, disabled, firstLevel, image, null, null, menu.getClientId());
@@ -177,7 +186,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);
}