public void encodeBegin(FacesContext context, UIComponent component)
throws IOException {
if(UIFacebookClient.isClientEnabled((UIViewRootEx)context.getViewRoot())) {
ResponseWriter writer = context.getResponseWriter();
UIComments dialog = (UIComments)component;
writer.startElement("fb:comments", component);
writer.writeAttribute("id", component.getClientId(context), null);
if (dialog.getNumPosts() == null) {
writer.writeAttribute("num_posts", "", null);
}
else {
writer.writeAttribute("num_posts", dialog.getNumPosts(), null);
}
if (dialog.getWidth() == null) {
writer.writeAttribute("width", "500", null);
}
else {
writer.writeAttribute("width", dialog.getWidth(), null);
}
if (dialog.getColorscheme() == null) {
writer.writeAttribute("num_posts", "false", null);
}
else {
writer.writeAttribute("num_posts", dialog.getColorscheme(), null);
}
if (dialog.getHref() == null) {
writer.writeAttribute("href", "", null);
}
else {
writer.writeAttribute("href", dialog.getHref(), null);
}
writer.endElement("fb:comments");
}
}