{
iconName = getSkinResourceMappedKey(iconName);
if (iconName == null)
return null;
Skin skin = getSkin();
// If we're in right-to-left, and the code asking us hasn't
// already slapped on a right-to-left suffix, then go looking
// in right-to-left land
if (isRightToLeft() && !iconName.endsWith(StyleUtils.RTL_CSS_SUFFIX))
{
// append :rtl to the mappedIconName. If no icon with that name,
// default to getting the icon with the original mappedIconName.
String rtlIconName = iconName + StyleUtils.RTL_CSS_SUFFIX;
Icon rtlIcon = skin.getIcon(rtlIconName);
if ((rtlIcon == null) || rtlIcon.isNull())
{
// we want :rtl icons to default to regular icons, not a NullIcon,
// which is what the Skin does.
rtlIcon = skin.getIcon(iconName);
if (rtlIcon != null)
{
// cache regular icon so we don't need to get it again!
skin.registerIcon(rtlIconName, rtlIcon);
}
}
return rtlIcon;
}
else
{
return skin.getIcon(iconName);
}
}