}
public void encodeDimensions(FacesContext context, UIComponent component,
InternetResource resource) throws IOException {
if (resource instanceof Java2Dresource) {
Java2Dresource j2d = (Java2Dresource) resource;
Dimension dim = j2d.getDimensions(context, component);
ResponseWriter writer = context.getResponseWriter();
writer.writeAttribute("width", String.valueOf(dim.width), "width");
writer.writeAttribute("height", String.valueOf(dim.height),
"height");
}