Author: norman.richards(a)jboss.com
Date: 2009-04-08 15:48:18 -0400 (Wed, 08 Apr 2009)
New Revision: 10356
Added:
trunk/src/pdf/org/jboss/seam/pdf/ui/UIAnyChart.java
Modified:
trunk/src/pdf/META-INF/faces-config.xml
trunk/src/pdf/META-INF/seam-pdf.taglib.xml
trunk/src/pdf/org/jboss/seam/pdf/ui/UIChart.java
Log:
JBSEAM-3956
Modified: trunk/src/pdf/META-INF/faces-config.xml
===================================================================
--- trunk/src/pdf/META-INF/faces-config.xml 2009-04-08 17:50:00 UTC (rev 10355)
+++ trunk/src/pdf/META-INF/faces-config.xml 2009-04-08 19:48:18 UTC (rev 10356)
@@ -110,6 +110,10 @@
</component>
<component>
+ <component-type>org.jboss.seam.pdf.ui.UIAnyChart</component-type>
+ <component-class>org.jboss.seam.pdf.ui.UIAnyChart</component-class>
+ </component>
+ <component>
<component-type>org.jboss.seam.pdf.ui.UIBarChart</component-type>
<component-class>org.jboss.seam.pdf.ui.UIBarChart</component-class>
</component>
Modified: trunk/src/pdf/META-INF/seam-pdf.taglib.xml
===================================================================
--- trunk/src/pdf/META-INF/seam-pdf.taglib.xml 2009-04-08 17:50:00 UTC (rev 10355)
+++ trunk/src/pdf/META-INF/seam-pdf.taglib.xml 2009-04-08 19:48:18 UTC (rev 10356)
@@ -147,6 +147,13 @@
</tag>
<tag>
+ <tag-name>chart</tag-name>
+ <component>
+
<component-type>org.jboss.seam.pdf.ui.UIAnyChart</component-type>
+ </component>
+ </tag>
+
+ <tag>
<tag-name>piechart</tag-name>
<component>
<component-type>org.jboss.seam.pdf.ui.UIPieChart</component-type>
Added: trunk/src/pdf/org/jboss/seam/pdf/ui/UIAnyChart.java
===================================================================
--- trunk/src/pdf/org/jboss/seam/pdf/ui/UIAnyChart.java (rev 0)
+++ trunk/src/pdf/org/jboss/seam/pdf/ui/UIAnyChart.java 2009-04-08 19:48:18 UTC (rev
10356)
@@ -0,0 +1,24 @@
+package org.jboss.seam.pdf.ui;
+
+import javax.faces.context.FacesContext;
+
+import org.jfree.chart.JFreeChart;
+import org.jfree.data.general.Dataset;
+
+public class UIAnyChart
+ extends UIChart
+{
+
+ @Override
+ public JFreeChart createChart(FacesContext context)
+ {
+ throw new RuntimeException("the chart tag requires a chart");
+ }
+
+ @Override
+ public Dataset createDataset()
+ {
+ return null;
+ }
+
+}
Modified: trunk/src/pdf/org/jboss/seam/pdf/ui/UIChart.java
===================================================================
--- trunk/src/pdf/org/jboss/seam/pdf/ui/UIChart.java 2009-04-08 17:50:00 UTC (rev 10355)
+++ trunk/src/pdf/org/jboss/seam/pdf/ui/UIChart.java 2009-04-08 19:48:18 UTC (rev 10356)
@@ -67,8 +67,7 @@
}
public int getHeight() {
- return (Integer) valueBinding(FacesContext.getCurrentInstance(),
- "height", height);
+ return (Integer) valueBinding(FacesContext.getCurrentInstance(),
"height", height);
}
public void setWidth(int width) {
@@ -76,8 +75,7 @@
}
public int getWidth() {
- return (Integer) valueBinding(FacesContext.getCurrentInstance(),
- "width", width);
+ return (Integer) valueBinding(FacesContext.getCurrentInstance(),
"width", width);
}
public void setLegend(boolean legend) {
@@ -101,8 +99,7 @@
}
public String getBorderBackgroundPaint() {
- return (String) valueBinding(FacesContext.getCurrentInstance(),
- "borderBackgroundPaint", borderBackgroundPaint);
+ return (String) valueBinding(FacesContext.getCurrentInstance(),
"borderBackgroundPaint", borderBackgroundPaint);
}
public void setBorderPaint(String borderPaint) {
@@ -110,8 +107,7 @@
}
public String getBorderPaint() {
- return (String) valueBinding(FacesContext.getCurrentInstance(),
- "borderPaint", borderPaint);
+ return (String) valueBinding(FacesContext.getCurrentInstance(),
"borderPaint", borderPaint);
}
public void setBorderStroke(String borderStroke) {
@@ -119,8 +115,7 @@
}
public String getBorderStroke() {
- return (String) valueBinding(FacesContext.getCurrentInstance(),
- "borderStroke", borderStroke);
+ return (String) valueBinding(FacesContext.getCurrentInstance(),
"borderStroke", borderStroke);
}
public void setBorderVisible(boolean borderVisible) {
@@ -128,8 +123,7 @@
}
public boolean getBorderVisible() {
- return (Boolean) valueBinding(FacesContext.getCurrentInstance(),
- "borderVisible", borderVisible);
+ return (Boolean) valueBinding(FacesContext.getCurrentInstance(),
"borderVisible", borderVisible);
}
public void setPlotBackgroundAlpha(Float plotBackgroundAlpha) {
@@ -137,8 +131,7 @@
}
public Float getPlotBackgroundAlpha() {
- return (Float) valueBinding(FacesContext.getCurrentInstance(),
- "plotBackgroundAlpha", plotBackgroundAlpha);
+ return (Float) valueBinding(FacesContext.getCurrentInstance(),
"plotBackgroundAlpha", plotBackgroundAlpha);
}
public void setPlotBackgroundPaint(String plotBackgroundPaint) {
@@ -146,8 +139,7 @@
}
public String getPlotBackgroundPaint() {
- return (String) valueBinding(FacesContext.getCurrentInstance(),
- "plotBackgroundPaint", plotBackgroundPaint);
+ return (String) valueBinding(FacesContext.getCurrentInstance(),
"plotBackgroundPaint", plotBackgroundPaint);
}
public void setPlotForegroundAlpha(Float plotForegroundAlpha) {
@@ -155,8 +147,7 @@
}
public Float getPlotForegroundAlpha() {
- return (Float) valueBinding(FacesContext.getCurrentInstance(),
- "plotForegroundAlpha", plotForegroundAlpha);
+ return (Float) valueBinding(FacesContext.getCurrentInstance(),
"plotForegroundAlpha", plotForegroundAlpha);
}
public void setPlotOutlinePaint(String plotOutlinePaint) {
@@ -164,8 +155,7 @@
}
public String getPlotOutlinePaint() {
- return (String) valueBinding(FacesContext.getCurrentInstance(),
- "plotOutlinePaint", plotOutlinePaint);
+ return (String) valueBinding(FacesContext.getCurrentInstance(),
"plotOutlinePaint", plotOutlinePaint);
}
public void setPlotOutlineStroke(String plotOutlineStroke) {
@@ -173,8 +163,7 @@
}
public String getPlotOutlineStroke() {
- return (String) valueBinding(FacesContext.getCurrentInstance(),
- "plotOutlineStroke", plotOutlineStroke);
+ return (String) valueBinding(FacesContext.getCurrentInstance(),
"plotOutlineStroke", plotOutlineStroke);
}
public void setDataset(Dataset dataset) {
@@ -182,10 +171,17 @@
}
public Dataset getDataset() {
- return (Dataset) valueBinding(FacesContext.getCurrentInstance(),
- "dataset", dataset);
+ return (Dataset) valueBinding(FacesContext.getCurrentInstance(),
"dataset", dataset);
}
+
+ public void setChart(JFreeChart chart) {
+ this.chart = chart;
+ }
+ public JFreeChart getChart() {
+ return (JFreeChart) valueBinding(FacesContext.getCurrentInstance(),
"chart", chart);
+ }
+
@Override
public void restoreState(FacesContext context, Object state) {
Object[] values = (Object[]) state;
@@ -253,8 +249,7 @@
return null;
}
- UIComponent component = FacesContext.getCurrentInstance().getViewRoot()
- .findComponent(id);
+ UIComponent component =
FacesContext.getCurrentInstance().getViewRoot().findComponent(id);
if (component instanceof UIStroke) {
return ((UIStroke) component).getStroke();
@@ -266,10 +261,6 @@
public abstract JFreeChart createChart(FacesContext context);
- public JFreeChart getChart() {
- return chart;
- }
-
@Override
public void createITextObject(FacesContext context) {
@@ -357,7 +348,11 @@
if (dataset == null) {
dataset = createDataset();
}
- chart = createChart(context);
+
+ chart = getChart();
+ if (chart == null) {
+ chart = createChart(context);
+ }
}
@Override