// This will be Boolean.TRUE if
// we have all three icons, Boolean.FALSE if we
// don't, or null if we haven't checked yet.
boolean rtl = _isRightToLeft(context);
Boolean value;
Skin skin = context.getSkin();
if (rtl)
value = (Boolean)skin.getProperty(_IMAGE_BUTTON_RTL_KEY);
else
value = (Boolean)skin.getProperty(_IMAGE_BUTTON_KEY);
if (value != null)
return (Boolean.TRUE == value);
// we fetch different icons if we are in the
// right-to-left reading direction. context.getIcon takes care of
// this, by adding the :rtl suffix to the icon name if the
// reading direction is rtl.
Icon startIcon = context.getIcon(
BUTTON_START_ICON_NAME);
Icon endIcon = context.getIcon(
BUTTON_END_ICON_NAME);
Icon topBackgroundIcon = context.getIcon(
BUTTON_TOP_BACKGROUND_ICON_NAME);
Icon bottomBackgroundIcon = context.getIcon(
BUTTON_BOTTOM_BACKGROUND_ICON_NAME);
// List of missing icons
String missing = null;
if (startIcon == null)
missing = _addMissingIcon(missing, BUTTON_START_ICON_NAME);
if (endIcon == null)
missing = _addMissingIcon(missing, BUTTON_END_ICON_NAME);
if (topBackgroundIcon == null)
missing = _addMissingIcon(missing, BUTTON_TOP_BACKGROUND_ICON_NAME);
if (bottomBackgroundIcon == null)
missing = _addMissingIcon(missing, BUTTON_BOTTOM_BACKGROUND_ICON_NAME);
// If we are missing any of the icons, we don't render
// the button image.
if (missing != null)
{
// Only bother logging a message if one or more of the button
// icons were actually specified. If no button icons were
// specified, than the user probably just wants to use
// browser-based buttons.
if ((startIcon != null) ||
(endIcon != null) ||
(topBackgroundIcon != null) ||
(bottomBackgroundIcon != null))
{
if (_LOG.isWarning())
{
if (rtl)
missing += "(Add :rtl to the icon names since locale is rtl)";
_LOG.warning(_MISSING_ICON_ERROR + missing);
}
}
if (rtl)
skin.setProperty(_IMAGE_BUTTON_RTL_KEY, Boolean.FALSE);
else
skin.setProperty(_IMAGE_BUTTON_KEY, Boolean.FALSE);
return false;
}
if (rtl)
skin.setProperty(_IMAGE_BUTTON_RTL_KEY, Boolean.TRUE);
else
skin.setProperty(_IMAGE_BUTTON_KEY, Boolean.TRUE);
return true;
}