maksimu
Members-
Content count
4 -
Joined
-
Last visited
About maksimu
-
Rank
Forum Newbie
-
Fusion Charts intergration with JSF
maksimu replied to srividya_sharma's topic in FusionCharts and JSP
OK.. I got the solution. The problem was that I had to bind value from Backing bean to that tag (lazy taking out parts of the code :hehe: ). Here is my whole code for ChartTag.java -------------------- START -------------------------------- package charts; import javax.faces.application.Application; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.el.ValueBinding; import javax.faces.webapp.UIComponentTag; public class ChartTag extends UIComponentTag { String chartId; String filename; String xml; String url; String width; String height; String debugMode; String registerWithJS; public String getChartId() { return chartId; } public void setChartId(String id) { this.chartId = id; } public String getFilename() { return filename; } public void setFilename(String filename) { this.filename = filename; } public String getXml() { return xml; } public void setXml(String xml) { this.xml = xml; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getWidth() { return width; } public void setWidth(String width) { this.width = width; } public String getHeight() { return height; } public void setHeight(String height) { this.height = height; } public String getDebugMode() { return debugMode; } public void setDebugMode(String debugMode) { this.debugMode = debugMode; } public String getRegisterWithJS() { return registerWithJS; } public void setRegisterWithJS(String registerWithJS) { this.registerWithJS = registerWithJS; } @Override public void release() { // the super class method should be called super.release(); chartId = null; filename = null; xml = null; url = null; width = null; height = null; debugMode = null; registerWithJS = null; } @Override protected void setProperties(UIComponent component) { // the super class method should be called super.setProperties(component); FacesContext context = FacesContext.getCurrentInstance(); Application application = context.getApplication(); ValueBinding binding = application.createValueBinding(xml); if (chartId != null) { component.getAttributes().put("id", chartId); } if (filename != null) { component.getAttributes().put("filename", filename); } if (xml != null) { component.setValueBinding("xml", binding); } if (url != null) { component.getAttributes().put("url", url); } if (width != null) { component.getAttributes().put("width", width); } if (height != null) { component.getAttributes().put("height", height); } if (debugMode != null) { component.getAttributes().put("debugMode", debugMode); } if (registerWithJS != null) { component.getAttributes().put("registerWithJS", registerWithJS); } } public String getComponentType() { return "chart"; } public String getRendererType() { // null means the component renders itself return null; } } ------------------------------ END ------------------------------------- -
Fusion Charts intergration with JSF
maksimu replied to srividya_sharma's topic in FusionCharts and JSP
OK.. As I see we can't add data dynamically without writing additional code to Tag library. Alright that's fine, but here is another question/problem. I have following code: ... debugMode="true" chartId="MyChart" filename="../FusionCharts/Column3D.swf" width="700" height="300" xml="#{ReportController.xmlString}"... So, my backin bean can't generate. Here is what this code generates: ... dataXML=#{ReportController.xmlString} ... Why ? -
Fusion Charts intergration with JSF
maksimu replied to srividya_sharma's topic in FusionCharts and JSP
So, can anyone show how to create dynamic data in Backin bean and send it to FusionCharts. -
Fusion Charts intergration with JSF
maksimu replied to srividya_sharma's topic in FusionCharts and JSP
Thanks for JSF example and jars. I would love to see how we can use this with data from DB and backing bean. Thanks.