Images for command buttons are defined via CSS ("image" attribute). Unfortunately we have many dynamic images coming from DB e.g. We have a problem at the moment with this code
Code: Select all
<p:commandButton ...>
<h:graphicImage value="#{container.action.imagePath}"/>
</p:commandButton>
Code: Select all
public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
//Do Nothing
}
public boolean getRendersChildren() {
return true;
}
Code: Select all
renderPassThruAttributes(facesContext, button, HTML.BUTTON_ATTRS, HTML.CLICK_EVENT);
if (button.getValue() != null) {
// workaround begin ===================
for(UIComponent kid : button.getChildren()) {
if(kid instanceof HtmlGraphicImage) {
renderChild(facesContext, kid);
}
}
// workaround end ===================
writer.write(button.getValue().toString());
} else if (button.getImage() != null) {
writer.write("ui-button");
}
writer.endElement("button");