@Override public void encodeEnd(FacesContext context) throws IOException { // call create here so that we'll have a valid chart createITextObject(context); if (imageData != null) { ResponseWriter response = context.getResponseWriter(); response.startElement("img", null); GraphicImageStore store = GraphicImageStore.instance(); String key = store.put(new ImageWrapper(imageData, Type.IMAGE_JPEG)); String url = context.getExternalContext().getRequestContextPath() + GraphicImageResource.GRAPHIC_IMAGE_RESOURCE_PATH + "/" + key + Type.IMAGE_JPEG.getExtension(); response.writeAttribute("src", url, null); response.writeAttribute("height", getHeight(), null); response.writeAttribute("width", getWidth(), null); response.endElement("img"); } super.encodeEnd(context); }
@Override public void restoreState(FacesContext context, Object state) { Object[] values = (Object[]) state; super.restoreState(context, values[0]); height = (Integer) values[1]; width = (Integer) values[2]; borderBackgroundPaint = (String) values[3]; borderPaint = (String) values[4]; borderStroke = (String) values[5]; borderVisible = (Boolean) values[6]; plotBackgroundPaint = (String) values[7]; plotBackgroundAlpha = (Float) values[8]; plotForegroundAlpha = (Float) values[9]; plotOutlineStroke = (String) values[10]; plotOutlinePaint = (String) values[11]; title = (String) values[12]; is3D = (Boolean) values[13]; legend = (Boolean) values[14]; }