if (!button.isRenderEnabled()) {
itemElement.setAttribute("enabled", "false");
}
if (button instanceof ToggleButton) {
ToggleButton toggleButton = (ToggleButton) button;
itemElement.setAttribute("toggle", "true");
itemElement.setAttribute("selected", toggleButton.isSelected() ? "true" : "false");
itemElement.setAttribute("state-icon", ImageTools.getUri(rc, this, toggleButton, IMAGE_ID_STATE_ICON));
itemElement.setAttribute("selected-state-icon", ImageTools.getUri(rc, this, toggleButton,
IMAGE_ID_SELECTED_STATE_ICON));
if (rolloverEnabled && toggleButton.getRenderProperty(ToggleButton.PROPERTY_ROLLOVER_STATE_ICON) != null
&& toggleButton.getRenderProperty(ToggleButton.PROPERTY_ROLLOVER_SELECTED_STATE_ICON) != null) {
itemElement.setAttribute("rollover-state-icon",
ImageTools.getUri(rc, this, toggleButton, IMAGE_ID_ROLLOVER_STATE_ICON));
itemElement.setAttribute("rollover-selected-state-icon",
ImageTools.getUri(rc, this, toggleButton, IMAGE_ID_ROLLOVER_SELECTED_STATE_ICON));
}
if (pressedEnabled && toggleButton.getRenderProperty(ToggleButton.PROPERTY_PRESSED_STATE_ICON) != null
&& toggleButton.getRenderProperty(ToggleButton.PROPERTY_PRESSED_SELECTED_STATE_ICON) != null) {
itemElement.setAttribute("pressed-state-icon",
ImageTools.getUri(rc, this, toggleButton, IMAGE_ID_PRESSED_STATE_ICON));
itemElement.setAttribute("pressed-selected-state-icon",
ImageTools.getUri(rc, this, toggleButton, IMAGE_ID_PRESSED_SELECTED_STATE_ICON));
}