public ImageReference getImage(Component component, String imageId) {
if (IMAGE_ID_ICON.equals(imageId)) {
if (component.isRenderEnabled()) {
return (ImageReference) component.getRenderProperty(AbstractButton.PROPERTY_ICON);
} else {
ImageReference icon = (ImageReference) component.getRenderProperty(AbstractButton.PROPERTY_DISABLED_ICON);
if (icon == null) {
icon = (ImageReference) component.getRenderProperty(AbstractButton.PROPERTY_ICON);
}
return icon;
}
} else if (IMAGE_ID_ROLLOVER_ICON.equals(imageId)) {
return (ImageReference) component.getRenderProperty(AbstractButton.PROPERTY_ROLLOVER_ICON);
} else if (IMAGE_ID_PRESSED_ICON.equals(imageId)) {
return (ImageReference) component.getRenderProperty(AbstractButton.PROPERTY_PRESSED_ICON);
} else if (IMAGE_ID_STATE_ICON.equals(imageId)) {
return getStateIcon((ToggleButton) component);
} else if (IMAGE_ID_SELECTED_STATE_ICON.equals(imageId)) {
return getSelectedStateIcon((ToggleButton) component);
} else if (IMAGE_ID_BACKGROUND.equals(imageId)) {
FillImage backgroundImage;
if (component.isRenderEnabled()) {
backgroundImage = (FillImage) component.getRenderProperty(AbstractButton.PROPERTY_BACKGROUND_IMAGE);
} else {
backgroundImage = (FillImage) component.getRenderProperty(AbstractButton.PROPERTY_DISABLED_BACKGROUND_IMAGE);
if (backgroundImage == null) {
backgroundImage = (FillImage) component.getRenderProperty(AbstractButton.PROPERTY_BACKGROUND_IMAGE);
}
}
if (backgroundImage == null) {
return null;
} else {
return backgroundImage.getImage();
}
} else if (IMAGE_ID_ROLLOVER_BACKGROUND.equals(imageId)) {
FillImage backgroundImage
= (FillImage) component.getRenderProperty(AbstractButton.PROPERTY_ROLLOVER_BACKGROUND_IMAGE);
if (backgroundImage == null) {
return null;
} else {
return backgroundImage.getImage();
}
} else if (IMAGE_ID_PRESSED_BACKGROUND.equals(imageId)) {
FillImage backgroundImage
= (FillImage) component.getRenderProperty(AbstractButton.PROPERTY_PRESSED_BACKGROUND_IMAGE);
if (backgroundImage == null) {
return null;
} else {
return backgroundImage.getImage();
}
} else if (IMAGE_ID_ROLLOVER_STATE_ICON.equals(imageId)) {
ImageReference icon = (ImageReference) component.getRenderProperty(ToggleButton.PROPERTY_ROLLOVER_STATE_ICON);
return icon == null ? getStateIcon((ToggleButton) component) : icon;
} else if (IMAGE_ID_ROLLOVER_SELECTED_STATE_ICON.equals(imageId)) {
ImageReference icon = (ImageReference) component.getRenderProperty(ToggleButton.PROPERTY_ROLLOVER_SELECTED_STATE_ICON);
return icon == null ? getSelectedStateIcon((ToggleButton) component) : icon;
} else if (IMAGE_ID_PRESSED_STATE_ICON.equals(imageId)) {
ImageReference icon = (ImageReference) component.getRenderProperty(ToggleButton.PROPERTY_PRESSED_STATE_ICON);
return icon == null ? getStateIcon((ToggleButton) component) : icon;
} else if (IMAGE_ID_PRESSED_SELECTED_STATE_ICON.equals(imageId)) {
ImageReference icon = (ImageReference) component.getRenderProperty(ToggleButton.PROPERTY_PRESSED_SELECTED_STATE_ICON);
return icon == null ? getSelectedStateIcon((ToggleButton) component) : icon;
} else {
return null;
}
}