[seam-commits] Seam SVN: r10038 - trunk/src/pdf/org/jboss/seam/pdf/ui.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Thu Feb 12 19:26:25 EST 2009
Author: norman.richards at jboss.com
Date: 2009-02-12 19:26:24 -0500 (Thu, 12 Feb 2009)
New Revision: 10038
Modified:
trunk/src/pdf/org/jboss/seam/pdf/ui/UICategoryChartBase.java
trunk/src/pdf/org/jboss/seam/pdf/ui/UIChartData.java
trunk/src/pdf/org/jboss/seam/pdf/ui/UIChartSeries.java
Log:
formatting
Modified: trunk/src/pdf/org/jboss/seam/pdf/ui/UICategoryChartBase.java
===================================================================
--- trunk/src/pdf/org/jboss/seam/pdf/ui/UICategoryChartBase.java 2009-02-11 20:58:57 UTC (rev 10037)
+++ trunk/src/pdf/org/jboss/seam/pdf/ui/UICategoryChartBase.java 2009-02-13 00:26:24 UTC (rev 10038)
@@ -6,11 +6,13 @@
import org.jfree.chart.axis.CategoryLabelPositions;
import org.jfree.chart.block.BlockBorder;
+import org.jfree.chart.labels.CategoryItemLabelGenerator;
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;
+import org.jfree.data.category.CategoryDataset;
public abstract class UICategoryChartBase extends UIChart {
private static Log log = Logging.getLog(UICategoryChartBase.class);
@@ -312,7 +314,8 @@
if (getDomainLabelPosition() != null) {
CategoryLabelPositions positions = categoryLabelPosition(getDomainLabelPosition());
- plot.getDomainAxis().setCategoryLabelPositions(positions);
+ plot.getDomainAxis().setCategoryLabelPositions(positions);
+
}
configureRenderer(plot.getRenderer());
Modified: trunk/src/pdf/org/jboss/seam/pdf/ui/UIChartData.java
===================================================================
--- trunk/src/pdf/org/jboss/seam/pdf/ui/UIChartData.java 2009-02-11 20:58:57 UTC (rev 10037)
+++ trunk/src/pdf/org/jboss/seam/pdf/ui/UIChartData.java 2009-02-13 00:26:24 UTC (rev 10038)
@@ -10,221 +10,187 @@
import org.jfree.data.general.Dataset;
import org.jfree.data.general.DefaultPieDataset;
-public class UIChartData extends ITextComponent
-{
- private String key;
- private String series;
- private Object value;
- private Float explodedPercent;
+public class UIChartData extends ITextComponent {
+ private String key;
+ private String series;
+ private Object value;
+ private Float explodedPercent;
- private String sectionPaint;
- private String sectionOutlinePaint;
- private String sectionOutlineStroke;
+ private String sectionPaint;
+ private String sectionOutlinePaint;
+ private String sectionOutlineStroke;
- public Object getValue()
- {
- return valueBinding("value", value);
- }
+ public Object getValue() {
+ return valueBinding("value", value);
+ }
- public void setValue(Object value)
- {
- this.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 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 getKey()
- {
- return (String) valueBinding("key", key);
- }
+ public String getKey() {
+ return (String) valueBinding("key", key);
+ }
- public void setKey(String key)
- {
- this.key = key;
- }
+ public void setKey(String key) {
+ this.key = key;
+ }
- public String getSeries()
- {
- String value = (String) valueBinding("series", series);
- if (value == null)
- {
- UIChartSeries series = (UIChartSeries) findITextParent(this, UIChartSeries.class);
- value = series.getKey();
- }
- return value;
- }
+ public String getSeries() {
+ String value = (String) valueBinding("series", series);
+ if (value == null) {
+ UIChartSeries series = (UIChartSeries) findITextParent(this,
+ UIChartSeries.class);
+ value = series.getKey();
+ }
+ return value;
+ }
- public void setSeries(String series)
- {
- this.series = series;
- }
+ public void setSeries(String series) {
+ this.series = series;
+ }
- public void setValue(Double value)
- {
- this.value = value;
- }
+ public void setValue(Double value) {
+ this.value = value;
+ }
- public Float getExplodedPercent()
- {
- return (Float) valueBinding("explodedPercent", explodedPercent);
- }
+ public Float getExplodedPercent() {
+ return (Float) valueBinding("explodedPercent", explodedPercent);
+ }
- public void setExplodedPercent(Float explodedPercent)
- {
- this.explodedPercent = explodedPercent;
- }
+ public void setExplodedPercent(Float explodedPercent) {
+ this.explodedPercent = explodedPercent;
+ }
- public String getSectionOutlinePaint()
- {
- return (String) valueBinding("sectionOutlinePaint", sectionOutlinePaint);
- }
+ public String getSectionOutlinePaint() {
+ return (String) valueBinding("sectionOutlinePaint", sectionOutlinePaint);
+ }
- public void setSectionOutlinePaint(String sectionOutlinePaint)
- {
- this.sectionOutlinePaint = sectionOutlinePaint;
- }
+ public void setSectionOutlinePaint(String sectionOutlinePaint) {
+ this.sectionOutlinePaint = sectionOutlinePaint;
+ }
- public String getSectionOutlineStroke()
- {
- return (String) valueBinding("sectionOutlineStroke", sectionOutlineStroke);
- }
+ public String getSectionOutlineStroke() {
+ return (String) valueBinding("sectionOutlineStroke",
+ sectionOutlineStroke);
+ }
- public void setSectionOutlineStroke(String sectionOutlineStroke)
- {
- this.sectionOutlineStroke = sectionOutlineStroke;
- }
+ public void setSectionOutlineStroke(String sectionOutlineStroke) {
+ this.sectionOutlineStroke = sectionOutlineStroke;
+ }
- public String getSectionPaint()
- {
- return (String) valueBinding("sectionPaint", sectionPaint);
- }
+ public String getSectionPaint() {
+ return (String) valueBinding("sectionPaint", sectionPaint);
+ }
- public void setSectionPaint(String sectionPaint)
- {
- this.sectionPaint = sectionPaint;
- }
+ public void setSectionPaint(String sectionPaint) {
+ this.sectionPaint = sectionPaint;
+ }
- @Override
- public void restoreState(FacesContext context, Object state)
- {
- Object[] values = (Object[]) state;
- super.restoreState(context, values[0]);
+ @Override
+ public void restoreState(FacesContext context, Object state) {
+ Object[] values = (Object[]) state;
+ super.restoreState(context, values[0]);
- key = (String) values[1];
- // columnKey = (String) values[2];
- series = (String) values[3];
- value = values[4];
- explodedPercent = (Float) values[5];
- sectionPaint = (String) values[6];
- sectionOutlinePaint = (String) values[7];
- sectionOutlineStroke = (String) values[8];
- }
+ key = (String) values[1];
+ // columnKey = (String) values[2];
+ series = (String) values[3];
+ value = values[4];
+ explodedPercent = (Float) values[5];
+ sectionPaint = (String) values[6];
+ sectionOutlinePaint = (String) values[7];
+ sectionOutlineStroke = (String) values[8];
+ }
- @Override
- public Object saveState(FacesContext context)
- {
- Object[] values = new Object[9];
+ @Override
+ public Object saveState(FacesContext context) {
+ Object[] values = new Object[9];
- values[0] = super.saveState(context);
- values[1] = key;
- // values[2] = columnKey;
- values[3] = series;
- values[4] = value;
- values[5] = explodedPercent;
- values[6] = sectionPaint;
- values[7] = sectionOutlinePaint;
- values[8] = sectionOutlineStroke;
+ values[0] = super.saveState(context);
+ values[1] = key;
+ // values[2] = columnKey;
+ values[3] = series;
+ values[4] = value;
+ values[5] = explodedPercent;
+ values[6] = sectionPaint;
+ values[7] = sectionOutlinePaint;
+ values[8] = sectionOutlineStroke;
- return values;
- }
+ return values;
+ }
- @Override
- public void encodeEnd(FacesContext context) throws IOException
- {
- super.encodeEnd(context);
+ @Override
+ public void encodeEnd(FacesContext context) throws IOException {
+ super.encodeEnd(context);
- UIChart chart = (UIChart) findITextParent(getParent(), UIChart.class);
- if (chart != null)
- {
- Dataset dataset = chart.getDataset();
+ UIChart chart = (UIChart) findITextParent(getParent(), UIChart.class);
+ if (chart != null) {
+ Dataset dataset = chart.getDataset();
- if (dataset instanceof DefaultPieDataset)
- {
- DefaultPieDataset piedata = (DefaultPieDataset) dataset;
- piedata.setValue(getKey(), getNumericValue());
+ if (dataset instanceof DefaultPieDataset) {
+ DefaultPieDataset piedata = (DefaultPieDataset) dataset;
+ piedata.setValue(getKey(), getNumericValue());
- PiePlot plot = (PiePlot) chart.getChart().getPlot();
+ PiePlot plot = (PiePlot) chart.getChart().getPlot();
- if (getExplodedPercent() != null)
- {
- plot.setExplodePercent(getKey(), getExplodedPercent());
- }
+ if (getExplodedPercent() != null) {
+ plot.setExplodePercent(getKey(), getExplodedPercent());
+ }
- if (UIChart.findColor(getSectionPaint()) != null)
- {
- plot.setSectionPaint(getKey(), UIChart.findColor(getSectionPaint()));
- }
+ if (UIChart.findColor(getSectionPaint()) != null) {
+ plot.setSectionPaint(getKey(), UIChart.findColor(getSectionPaint()));
+ }
- if (UIChart.findColor(getSectionOutlinePaint()) != null)
- {
- plot.setSectionOutlinePaint(getKey(), UIChart.findColor(getSectionOutlinePaint()));
- }
+ if (UIChart.findColor(getSectionOutlinePaint()) != null) {
+ plot.setSectionOutlinePaint(getKey(), UIChart.findColor(getSectionOutlinePaint()));
+ }
- if (UIChart.findStroke(getSectionOutlineStroke()) != null)
- {
- plot.setSectionOutlineStroke(getKey(), 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();
+ data.addValue(getNumericValue(), getSeries(), getKey());
+ } else {
+ throw new RuntimeException(
+ "Cannot add data to dataset of type "
+ + dataset.getClass());
}
- }
- else if (dataset instanceof DefaultCategoryDataset)
- {
- DefaultCategoryDataset data = (DefaultCategoryDataset) dataset;
+ }
+ }
- // CategoryPlot plot = (CategoryPlot) chart.getChart().getPlot();
- data.addValue(getNumericValue(), getSeries(), getKey());
- }
- else
- {
- throw new RuntimeException("Cannot add data to dataset of type " + dataset.getClass());
- }
- }
- }
+ @Override
+ public void createITextObject(FacesContext context) {
- @Override
- public void createITextObject(FacesContext context)
- {
+ }
- }
+ @Override
+ public Object getITextObject() {
+ return null;
+ }
- @Override
- public Object getITextObject()
- {
- return null;
- }
+ @Override
+ public void handleAdd(Object other) {
- @Override
- public void handleAdd(Object other)
- {
+ }
- }
+ @Override
+ public void removeITextObject() {
- @Override
- public void removeITextObject()
- {
-
- }
+ }
}
Modified: trunk/src/pdf/org/jboss/seam/pdf/ui/UIChartSeries.java
===================================================================
--- trunk/src/pdf/org/jboss/seam/pdf/ui/UIChartSeries.java 2009-02-11 20:58:57 UTC (rev 10037)
+++ trunk/src/pdf/org/jboss/seam/pdf/ui/UIChartSeries.java 2009-02-13 00:26:24 UTC (rev 10038)
@@ -13,215 +13,185 @@
import org.jfree.data.category.CategoryDataset;
import org.jfree.data.general.Dataset;
-public class UIChartSeries extends ITextComponent
-{
- private static Log log = Logging.getLog(UIChartSeries.class);
+public class UIChartSeries extends ITextComponent {
+ private static Log log = Logging.getLog(UIChartSeries.class);
- private String key;
- private String seriesPaint;
- private String seriesFillPaint;
- private String seriesOutlinePaint;
- private String seriesOutlineStroke;
- private String seriesStroke;
- private Boolean seriesVisible;
- private Boolean seriesVisibleInLegend;
+ private String key;
+ private String seriesPaint;
+ private String seriesFillPaint;
+ private String seriesOutlinePaint;
+ private String seriesOutlineStroke;
+ private String seriesStroke;
+ private Boolean seriesVisible;
+ private Boolean seriesVisibleInLegend;
- public String getKey()
- {
- return (String) valueBinding("key", key);
- }
+ public String getKey() {
+ return (String) valueBinding("key", key);
+ }
- public void setKey(String key)
- {
- this.key = key;
- }
+ public void setKey(String key) {
+ this.key = key;
+ }
- public String getSeriesPaint()
- {
- return (String) valueBinding("seriesPaint", seriesPaint);
- }
+ public String getSeriesPaint() {
+ return (String) valueBinding("seriesPaint", seriesPaint);
+ }
- public void setSeriesPaint(String seriesPaint)
- {
- this.seriesPaint = seriesPaint;
- }
+ public void setSeriesPaint(String seriesPaint) {
+ this.seriesPaint = seriesPaint;
+ }
- public String getSeriesFillPaint()
- {
- return (String) valueBinding("seriesFillPaint", seriesFillPaint);
- }
+ public String getSeriesFillPaint() {
+ return (String) valueBinding("seriesFillPaint", seriesFillPaint);
+ }
- public void setSeriesFillPaint(String seriesFillPaint)
- {
- this.seriesFillPaint = seriesFillPaint;
- }
+ public void setSeriesFillPaint(String seriesFillPaint) {
+ this.seriesFillPaint = seriesFillPaint;
+ }
- public String getSeriesOutlinePaint()
- {
- return (String) valueBinding("seriesOutlinePaint", seriesOutlinePaint);
- }
+ public String getSeriesOutlinePaint() {
+ return (String) valueBinding("seriesOutlinePaint", seriesOutlinePaint);
+ }
- public void setSeriesOutlinePaint(String seriesOutlinePaint)
- {
- this.seriesOutlinePaint = seriesOutlinePaint;
- }
+ public void setSeriesOutlinePaint(String seriesOutlinePaint) {
+ this.seriesOutlinePaint = seriesOutlinePaint;
+ }
- public String getSeriesOutlineStroke()
- {
- return (String) valueBinding("seriesOutlineStroke", seriesOutlineStroke);
- }
+ public String getSeriesOutlineStroke() {
+ return (String) valueBinding("seriesOutlineStroke", seriesOutlineStroke);
+ }
- public void setSeriesOutlineStroke(String seriesOutlineStroke)
- {
- this.seriesOutlineStroke = seriesOutlineStroke;
- }
+ public void setSeriesOutlineStroke(String seriesOutlineStroke) {
+ this.seriesOutlineStroke = seriesOutlineStroke;
+ }
- public String getSeriesStroke()
- {
- return (String) valueBinding("seriesStroke", seriesStroke);
- }
+ public String getSeriesStroke() {
+ return (String) valueBinding("seriesStroke", seriesStroke);
+ }
- public void setSeriesStroke(String seriesStroke)
- {
- this.seriesStroke = seriesStroke;
- }
+ public void setSeriesStroke(String seriesStroke) {
+ this.seriesStroke = seriesStroke;
+ }
- public Boolean getSeriesVisible()
- {
- return (Boolean) valueBinding("seriesVisible", seriesVisible);
- }
+ public Boolean getSeriesVisible() {
+ return (Boolean) valueBinding("seriesVisible", seriesVisible);
+ }
- public void setSeriesVisible(Boolean seriesVisible)
- {
- this.seriesVisible = seriesVisible;
- }
+ public void setSeriesVisible(Boolean seriesVisible) {
+ this.seriesVisible = seriesVisible;
+ }
- public Boolean getSeriesVisibleInLegend()
- {
- return (Boolean) valueBinding("seriesVisibleInLegend", seriesVisibleInLegend);
- }
+ public Boolean getSeriesVisibleInLegend() {
+ return (Boolean) valueBinding("seriesVisibleInLegend",
+ seriesVisibleInLegend);
+ }
- public void setSeriesVisibleInLegend(Boolean seriesVisibleInLegend)
- {
- this.seriesVisibleInLegend = seriesVisibleInLegend;
- }
+ public void setSeriesVisibleInLegend(Boolean seriesVisibleInLegend) {
+ this.seriesVisibleInLegend = seriesVisibleInLegend;
+ }
- @Override
- public void restoreState(FacesContext context, Object state)
- {
- Object[] values = (Object[]) state;
- super.restoreState(context, values[0]);
+ @Override
+ public void restoreState(FacesContext context, Object state) {
+ Object[] values = (Object[]) state;
+ super.restoreState(context, values[0]);
- key = (String) values[1];
- seriesPaint = (String) values[2];
- seriesFillPaint = (String) values[3];
- seriesOutlinePaint = (String) values[4];
- seriesOutlineStroke = (String) values[5];
- seriesStroke = (String) values[6];
- seriesVisible = (Boolean) values[7];
- seriesVisibleInLegend = (Boolean) values[8];
- }
+ key = (String) values[1];
+ seriesPaint = (String) values[2];
+ seriesFillPaint = (String) values[3];
+ seriesOutlinePaint = (String) values[4];
+ seriesOutlineStroke = (String) values[5];
+ seriesStroke = (String) values[6];
+ seriesVisible = (Boolean) values[7];
+ seriesVisibleInLegend = (Boolean) values[8];
+ }
- @Override
- public Object saveState(FacesContext context)
- {
- Object[] values = new Object[9];
+ @Override
+ public Object saveState(FacesContext context) {
+ Object[] values = new Object[9];
- values[0] = super.saveState(context);
- values[1] = key;
- values[2] = seriesPaint;
- values[3] = seriesFillPaint;
- values[4] = seriesOutlinePaint;
- values[5] = seriesOutlineStroke;
- values[6] = seriesStroke;
- values[7] = seriesVisible;
- values[8] = seriesVisibleInLegend;
+ values[0] = super.saveState(context);
+ values[1] = key;
+ values[2] = seriesPaint;
+ values[3] = seriesFillPaint;
+ values[4] = seriesOutlinePaint;
+ values[5] = seriesOutlineStroke;
+ values[6] = seriesStroke;
+ values[7] = seriesVisible;
+ values[8] = seriesVisibleInLegend;
- return values;
- }
+ return values;
+ }
- @Override
- public void encodeEnd(FacesContext context) throws IOException
- {
- UIChart chart = (UIChart) findITextParent(getParent(), UIChart.class);
+ @Override
+ public void encodeEnd(FacesContext context) throws IOException {
+ UIChart chart = (UIChart) findITextParent(getParent(), UIChart.class);
- if (chart != null) {
- Dataset dataset = chart.getDataset();
- Plot p = chart.getChart().getPlot();
+ if (chart != null) {
+ Dataset dataset = chart.getDataset();
+ Plot p = chart.getChart().getPlot();
- if (p instanceof CategoryPlot) {
- CategoryPlot plot = (CategoryPlot) p;
-
- int seriesIndex = ((CategoryDataset) dataset).getRowIndex(getKey());
-
- CategoryItemRenderer renderer = plot.getRenderer();
-
- // CategoryRenderer
- if (renderer instanceof AbstractRenderer) {
- configureSeries((AbstractRenderer) renderer, seriesIndex);
- } else {
- log.error("render is not AbtractRenderer" + renderer);
- }
- }
- }
- }
+ if (p instanceof CategoryPlot) {
+ CategoryPlot plot = (CategoryPlot) p;
- private void configureSeries(AbstractRenderer renderer, int seriesIndex)
- {
- if (getSeriesPaint() != null)
- {
- renderer.setSeriesPaint(seriesIndex, UIChart.findColor(getSeriesPaint()));
- }
+ int seriesIndex = ((CategoryDataset) dataset).getRowIndex(getKey());
+ CategoryItemRenderer renderer = plot.getRenderer();
- if (getSeriesFillPaint() != null)
- {
- renderer.setSeriesFillPaint(seriesIndex, UIChart.findColor(getSeriesFillPaint()));
- }
+ // CategoryRenderer
+ if (renderer instanceof AbstractRenderer) {
+ configureSeries((AbstractRenderer) renderer, seriesIndex);
+ } else {
+ log.error("render is not AbtractRenderer" + renderer);
+ }
+ }
+ }
+ }
- if (getSeriesOutlinePaint() != null)
- {
- renderer.setSeriesOutlinePaint(seriesIndex, UIChart.findColor(getSeriesOutlinePaint()));
- }
+ private void configureSeries(AbstractRenderer renderer, int seriesIndex) {
+ if (getSeriesPaint() != null) {
+ renderer.setSeriesPaint(seriesIndex, UIChart.findColor(getSeriesPaint()));
+ }
- if (getSeriesOutlineStroke() != null)
- {
- renderer.setSeriesOutlineStroke(seriesIndex, UIChart.findStroke(getSeriesOutlineStroke()));
- }
+ if (getSeriesFillPaint() != null) {
+ renderer.setSeriesFillPaint(seriesIndex, UIChart.findColor(getSeriesFillPaint()));
+ }
- if (getSeriesStroke() != null)
- {
- renderer.setSeriesStroke(seriesIndex, UIChart.findStroke(getSeriesStroke()));
- }
+ if (getSeriesOutlinePaint() != null) {
+ renderer.setSeriesOutlinePaint(seriesIndex, UIChart.findColor(getSeriesOutlinePaint()));
+ }
- if (getSeriesVisible() != null)
- {
- renderer.setSeriesVisible(seriesIndex, getSeriesVisible());
- }
+ if (getSeriesOutlineStroke() != null) {
+ renderer.setSeriesOutlineStroke(seriesIndex, UIChart.findStroke(getSeriesOutlineStroke()));
+ }
- if (getSeriesVisibleInLegend() != null)
- {
- renderer.setSeriesVisibleInLegend(seriesIndex, getSeriesVisibleInLegend());
- }
- }
+ if (getSeriesStroke() != null) {
+ renderer.setSeriesStroke(seriesIndex, UIChart.findStroke(getSeriesStroke()));
+ }
- @Override
- public void createITextObject(FacesContext context)
- {
- }
+ if (getSeriesVisible() != null) {
+ renderer.setSeriesVisible(seriesIndex, getSeriesVisible());
+ }
- @Override
- public Object getITextObject()
- {
- return null;
- }
+ if (getSeriesVisibleInLegend() != null) {
+ renderer.setSeriesVisibleInLegend(seriesIndex, getSeriesVisibleInLegend());
+ }
+
+ renderer.setSeriesItemLabelsVisible(seriesIndex, true);
+ }
- @Override
- public void removeITextObject()
- {
- }
+ @Override
+ public void createITextObject(FacesContext context) {
+ }
- @Override
- public void handleAdd(Object other)
- {
- }
+ @Override
+ public Object getITextObject() {
+ return null;
+ }
+
+ @Override
+ public void removeITextObject() {
+ }
+
+ @Override
+ public void handleAdd(Object other) {
+ }
}
More information about the seam-commits
mailing list