[jboss-cvs] jboss-seam/src/pdf/org/jboss/seam/pdf/ui ...
Norman Richards
norman.richards at jboss.com
Wed Jul 4 11:25:19 EDT 2007
User: nrichards
Date: 07/07/04 11:25:17
Modified: src/pdf/org/jboss/seam/pdf/ui UIBarChart.java
UICategoryChartBase.java UIChartData.java
UIChartSeries.java UILineChart.java
Log:
more fixes
Revision Changes Path
1.13 +21 -158 jboss-seam/src/pdf/org/jboss/seam/pdf/ui/UIBarChart.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: UIBarChart.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/pdf/org/jboss/seam/pdf/ui/UIBarChart.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- UIBarChart.java 2 Jul 2007 05:09:50 -0000 1.12
+++ UIBarChart.java 4 Jul 2007 15:25:17 -0000 1.13
@@ -6,8 +6,6 @@
import org.jfree.chart.JFreeChart;
import org.jfree.chart.renderer.category.BarRenderer;
import org.jfree.chart.renderer.category.CategoryItemRenderer;
-import org.jfree.chart.title.LegendTitle;
-import org.jfree.chart.title.TextTitle;
import org.jfree.data.category.CategoryDataset;
import org.jfree.data.category.DefaultCategoryDataset;
import org.jfree.data.general.Dataset;
@@ -17,132 +15,19 @@
{
private CategoryDataset dataset;
- private String title;
- private String categoryAxisLabel;
- private String valueAxisLabel;
-
- private String orientation;
-
- private boolean legend;
- private boolean is3D = false;
-
- private String titleBackgroundPaint;
- private String titlePaint;
-
- private String legendBackgroundPaint;
-
- private String legendItemPaint;
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public String getTitle() {
- return (String) valueBinding("title", title);
- }
-
- public void setOrientation(String orientation) {
- this.orientation = orientation;
- }
-
- public String getOrientation() {
- return (String) valueBinding("orientation", orientation);
- }
-
- public void setCategoryAxisLabel(String categoryAxisLabel) {
- this.categoryAxisLabel = categoryAxisLabel;
- }
-
- public String getCategoryAxisLabel() {
- return (String) valueBinding("categoryAxisLabel", categoryAxisLabel);
- }
-
- public void setValueAxisLabel(String valueAxisLabel) {
- this.valueAxisLabel = valueAxisLabel;
- }
-
- public String getValueAxisLabel() {
- return (String) valueBinding("valueAxisLabel", valueAxisLabel);
- }
-
- public void setLegend(boolean legend) {
- this.legend = legend;
- }
-
- public boolean getLegend() {
- return (Boolean) valueBinding("legend", legend);
- }
-
- public void setIs3D(boolean is3D) {
- this.is3D = true;
- }
-
- public boolean getIs3D() {
- return (Boolean) valueBinding("is3D", is3D);
- }
-
- public void setTitleBackgroundPaint(String titleBackgroundPaint) {
- this.titleBackgroundPaint = titleBackgroundPaint;
- }
-
- public String getTitleBackgroundPaint() {
- return (String) valueBinding("titleBackgroundPaint", titleBackgroundPaint);
- }
-
- public void setTitlePaint(String titlePaint) {
- this.titlePaint = titlePaint;
- }
-
- public String getTitlePaint() {
- return (String) valueBinding("titlePaint", titlePaint);
- }
-
- public String getLegendBackgroundPaint() {
- return legendBackgroundPaint;
- }
-
- public void setLegendBackgroundPaint(String legendBackgroundPaint) {
- this.legendBackgroundPaint = legendBackgroundPaint;
- }
-
- public String getLegendItemPaint() {
- return legendItemPaint;
- }
-
- public void setLegendItemPaint(String legendItemPaint) {
- this.legendItemPaint = legendItemPaint;
- }
-
@Override
public void restoreState(FacesContext context, Object state)
{
Object[] values = (Object[]) state;
super.restoreState(context, values[0]);
-
- title = (String) values[1];
- categoryAxisLabel = (String) values[2];
- valueAxisLabel = (String) values[3];
- orientation = (String) values[4];
- legend = (Boolean) values[5];
- is3D = (Boolean) values[6];
- titlePaint = (String) values[7];
- titleBackgroundPaint = (String) values[8];
}
@Override
public Object saveState(FacesContext context)
{
- Object[] values = new Object[9];
+ Object[] values = new Object[1];
values[0] = super.saveState(context);
- values[1] = title;
- values[2] = categoryAxisLabel;
- values[3] = valueAxisLabel;
- values[4] = orientation;
- values[5] = legend;
- values[6] = is3D;
- values[7] = titlePaint;
- values[8] = titleBackgroundPaint;
return values;
}
@@ -178,8 +63,8 @@
if (!getIs3D()) {
chart = ChartFactory.createBarChart(getTitle(),
- getCategoryAxisLabel(),
- getValueAxisLabel(),
+ getDomainAxisLabel(),
+ getRangeAxisLabel(),
dataset,
plotOrientation(getOrientation()),
getLegend(),
@@ -187,8 +72,8 @@
false);
} else {
chart = ChartFactory.createBarChart3D(getTitle(),
- getCategoryAxisLabel(),
- getValueAxisLabel(),
+ getDomainAxisLabel(),
+ getRangeAxisLabel(),
dataset,
plotOrientation(getOrientation()),
getLegend(),
@@ -196,25 +81,8 @@
false);
}
-
- TextTitle chartTitle = chart.getTitle();
-
- if (findColor(getTitleBackgroundPaint()) != null) {
- chartTitle.setBackgroundPaint(findColor(getTitleBackgroundPaint()));
- }
-
- if (findColor(getTitlePaint()) != null) {
- chartTitle.setPaint(findColor(getTitlePaint()));
- }
- // t.setFont(titleFont);
-
- LegendTitle chartLegend = chart.getLegend();
- if (findColor(getLegendBackgroundPaint())!=null) {
- chartLegend.setBackgroundPaint(findColor(getLegendBackgroundPaint()));
- }
- if (findColor(getLegendItemPaint())!= null) {
- chartLegend.setItemPaint(findColor(getLegendItemPaint()));
- }
+ configureTitle(chart.getTitle());
+ configureLegend(chart.getLegend());
return chart;
}
@@ -223,9 +91,4 @@
public Dataset getDataset() {
return dataset;
}
-
-
-
-
-
}
1.4 +196 -33 jboss-seam/src/pdf/org/jboss/seam/pdf/ui/UICategoryChartBase.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: UICategoryChartBase.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/pdf/org/jboss/seam/pdf/ui/UICategoryChartBase.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- UICategoryChartBase.java 28 Jun 2007 20:30:08 -0000 1.3
+++ UICategoryChartBase.java 4 Jul 2007 15:25:17 -0000 1.4
@@ -5,17 +5,117 @@
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.plot.Plot;
import org.jfree.chart.renderer.category.CategoryItemRenderer;
+import org.jfree.chart.title.LegendTitle;
+import org.jfree.chart.title.TextTitle;
public abstract class UICategoryChartBase
extends UIChart
{
+ private String orientation;
+
+ private boolean legend;
+ private boolean is3D = false;
+
+ private String title;
+ private String titleBackgroundPaint;
+ private String titlePaint;
+
+ private String legendBackgroundPaint;
+ private String legendItemPaint;
+
+ private String domainAxisLabel;
+ private String domainAxisPaint;
private Boolean domainGridlinesVisible;
private String domainGridlinePaint;
private String domainGridlineStroke;
+
+ private String rangeAxisLabel;
+ private String rangeAxisPaint;
private Boolean rangeGridlinesVisible;
private String rangeGridlinePaint;
private String rangeGridlineStroke;
+ public String getDomainAxisLabel() {
+ return (String) valueBinding("domainAxisLabel", domainAxisLabel);
+ }
+
+ public void setDomainAxisLabel(String categoryAxisLabel) {
+ this.domainAxisLabel = categoryAxisLabel;
+ }
+
+ public String getRangeAxisLabel() {
+ return (String) valueBinding("rangeAxisLabel", rangeAxisLabel);
+ }
+
+ public void setRangeAxisLabel(String valueAxisLabel) {
+ this.rangeAxisLabel = valueAxisLabel;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public String getTitle() {
+ return (String) valueBinding("title", title);
+ }
+
+ public void setOrientation(String orientation) {
+ this.orientation = orientation;
+ }
+
+ public String getOrientation() {
+ return (String) valueBinding("orientation", orientation);
+ }
+
+
+ public void setLegend(boolean legend) {
+ this.legend = legend;
+ }
+
+ public boolean getLegend() {
+ return (Boolean) valueBinding("legend", legend);
+ }
+
+ public void setIs3D(boolean is3D) {
+ this.is3D = true;
+ }
+
+ public boolean getIs3D() {
+ return (Boolean) valueBinding("is3D", is3D);
+ }
+
+ public void setTitleBackgroundPaint(String titleBackgroundPaint) {
+ this.titleBackgroundPaint = titleBackgroundPaint;
+ }
+
+ public String getTitleBackgroundPaint() {
+ return (String) valueBinding("titleBackgroundPaint", titleBackgroundPaint);
+ }
+
+ public void setTitlePaint(String titlePaint) {
+ this.titlePaint = titlePaint;
+ }
+
+ public String getTitlePaint() {
+ return (String) valueBinding("titlePaint", titlePaint);
+ }
+
+ public String getLegendBackgroundPaint() {
+ return (String) valueBinding("legendBackgroundPaint", legendBackgroundPaint);
+ }
+
+ public void setLegendBackgroundPaint(String legendBackgroundPaint) {
+ this.legendBackgroundPaint = legendBackgroundPaint;
+ }
+
+ public String getLegendItemPaint() {
+ return (String) valueBinding("legendItemPaint", legendItemPaint);
+ }
+
+ public void setLegendItemPaint(String legendItemPaint) {
+ this.legendItemPaint = legendItemPaint;
+ }
+
public String getDomainGridlinePaint() {
return (String) valueBinding("domainGridlinePaint", domainGridlinePaint);
}
@@ -64,6 +164,21 @@
this.rangeGridlinesVisible = rangeGridlinesVisible;
}
+ public String getDomainAxisPaint() {
+ return (String) valueBinding("domainAxisPaint", domainAxisPaint);
+ }
+
+ public void setDomainAxisPaint(String domainAxisPaint) {
+ this.domainAxisPaint = domainAxisPaint;
+ }
+
+ public String getRangeAxisPaint() {
+ return (String) valueBinding("rangeAxisPaint", rangeAxisPaint);
+ }
+
+ public void setRangeAxisPaint(String rangeAxisPaint) {
+ this.rangeAxisPaint = rangeAxisPaint;
+ }
@Override
public void restoreState(FacesContext context, Object state)
@@ -71,25 +186,50 @@
Object[] values = (Object[]) state;
super.restoreState(context, values[0]);
- domainGridlinesVisible = (Boolean) values[1];
- domainGridlinePaint = (String) values[2];
- domainGridlineStroke = (String) values[3];
- rangeGridlinesVisible = (Boolean) values[4];
- rangeGridlinePaint = (String) values[5];
- rangeGridlineStroke = (String) values[6];
+
+ orientation = (String) values[1];
+ legend = (Boolean) values[2];
+ is3D = (Boolean) values[3];
+ title = (String) values[4];
+ titleBackgroundPaint = (String) values[5];
+ titlePaint = (String) values[6];
+ legendBackgroundPaint = (String) values[7];
+ legendItemPaint = (String) values[8];
+ domainAxisLabel = (String) values[9];
+ domainAxisPaint = (String) values[10];
+ domainGridlinesVisible = (Boolean) values[11];
+ domainGridlinePaint = (String) values[12];
+ domainGridlineStroke = (String) values[13];
+ rangeAxisLabel = (String) values[14];
+ rangeAxisPaint = (String) values[15];
+ rangeGridlinesVisible = (Boolean) values[16];
+ rangeGridlinePaint = (String) values[17];
+ rangeGridlineStroke = (String) values[18];
}
@Override
public Object saveState(FacesContext context)
{
- Object[] values = new Object[7];
+ Object[] values = new Object[19];
values[0] = super.saveState(context);
- values[1] = domainGridlinesVisible;
- values[2] = domainGridlinePaint;
- values[3] = domainGridlineStroke;
- values[4] = rangeGridlinesVisible;
- values[5] = rangeGridlinePaint;
- values[6] = rangeGridlineStroke;
+ values[1] = orientation;
+ values[2] = legend;
+ values[3] = is3D;
+ values[4] = title;
+ values[5] = titleBackgroundPaint;
+ values[6] = titlePaint;
+ values[7] = legendBackgroundPaint;
+ values[8] = legendItemPaint;
+ values[9] = domainAxisLabel;
+ values[10] = domainAxisPaint;
+ values[11] = domainGridlinesVisible;
+ values[12] = domainGridlinePaint;
+ values[13] = domainGridlineStroke;
+ values[14] = rangeAxisLabel;
+ values[15] = rangeAxisPaint;
+ values[16] = rangeGridlinesVisible;
+ values[17] = rangeGridlinePaint;
+ values[18] = rangeGridlineStroke;
return values;
}
@@ -109,28 +249,32 @@
//plot.setDomainAxisLocation(arg0);
//plot.setRangeAxisLocation(arg0);
- if (domainGridlinesVisible != null) {
- plot.setDomainGridlinesVisible(domainGridlinesVisible);
+ if (getDomainGridlinesVisible() != null) {
+ plot.setDomainGridlinesVisible(getDomainGridlinesVisible());
+ }
+
+ if (findColor(getDomainGridlinePaint()) != null) {
+ plot.setDomainGridlinePaint(findColor(getDomainGridlinePaint()));
}
- //plot.setDomainGridlinePosition(CategoryAnchor)
- if (domainGridlinePaint != null) {
- plot.setDomainGridlinePaint(findColor(domainGridlinePaint));
+ if (findStroke(getDomainGridlineStroke()) != null) {
+ plot.setDomainGridlineStroke(findStroke(getDomainGridlineStroke()));
}
- if (domainGridlineStroke != null) {
- plot.setDomainGridlineStroke(findStroke(domainGridlineStroke));
+ if (findColor(getDomainAxisPaint()) != null) {
+ plot.getDomainAxis().setLabelPaint(findColor(getDomainAxisPaint()));
}
- if (rangeGridlinesVisible != null) {
- plot.setRangeGridlinesVisible(rangeGridlinesVisible);
+ if (getRangeGridlinesVisible() != null) {
+ plot.setRangeGridlinesVisible(getRangeGridlinesVisible());
}
- //plot.setRangeGridlinePosition(CategoryAnchor)
- if (rangeGridlinePaint!=null) {
- plot.setRangeGridlinePaint(findColor(rangeGridlinePaint));
+ if (findColor(getRangeGridlinePaint())!=null) {
+ plot.setRangeGridlinePaint(findColor(getRangeGridlinePaint()));
}
- if (rangeGridlineStroke!=null) {
- plot.setRangeGridlineStroke(findStroke(rangeGridlineStroke));
+ if (findStroke(getRangeGridlineStroke())!=null) {
+ plot.setRangeGridlineStroke(findStroke(getRangeGridlineStroke()));
+ }
+ if (findColor(getRangeAxisPaint()) != null) {
+ plot.getRangeAxis().setLabelPaint(findColor(getRangeAxisPaint()));
}
-
configureRenderer(plot.getRenderer());
}
@@ -165,4 +309,23 @@
//new float[] {10,3}, 0));
}
+ public void configureTitle(TextTitle chartTitle) {
+ if (findColor(getTitleBackgroundPaint()) != null) {
+ chartTitle.setBackgroundPaint(findColor(getTitleBackgroundPaint()));
+ }
+
+ if (findColor(getTitlePaint()) != null) {
+ chartTitle.setPaint(findColor(getTitlePaint()));
+ }
+ }
+
+ void configureLegend(LegendTitle chartLegend) {
+ if (findColor(getLegendBackgroundPaint())!=null) {
+ chartLegend.setBackgroundPaint(findColor(getLegendBackgroundPaint()));
+ }
+ if (findColor(getLegendItemPaint())!= null) {
+ chartLegend.setItemPaint(findColor(getLegendItemPaint()));
+ }
+ }
+
}
1.7 +56 -21 jboss-seam/src/pdf/org/jboss/seam/pdf/ui/UIChartData.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: UIChartData.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/pdf/org/jboss/seam/pdf/ui/UIChartData.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- UIChartData.java 28 Jun 2007 20:30:08 -0000 1.6
+++ UIChartData.java 4 Jul 2007 15:25:17 -0000 1.7
@@ -1,6 +1,7 @@
package org.jboss.seam.pdf.ui;
import java.io.IOException;
+import java.math.BigDecimal;
import javax.faces.context.FacesContext;
@@ -15,17 +16,61 @@
private String key;
private String columnKey;
private String rowKey;
- private Number value;
+ private Object value;
private Float explodedPercent;
private String sectionPaint;
private String sectionOutlinePaint;
private String sectionOutlineStroke;
+ public Object getValue() {
+ return (Object) valueBinding("value", value);
+ }
+
+ public void setValue(Object value) {
+ this.value = value;
+ }
+
+ public Number getNumericValue() {
+ Object val = getValue();
+ if (val instanceof Number) {
+ return (Number) getValue();
+ } else if (val instanceof String) {
+ return new BigDecimal((String)val);
+ } else {
+ throw new RuntimeException("Can't convert " + val.getClass().getName() + " to numeric value");
+ }
+ }
+
+ public String getColumnKey() {
+ return (String) valueBinding("columnKey", columnKey);
+ }
+
+
+
+ public String getKey() {
+ return (String) valueBinding("key", key);
+ }
+
+
+
+ public String getRowKey() {
+ String value = (String) valueBinding("rowkey", rowKey);
+ if (value == null) {
+ UIChartSeries series = (UIChartSeries) findITextParent(this, UIChartSeries.class);
+ value = series.getKey();
+ }
+ return value;
+ }
+
+
+
public void setKey(String key) {
this.key = key;
}
+
+
public void setRowKey(String rowKey) {
this.rowKey = rowKey;
}
@@ -113,46 +158,36 @@
{
super.encodeEnd(context);
- key = (String) valueBinding("key", key);
- rowKey = (String) valueBinding("rowkey", rowKey);
- columnKey = (String) valueBinding("columnKey", columnKey);
- value = (Number) valueBinding("value", value);
-
UIChart chart = (UIChart) findITextParent(getParent(), UIChart.class);
if (chart != null) {
Dataset dataset = chart.getDataset();
if (dataset instanceof DefaultPieDataset) {
DefaultPieDataset piedata = (DefaultPieDataset) dataset;
- piedata.setValue(key, value);
+ piedata.setValue(getKey(), getNumericValue());
PiePlot plot = (PiePlot) chart.getChart().getPlot();
- if (explodedPercent != null) {
- plot.setExplodePercent(key, getExplodedPercent());
+ if (getExplodedPercent() != null) {
+ plot.setExplodePercent(getKey(), getExplodedPercent());
}
- if (sectionPaint != null) {
- plot.setSectionPaint(key, UIChart.findColor(getSectionPaint()));
+ if (UIChart.findColor(getSectionPaint()) != null) {
+ plot.setSectionPaint(getKey(), UIChart.findColor(getSectionPaint()));
}
- if (sectionOutlinePaint != null) {
- plot.setSectionOutlinePaint(key, UIChart.findColor(getSectionOutlinePaint()));
+ if (UIChart.findColor(getSectionOutlinePaint()) != null) {
+ plot.setSectionOutlinePaint(getKey(), UIChart.findColor(getSectionOutlinePaint()));
}
- if (sectionOutlineStroke != null) {
- plot.setSectionOutlineStroke(key, UIChart.findStroke(getSectionOutlineStroke()));
+ if (UIChart.findStroke(getSectionOutlineStroke()) != null) {
+ plot.setSectionOutlineStroke(getKey(), UIChart.findStroke(getSectionOutlineStroke()));
}
} else if (dataset instanceof DefaultCategoryDataset) {
DefaultCategoryDataset data = (DefaultCategoryDataset) dataset;
//CategoryPlot plot = (CategoryPlot) chart.getChart().getPlot();
-
- if (rowKey == null) {
- UIChartSeries series = (UIChartSeries) findITextParent(this, UIChartSeries.class);
- rowKey = series.getKey();
- }
- data.addValue(value, rowKey, columnKey);
+ data.addValue(getNumericValue(), getRowKey(), getColumnKey());
} else {
throw new RuntimeException("Cannot add data to dataset of type " + dataset.getClass());
}
1.5 +8 -16 jboss-seam/src/pdf/org/jboss/seam/pdf/ui/UIChartSeries.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: UIChartSeries.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/pdf/org/jboss/seam/pdf/ui/UIChartSeries.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- UIChartSeries.java 28 Jun 2007 20:30:08 -0000 1.4
+++ UIChartSeries.java 4 Jul 2007 15:25:17 -0000 1.5
@@ -132,7 +132,7 @@
if (p instanceof CategoryPlot) {
CategoryPlot plot = (CategoryPlot) p;
- int seriesIndex = ((CategoryDataset) dataset).getRowIndex(key);
+ int seriesIndex = ((CategoryDataset) dataset).getRowIndex(getKey());
CategoryItemRenderer renderer = plot.getRenderer();
@@ -149,36 +149,35 @@
private void configureSeries(AbstractRenderer renderer, int seriesIndex) {
- if (seriesPaint != null) {
+ if (getSeriesPaint() != null) {
renderer.setSeriesPaint(seriesIndex, UIChart.findColor(getSeriesPaint()));
}
- if (seriesFillPaint != null) {
+ if (getSeriesFillPaint() != null) {
renderer.setSeriesFillPaint(seriesIndex, UIChart.findColor(getSeriesFillPaint()));
}
- if (seriesOutlinePaint != null) {
+ if (getSeriesOutlinePaint() != null) {
renderer.setSeriesOutlinePaint(seriesIndex, UIChart.findColor(getSeriesOutlinePaint()));
}
- if (seriesOutlineStroke != null) {
+ if (getSeriesOutlineStroke() != null) {
renderer.setSeriesOutlineStroke(seriesIndex, UIChart.findStroke(getSeriesOutlineStroke()));
}
- if (seriesStroke != null) {
+ if (getSeriesStroke() != null) {
renderer.setSeriesStroke(seriesIndex, UIChart.findStroke(getSeriesStroke()));
}
- if (seriesVisible != null) {
+ if (getSeriesVisible() != null) {
renderer.setSeriesVisible(seriesIndex, seriesVisible);
}
- if (seriesVisibleInLegend != null) {
+ if (getSeriesVisibleInLegend() != null) {
renderer.setSeriesVisibleInLegend(seriesIndex, getSeriesVisibleInLegend());
}
}
-
@Override
public void createITextObject(FacesContext context) {
}
@@ -195,11 +194,4 @@
@Override
public void handleAdd(Object other) {
}
-
-
-
-
-
-
-
}
1.8 +12 -78 jboss-seam/src/pdf/org/jboss/seam/pdf/ui/UILineChart.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: UILineChart.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/pdf/org/jboss/seam/pdf/ui/UILineChart.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- UILineChart.java 28 Jun 2007 20:30:08 -0000 1.7
+++ UILineChart.java 4 Jul 2007 15:25:17 -0000 1.8
@@ -14,90 +14,18 @@
{
CategoryDataset dataset;
- String title;
- String domainAxisLabel;
- String rangeAxisLabel;
- String orientation;
-
- boolean legend;
- boolean is3D = false;
-
- public String getTitle() {
- return (String) valueBinding("title", title);
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public String getOrientation() {
- return (String) valueBinding("orientation", orientation);
- }
-
- public void setOrientation(String orientation) {
- this.orientation = orientation;
- }
-
- public String getDomainAxisLabel() {
- return (String) valueBinding("domainAxisLabel", domainAxisLabel);
- }
-
- public void setDomainAxisLabel(String domainAxisLabel) {
- this.domainAxisLabel = domainAxisLabel;
- }
-
-
- public String getRangeAxisLabel() {
- return (String) valueBinding("rangeAxisLabel", rangeAxisLabel);
- }
-
- public void setRangeAxisLabel(String rangeAxisLabel) {
- this.rangeAxisLabel = rangeAxisLabel;
- }
-
- public boolean getLegend() {
- return (Boolean) valueBinding("legend", legend);
- }
-
- public void setLegend(boolean legend) {
- this.legend = legend;
- }
-
- public boolean getIs3D() {
- return (Boolean) valueBinding("is3D", is3D);
- }
-
- public void setIs3D(boolean is3D) {
- this.is3D = is3D;
- }
@Override
public void restoreState(FacesContext context, Object state)
{
Object[] values = (Object[]) state;
super.restoreState(context, values[0]);
-
- title = (String) values[1];
- domainAxisLabel = (String) values[2];
- rangeAxisLabel = (String) values[3];
- orientation = (String) values[4];
- legend = (Boolean) values[5];
- is3D = (Boolean) values[6];
}
@Override
public Object saveState(FacesContext context)
{
Object[] values = new Object[6];
-
- values[0] = super.saveState(context);
- values[1] = title;
- values[2] = domainAxisLabel;
- values[3] = rangeAxisLabel;
- values[4] = orientation;
- values[5] = legend;
- values[6] = is3D;
-
return values;
}
@@ -108,8 +36,10 @@
@Override
public JFreeChart createChart(FacesContext context) {
- if (!is3D) {
- return ChartFactory.createLineChart(title,
+ JFreeChart chart;
+
+ if (!getIs3D()) {
+ chart = ChartFactory.createLineChart(getTitle(),
getDomainAxisLabel(),
getRangeAxisLabel(),
dataset,
@@ -118,7 +48,7 @@
false,
false);
} else {
- return ChartFactory.createLineChart3D(title,
+ chart = ChartFactory.createLineChart3D(getTitle(),
getDomainAxisLabel(),
getRangeAxisLabel(),
dataset,
@@ -127,6 +57,11 @@
false,
false);
}
+
+ configureTitle(chart.getTitle());
+ configureLegend(chart.getLegend());
+
+ return chart;
}
// @Override
@@ -138,7 +73,6 @@
@Override
public void configureRenderer(CategoryItemRenderer renderer){
super.configureRenderer(renderer);
- //System.out.println("UILINECHART RENDERER IS " + renderer);
}
@Override
More information about the jboss-cvs-commits
mailing list