if (!(component instanceof UICommand)) {
LOG.error("Wrong type: Need " + UICommand.class.getName() + ", but was " + component.getClass().getName());
return;
}
UICommand command = (UICommand) component;
String clientId = command.getClientId(facesContext);
String buttonType = createButtonType(command);
CommandRendererHelper helper = new CommandRendererHelper(facesContext, command, CommandRendererHelper.Tag.BUTTON);
TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);
LabelWithAccessKey label = new LabelWithAccessKey(command);
writer.startElement(HtmlConstants.BUTTON, command);
writer.writeAttribute(HtmlAttributes.TYPE, buttonType, false);
writer.writeNameAttribute(clientId);
writer.writeIdAttribute(clientId);
writer.writeAttributeFromComponent(HtmlAttributes.TITLE, ATTR_TIP);
writer.writeAttribute(HtmlAttributes.DISABLED, helper.isDisabled());
Integer tabIndex = null;
if (command instanceof UIButtonCommand) {
tabIndex = ((UIButtonCommand) command).getTabIndex();
}
if (tabIndex != null) {
writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
}
if (helper.getOnclick() != null) {
writer.writeAttribute(HtmlAttributes.ONCLICK, helper.getOnclick(), true);
}
writer.writeStyleAttribute();
writer.writeClassAttribute();
writer.flush(); // force closing the start tag
// image
String imageName = (String) command.getAttributes().get(ATTR_IMAGE);
if (imageName != null) {
String image = null;
if (imageName.startsWith("HTTP:") || imageName.startsWith("FTP:")
|| imageName.startsWith("/")) {
image = imageName;