[seam-commits] Seam SVN: r10051 - in trunk/src/pdf: org/jboss/seam/pdf/ui and 1 other directory.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Mon Feb 16 18:47:23 EST 2009


Author: norman.richards at jboss.com
Date: 2009-02-16 18:47:23 -0500 (Mon, 16 Feb 2009)
New Revision: 10051

Added:
   trunk/src/pdf/org/jboss/seam/pdf/ui/UITimeSeriesChart.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/UIBarChart.java
   trunk/src/pdf/org/jboss/seam/pdf/ui/UICategoryChartBase.java
   trunk/src/pdf/org/jboss/seam/pdf/ui/UIChart.java
   trunk/src/pdf/org/jboss/seam/pdf/ui/UIChartData.java
   trunk/src/pdf/org/jboss/seam/pdf/ui/UIChartSeries.java
   trunk/src/pdf/org/jboss/seam/pdf/ui/UILineChart.java
   trunk/src/pdf/org/jboss/seam/pdf/ui/UIPieChart.java
Log:
JBSEAM-3750

Modified: trunk/src/pdf/META-INF/faces-config.xml
===================================================================
--- trunk/src/pdf/META-INF/faces-config.xml	2009-02-16 21:44:26 UTC (rev 10050)
+++ trunk/src/pdf/META-INF/faces-config.xml	2009-02-16 23:47:23 UTC (rev 10051)
@@ -120,6 +120,11 @@
     </component>
 
     <component>
+        <component-type>org.jboss.seam.pdf.ui.UITimeSeriesChart</component-type>
+        <component-class>org.jboss.seam.pdf.ui.UITimeSeriesChart</component-class>
+    </component>
+
+    <component>
         <component-type>org.jboss.seam.pdf.ui.UIChartData</component-type>
         <component-class>org.jboss.seam.pdf.ui.UIChartData</component-class>
     </component>

Modified: trunk/src/pdf/META-INF/seam-pdf.taglib.xml
===================================================================
--- trunk/src/pdf/META-INF/seam-pdf.taglib.xml	2009-02-16 21:44:26 UTC (rev 10050)
+++ trunk/src/pdf/META-INF/seam-pdf.taglib.xml	2009-02-16 23:47:23 UTC (rev 10051)
@@ -168,6 +168,13 @@
     </tag>
 
     <tag>
+        <tag-name>timeserieschart</tag-name>
+        <component>
+            <component-type>org.jboss.seam.pdf.ui.UITimeSeriesChart</component-type>
+        </component>
+    </tag>
+
+    <tag>
         <tag-name>data</tag-name>
         <component>
             <component-type>org.jboss.seam.pdf.ui.UIChartData</component-type>

Modified: trunk/src/pdf/org/jboss/seam/pdf/ui/UIBarChart.java
===================================================================
--- trunk/src/pdf/org/jboss/seam/pdf/ui/UIBarChart.java	2009-02-16 21:44:26 UTC (rev 10050)
+++ trunk/src/pdf/org/jboss/seam/pdf/ui/UIBarChart.java	2009-02-16 23:47:23 UTC (rev 10051)
@@ -12,8 +12,6 @@
 
 public class UIBarChart extends UICategoryChartBase
 {
-   private CategoryDataset dataset;
-
    @Override
    public void restoreState(FacesContext context, Object state)
    {
@@ -31,9 +29,9 @@
    }
 
    @Override
-   public void createDataset()
+   public Dataset createDataset()
    {
-      dataset = new DefaultCategoryDataset();
+      return new DefaultCategoryDataset();
    }
 
    // @Override
@@ -62,11 +60,11 @@
 
       if (!getIs3D())
       {
-         chart = ChartFactory.createBarChart(getTitle(), getDomainAxisLabel(), getRangeAxisLabel(), dataset, plotOrientation(getOrientation()), getLegend(), false, false);
+         chart = ChartFactory.createBarChart(getTitle(), getDomainAxisLabel(), getRangeAxisLabel(), (CategoryDataset) dataset, plotOrientation(getOrientation()), getLegend(), false, false);
       }
       else
       {
-         chart = ChartFactory.createBarChart3D(getTitle(), getDomainAxisLabel(), getRangeAxisLabel(), dataset, plotOrientation(getOrientation()), getLegend(), false, false);
+         chart = ChartFactory.createBarChart3D(getTitle(), getDomainAxisLabel(), getRangeAxisLabel(), (CategoryDataset) dataset, plotOrientation(getOrientation()), getLegend(), false, false);
       }
 
       configureTitle(chart.getTitle());
@@ -74,10 +72,4 @@
 
       return chart;
    }
-
-   @Override
-   public Dataset getDataset()
-   {
-      return dataset;
-   }
 }

Modified: trunk/src/pdf/org/jboss/seam/pdf/ui/UICategoryChartBase.java
===================================================================
--- trunk/src/pdf/org/jboss/seam/pdf/ui/UICategoryChartBase.java	2009-02-16 21:44:26 UTC (rev 10050)
+++ trunk/src/pdf/org/jboss/seam/pdf/ui/UICategoryChartBase.java	2009-02-16 23:47:23 UTC (rev 10051)
@@ -6,23 +6,17 @@
 
 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);
 
     private String orientation;
 
-    private boolean legend;
-    private boolean is3D = false;
-
-    private String title;
     private String titleBackgroundPaint;
     private String titlePaint;
 
@@ -67,14 +61,6 @@
         this.domainLabelPosition = domainLabelPosition;
     }
 
-    public void setTitle(String title) {
-        this.title = title;
-    }
-
-    public String getTitle() {
-        return (String) valueBinding("title", title);
-    }
-
     public void setOrientation(String orientation) {
         this.orientation = orientation;
     }
@@ -83,22 +69,6 @@
         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;
     }
@@ -215,9 +185,8 @@
         super.restoreState(context, values[0]);
 
         orientation = (String) values[1];
-        legend = (Boolean) values[2];
-        is3D = (Boolean) values[3];
-        title = (String) values[4];
+        //legend = (Boolean) values[2];
+        //is3D = (Boolean) values[3];
         titleBackgroundPaint = (String) values[5];
         titlePaint = (String) values[6];
         legendBackgroundPaint = (String) values[7];
@@ -241,9 +210,9 @@
         Object[] values = new Object[21];
         values[0] = super.saveState(context);
         values[1] = orientation;
-        values[2] = legend;
-        values[3] = is3D;
-        values[4] = title;
+        //values[2] = legend;
+        //values[3] = is3D;
+        //values[4] = title;
         values[5] = titleBackgroundPaint;
         values[6] = titlePaint;
         values[7] = legendBackgroundPaint;
@@ -374,8 +343,7 @@
     public void configureTitle(TextTitle chartTitle) {
         if (chartTitle != null) {
             if (findColor(getTitleBackgroundPaint()) != null) {
-                chartTitle
-                        .setBackgroundPaint(findColor(getTitleBackgroundPaint()));
+                chartTitle.setBackgroundPaint(findColor(getTitleBackgroundPaint()));
             }
 
             if (findColor(getTitlePaint()) != null) {
@@ -391,7 +359,7 @@
             }
 
             if (findColor(getLegendOutlinePaint()) != null) {
-                chartLegend.setBorder(new BlockBorder(findColor(getLegendOutlinePaint())));
+                chartLegend.setFrame(new BlockBorder(findColor(getLegendOutlinePaint())));
             }
 
             if (findColor(getLegendItemPaint()) != null) {

Modified: trunk/src/pdf/org/jboss/seam/pdf/ui/UIChart.java
===================================================================
--- trunk/src/pdf/org/jboss/seam/pdf/ui/UIChart.java	2009-02-16 21:44:26 UTC (rev 10050)
+++ trunk/src/pdf/org/jboss/seam/pdf/ui/UIChart.java	2009-02-16 23:47:23 UTC (rev 10051)
@@ -32,11 +32,16 @@
 {
    private Image image = null;
    private JFreeChart chart = null;
+   
    private byte[] imageData;
 
    private int height = 300;
    private int width = 400;
 
+   private boolean legend;
+   private boolean is3D = false;
+   
+   private String title;
    private String borderBackgroundPaint;
    private String borderPaint;
    private String borderStroke;
@@ -48,6 +53,18 @@
    private String plotOutlineStroke;
    private String plotOutlinePaint;
 
+   protected Dataset dataset;
+   
+   
+
+   public void setTitle(String title) {
+       this.title = title;
+   }
+
+   public String getTitle() {
+       return (String) valueBinding("title", title);
+   }
+
    public void setHeight(int height)
    {
       this.height = height;
@@ -67,7 +84,24 @@
    {
       return (Integer) valueBinding(FacesContext.getCurrentInstance(), "width", width);
    }
+   
+   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 setBorderBackgroundPaint(String backgroundPaint)
    {
       this.borderBackgroundPaint = backgroundPaint;
@@ -158,6 +192,14 @@
       return (String) valueBinding(FacesContext.getCurrentInstance(), "plotOutlineStroke", plotOutlineStroke);
    }
 
+   public void setDataset(Dataset dataset) {
+        this.dataset = dataset;
+   }
+
+   public Dataset getDataset() {
+       return (Dataset) valueBinding(FacesContext.getCurrentInstance(), "dataset", dataset);
+   }
+   
    @Override
    public void restoreState(FacesContext context, Object state)
    {
@@ -175,12 +217,15 @@
       plotForegroundAlpha = (Float) values[9];
       plotOutlineStroke = (String) values[10];
       plotOutlinePaint = (String) values[11];
+      title = (String) values[12];
+      is3D = (Boolean) values[13];
+      legend = (Boolean) values[14];
    }
 
    @Override
    public Object saveState(FacesContext context)
    {
-      Object[] values = new Object[12];
+      Object[] values = new Object[15];
 
       values[0] = super.saveState(context);
       values[1] = height;
@@ -194,7 +239,10 @@
       values[9] = plotForegroundAlpha;
       values[10] = plotOutlineStroke;
       values[11] = plotOutlinePaint;
-
+      values[12] = title;
+      values[13] = is3D;
+      values[14] = legend;
+      
       return values;
    }
 
@@ -345,8 +393,11 @@
    @Override
    public void encodeBegin(FacesContext context) throws IOException
    {
+      dataset = getDataset();
       // bypass super to avoid createITextObject() before the chart is ready
-      createDataset();
+      if (dataset == null) {
+          dataset = createDataset();
+      }
       chart = createChart(context);
    }
 
@@ -394,7 +445,5 @@
       chart = null;
    }
 
-   public abstract void createDataset();
-
-   public abstract Dataset getDataset();
+   public abstract Dataset createDataset();
 }

Modified: trunk/src/pdf/org/jboss/seam/pdf/ui/UIChartData.java
===================================================================
--- trunk/src/pdf/org/jboss/seam/pdf/ui/UIChartData.java	2009-02-16 21:44:26 UTC (rev 10050)
+++ trunk/src/pdf/org/jboss/seam/pdf/ui/UIChartData.java	2009-02-16 23:47:23 UTC (rev 10051)
@@ -166,6 +166,9 @@
                 // CategoryPlot plot = (CategoryPlot)
                 // chart.getChart().getPlot();
                 data.addValue(getNumericValue(), getSeries(), getKey());
+//            } else if (dataset instanceof DefaultXYDataset) {
+//              DefaultXYDataset data =   (DefaultXYDataset) dataset;
+
             } else {
                 throw new RuntimeException(
                         "Cannot add data to dataset of type "

Modified: trunk/src/pdf/org/jboss/seam/pdf/ui/UIChartSeries.java
===================================================================
--- trunk/src/pdf/org/jboss/seam/pdf/ui/UIChartSeries.java	2009-02-16 21:44:26 UTC (rev 10050)
+++ trunk/src/pdf/org/jboss/seam/pdf/ui/UIChartSeries.java	2009-02-16 23:47:23 UTC (rev 10051)
@@ -142,7 +142,11 @@
                 } else {
                     log.error("render is not AbtractRenderer" + renderer);
                 }
+                
             }
+//             else if (p instanceof XYPlot) {
+//                /// ??? 
+//            }
         }
     }
 

Modified: trunk/src/pdf/org/jboss/seam/pdf/ui/UILineChart.java
===================================================================
--- trunk/src/pdf/org/jboss/seam/pdf/ui/UILineChart.java	2009-02-16 21:44:26 UTC (rev 10050)
+++ trunk/src/pdf/org/jboss/seam/pdf/ui/UILineChart.java	2009-02-16 23:47:23 UTC (rev 10051)
@@ -11,8 +11,6 @@
 
 public class UILineChart extends UICategoryChartBase
 {
-   CategoryDataset dataset;
-
    @Override
    public void restoreState(FacesContext context, Object state)
    {
@@ -31,9 +29,9 @@
    }
 
    @Override
-   public void createDataset()
+   public Dataset createDataset()
    {
-      dataset = new DefaultCategoryDataset();
+      return new DefaultCategoryDataset();
    }
 
    @Override
@@ -43,11 +41,11 @@
 
       if (!getIs3D())
       {
-         chart = ChartFactory.createLineChart(getTitle(), getDomainAxisLabel(), getRangeAxisLabel(), dataset, plotOrientation(getOrientation()), getLegend(), false, false);
+         chart = ChartFactory.createLineChart(getTitle(), getDomainAxisLabel(), getRangeAxisLabel(), (CategoryDataset) dataset, plotOrientation(getOrientation()), getLegend(), false, false);
       }
       else
       {
-         chart = ChartFactory.createLineChart3D(getTitle(), getDomainAxisLabel(), getRangeAxisLabel(), dataset, plotOrientation(getOrientation()), getLegend(), false, false);
+         chart = ChartFactory.createLineChart3D(getTitle(), getDomainAxisLabel(), getRangeAxisLabel(), (CategoryDataset) dataset, plotOrientation(getOrientation()), getLegend(), false, false);
       }
 
       configureTitle(chart.getTitle());
@@ -67,10 +65,5 @@
       super.configureRenderer(renderer);
    }
 
-   @Override
-   public Dataset getDataset()
-   {
-      return dataset;
-   }
 
 }

Modified: trunk/src/pdf/org/jboss/seam/pdf/ui/UIPieChart.java
===================================================================
--- trunk/src/pdf/org/jboss/seam/pdf/ui/UIPieChart.java	2009-02-16 21:44:26 UTC (rev 10050)
+++ trunk/src/pdf/org/jboss/seam/pdf/ui/UIPieChart.java	2009-02-16 23:47:23 UTC (rev 10051)
@@ -9,464 +9,358 @@
 import org.jfree.chart.plot.Plot;
 import org.jfree.data.general.Dataset;
 import org.jfree.data.general.DefaultPieDataset;
+import org.jfree.data.general.PieDataset;
 import org.jfree.util.Rotation;
 
-public class UIPieChart extends UIChart
+public class UIPieChart 
+    extends UIChart 
 {
-   private DefaultPieDataset data;
+    private String label;
 
-   private String title;
-   private String label;
-   private boolean legend = true;
-   private boolean is3D = false;
+    private Double labelLinkMargin;
+    private String labelLinkPaint;
+    private String labelLinkStroke;
+    private Boolean labelLinksVisible;
+    private String labelOutlinePaint;
+    private String labelOutlineStroke;
+    private String labelShadowPaint;
+    private String labelPaint;
+    private Double labelGap;
+    private String labelBackgroundPaint;
+    private Double startAngle;
+    private Boolean circular;
+    private String direction;
+    private String sectionOutlinePaint;
+    private String sectionOutlineStroke;
+    private Boolean sectionOutlinesVisible;
+    private String baseSectionOutlinePaint;
+    private String baseSectionPaint;
+    private String baseSectionOutlineStroke;
 
-   private Double labelLinkMargin;
-   private String labelLinkPaint;
-   private String labelLinkStroke;
-   private Boolean labelLinksVisible;
-   private String labelOutlinePaint;
-   private String labelOutlineStroke;
-   private String labelShadowPaint;
-   private String labelPaint;
-   private Double labelGap;
-   private String labelBackgroundPaint;
-   private Double startAngle;
-   private Boolean circular;
-   private String direction;
-   private String sectionOutlinePaint;
-   private String sectionOutlineStroke;
-   private Boolean sectionOutlinesVisible;
-   private String baseSectionOutlinePaint;
-   private String baseSectionPaint;
-   private String baseSectionOutlineStroke;
+    public void setLabel(String label) {
+        this.label = label;
+    }
 
-   public void setTitle(String title)
-   {
-      this.title = title;
-   }
+    public String getLabel() {
+        return (String) valueBinding("label", label);
+    }
 
-   public String getTitle()
-   {
-      return (String) valueBinding("title", title);
-   }
 
-   public void setLabel(String label)
-   {
-      this.label = label;
-   }
+    public String getBaseSectionOutlinePaint() {
+        return (String) valueBinding("baseSectionOutlinePaint",
+                baseSectionOutlinePaint);
+    }
 
-   public String getLabel()
-   {
-      return (String) valueBinding("label", label);
-   }
+    public void setBaseSectionOutlinePaint(String baseSectionOutlinePaint) {
+        this.baseSectionOutlinePaint = baseSectionOutlinePaint;
+    }
 
-   public void setLegend(boolean legend)
-   {
-      this.legend = legend;
-   }
+    public String getBaseSectionOutlineStroke() {
+        return (String) valueBinding("baseSectionOutlineStroke",
+                baseSectionOutlineStroke);
+    }
 
-   public boolean getLegend()
-   {
-      return (Boolean) valueBinding("legend", legend);
-   }
+    public void setBaseSectionOutlineStroke(String baseSectionOutlineStroke) {
+        this.baseSectionOutlineStroke = baseSectionOutlineStroke;
+    }
 
-   public void setIs3D(boolean is3D)
-   {
-      this.is3D = true;
-   }
+    public String getBaseSectionPaint() {
+        return (String) valueBinding("baseSectionPaint", baseSectionPaint);
+    }
 
-   public boolean getIs3D()
-   {
-      return (Boolean) valueBinding("is3D", is3D);
-   }
+    public void setBaseSectionPaint(String baseSectionPaint) {
+        this.baseSectionPaint = baseSectionPaint;
+    }
 
-   public String getBaseSectionOutlinePaint()
-   {
-      return (String) valueBinding("baseSectionOutlinePaint", baseSectionOutlinePaint);
-   }
+    public Boolean getCircular() {
+        return (Boolean) valueBinding("isCircular", circular);
+    }
 
-   public void setBaseSectionOutlinePaint(String baseSectionOutlinePaint)
-   {
-      this.baseSectionOutlinePaint = baseSectionOutlinePaint;
-   }
+    public void setCircular(Boolean circular) {
+        this.circular = circular;
+    }
 
-   public String getBaseSectionOutlineStroke()
-   {
-      return (String) valueBinding("baseSectionOutlineStroke", baseSectionOutlineStroke);
-   }
+    public String getLabelBackgroundPaint() {
+        return (String) valueBinding("labelBackgroundPaint",
+                labelBackgroundPaint);
+    }
 
-   public void setBaseSectionOutlineStroke(String baseSectionOutlineStroke)
-   {
-      this.baseSectionOutlineStroke = baseSectionOutlineStroke;
-   }
+    public void setLabelBackgroundPaint(String labelBackgroundPaint) {
+        this.labelBackgroundPaint = labelBackgroundPaint;
+    }
 
-   public String getBaseSectionPaint()
-   {
-      return (String) valueBinding("baseSectionPaint", baseSectionPaint);
-   }
+    public Double getLabelGap() {
+        return (Double) valueBinding("labelGap", labelGap);
+    }
 
-   public void setBaseSectionPaint(String baseSectionPaint)
-   {
-      this.baseSectionPaint = baseSectionPaint;
-   }
+    public void setLabelGap(Double labelGap) {
+        this.labelGap = labelGap;
+    }
 
-   public Boolean getCircular()
-   {
-      return (Boolean) valueBinding("isCircular", circular);
-   }
+    public Double getLabelLinkMargin() {
+        return (Double) valueBinding("labelLinkMargin", labelLinkMargin);
+    }
 
-   public void setCircular(Boolean circular)
-   {
-      this.circular = circular;
-   }
+    public void setLabelLinkMargin(double labelLinkMargin) {
+        this.labelLinkMargin = labelLinkMargin;
+    }
 
-   public String getLabelBackgroundPaint()
-   {
-      return (String) valueBinding("labelBackgroundPaint", labelBackgroundPaint);
-   }
+    public String getLabelLinkPaint() {
+        return (String) valueBinding("labelLinkPaint", labelLinkPaint);
+    }
 
-   public void setLabelBackgroundPaint(String labelBackgroundPaint)
-   {
-      this.labelBackgroundPaint = labelBackgroundPaint;
-   }
+    public void setLabelLinkPaint(String labelLinkPaint) {
+        this.labelLinkPaint = labelLinkPaint;
+    }
 
-   public Double getLabelGap()
-   {
-      return (Double) valueBinding("labelGap", labelGap);
-   }
+    public String getLabelLinkStroke() {
+        return (String) valueBinding("labelLinkStroke", labelLinkStroke);
+    }
 
-   public void setLabelGap(Double labelGap)
-   {
-      this.labelGap = labelGap;
-   }
+    public void setLabelLinkStroke(String labelLinkStroke) {
+        this.labelLinkStroke = labelLinkStroke;
+    }
 
-   public Double getLabelLinkMargin()
-   {
-      return (Double) valueBinding("labelLinkMargin", labelLinkMargin);
-   }
+    public Boolean isLabelLinksVisible() {
+        return (Boolean) valueBinding("labelLinksVisible", labelLinksVisible);
+    }
 
-   public void setLabelLinkMargin(double labelLinkMargin)
-   {
-      this.labelLinkMargin = labelLinkMargin;
-   }
+    public void setLabelLinksVisible(Boolean labelLinksVisible) {
+        this.labelLinksVisible = labelLinksVisible;
+    }
 
-   public String getLabelLinkPaint()
-   {
-      return (String) valueBinding("labelLinkPaint", labelLinkPaint);
-   }
+    public String getLabelOutlinePaint() {
+        return (String) valueBinding("labelOutlinePaint", labelOutlinePaint);
+    }
 
-   public void setLabelLinkPaint(String labelLinkPaint)
-   {
-      this.labelLinkPaint = labelLinkPaint;
-   }
+    public void setLabelOutlinePaint(String labelOutlinePaint) {
+        this.labelOutlinePaint = labelOutlinePaint;
+    }
 
-   public String getLabelLinkStroke()
-   {
-      return (String) valueBinding("labelLinkStroke", labelLinkStroke);
-   }
+    public String getLabelOutlineStroke() {
+        return (String) valueBinding("labelOutlineStroke", labelOutlineStroke);
+    }
 
-   public void setLabelLinkStroke(String labelLinkStroke)
-   {
-      this.labelLinkStroke = labelLinkStroke;
-   }
+    public void setLabelOutlineStroke(String labelOutlineStroke) {
+        this.labelOutlineStroke = labelOutlineStroke;
+    }
 
-   public Boolean isLabelLinksVisible()
-   {
-      return (Boolean) valueBinding("labelLinksVisible", labelLinksVisible);
-   }
+    public String getLabelPaint() {
+        return (String) valueBinding("labelPaint", labelPaint);
+    }
 
-   public void setLabelLinksVisible(Boolean labelLinksVisible)
-   {
-      this.labelLinksVisible = labelLinksVisible;
-   }
+    public void setLabelPaint(String labelPaint) {
+        this.labelPaint = labelPaint;
+    }
 
-   public String getLabelOutlinePaint()
-   {
-      return (String) valueBinding("labelOutlinePaint", labelOutlinePaint);
-   }
+    public String getLabelShadowPaint() {
+        return (String) valueBinding("labelShadowPaint", labelShadowPaint);
+    }
 
-   public void setLabelOutlinePaint(String labelOutlinePaint)
-   {
-      this.labelOutlinePaint = labelOutlinePaint;
-   }
+    public void setLabelShadowPaint(String labelShadowPaint) {
+        this.labelShadowPaint = labelShadowPaint;
+    }
 
-   public String getLabelOutlineStroke()
-   {
-      return (String) valueBinding("labelOutlineStroke", labelOutlineStroke);
-   }
+    public String getDirection() {
+        return (String) valueBinding("rotation", direction);
+    }
 
-   public void setLabelOutlineStroke(String labelOutlineStroke)
-   {
-      this.labelOutlineStroke = labelOutlineStroke;
-   }
+    public void setDirection(String rotation) {
+        this.direction = rotation;
+    }
 
-   public String getLabelPaint()
-   {
-      return (String) valueBinding("labelPaint", labelPaint);
-   }
+    public String getSectionOutlinePaint() {
+        return (String) valueBinding("sectionOutlinePaint", sectionOutlinePaint);
+    }
 
-   public void setLabelPaint(String labelPaint)
-   {
-      this.labelPaint = labelPaint;
-   }
+    public void setSectionOutlinePaint(String sectionOutlinePaint) {
+        this.sectionOutlinePaint = sectionOutlinePaint;
+    }
 
-   public String getLabelShadowPaint()
-   {
-      return (String) valueBinding("labelShadowPaint", labelShadowPaint);
-   }
+    public String getSectionOutlineStroke() {
+        return (String) valueBinding("sectionOutlineStroke",
+                sectionOutlineStroke);
+    }
 
-   public void setLabelShadowPaint(String labelShadowPaint)
-   {
-      this.labelShadowPaint = labelShadowPaint;
-   }
+    public void setSectionOutlineStroke(String sectionOutlineStroke) {
+        this.sectionOutlineStroke = sectionOutlineStroke;
+    }
 
-   public String getDirection()
-   {
-      return (String) valueBinding("rotation", direction);
-   }
+    public Boolean isSectionOutlinesVisible() {
+        return (Boolean) valueBinding("sectionOutlineVisible",
+                sectionOutlinesVisible);
+    }
 
-   public void setDirection(String rotation)
-   {
-      this.direction = rotation;
-   }
+    public void setSectionOutlinesVisible(Boolean sectionOutlinesVisible) {
+        this.sectionOutlinesVisible = sectionOutlinesVisible;
+    }
 
-   public String getSectionOutlinePaint()
-   {
-      return (String) valueBinding("sectionOutlinePaint", sectionOutlinePaint);
-   }
+    public Double getStartAngle() {
+        return (Double) valueBinding("startAngle", startAngle);
+    }
 
-   public void setSectionOutlinePaint(String sectionOutlinePaint)
-   {
-      this.sectionOutlinePaint = sectionOutlinePaint;
-   }
+    public void setStartAngle(Double startAngle) {
+        this.startAngle = startAngle;
+    }
 
-   public String getSectionOutlineStroke()
-   {
-      return (String) valueBinding("sectionOutlineStroke", sectionOutlineStroke);
-   }
+    @Override
+    public void restoreState(FacesContext context, Object state) {
+        Object[] values = (Object[]) state;
+        super.restoreState(context, values[0]);
 
-   public void setSectionOutlineStroke(String sectionOutlineStroke)
-   {
-      this.sectionOutlineStroke = sectionOutlineStroke;
-   }
+        // title = (String) values[1];
+        label = (String) values[2];
+        //legend = (Boolean) values[3];
+        //is3D = (Boolean) values[4];
+        labelLinkMargin = (Double) values[5];
+        labelLinkPaint = (String) values[6];
+        labelLinkStroke = (String) values[7];
+        labelLinksVisible = (Boolean) values[8];
+        labelOutlinePaint = (String) values[9];
+        labelOutlineStroke = (String) values[10];
+        labelShadowPaint = (String) values[11];
+        labelPaint = (String) values[12];
+        labelGap = (Double) values[13];
+        labelBackgroundPaint = (String) values[14];
+        startAngle = (Double) values[15];
+        circular = (Boolean) values[16];
+        direction = (String) values[17];
+        sectionOutlinePaint = (String) values[18];
+        sectionOutlineStroke = (String) values[19];
+        sectionOutlinesVisible = (Boolean) values[20];
+        baseSectionOutlinePaint = (String) values[21];
+        baseSectionPaint = (String) values[22];
+        baseSectionOutlineStroke = (String) values[23];
+    }
 
-   public Boolean isSectionOutlinesVisible()
-   {
-      return (Boolean) valueBinding("sectionOutlineVisible", sectionOutlinesVisible);
-   }
+    @Override
+    public Object saveState(FacesContext context) {
+        Object[] values = new Object[24];
 
-   public void setSectionOutlinesVisible(Boolean sectionOutlinesVisible)
-   {
-      this.sectionOutlinesVisible = sectionOutlinesVisible;
-   }
+        values[0] = super.saveState(context);
+        // values[1] = title;
+        values[2] = label;
+        //values[3] = legend;
+        //values[4] = is3D;
+        values[5] = labelLinkMargin;
+        values[6] = labelLinkPaint;
+        values[7] = labelLinkStroke;
+        values[8] = labelLinksVisible;
+        values[9] = labelOutlinePaint;
+        values[10] = labelOutlineStroke;
+        values[11] = labelShadowPaint;
+        values[12] = labelPaint;
+        values[13] = labelGap;
+        values[14] = labelBackgroundPaint;
+        values[15] = startAngle;
+        values[16] = circular;
+        values[17] = direction;
+        values[18] = sectionOutlinePaint;
+        values[19] = sectionOutlineStroke;
+        values[20] = sectionOutlinesVisible;
+        values[21] = baseSectionOutlinePaint;
+        values[22] = baseSectionPaint;
+        values[23] = baseSectionOutlineStroke;
 
-   public Double getStartAngle()
-   {
-      return (Double) valueBinding("startAngle", startAngle);
-   }
+        return values;
+    }
 
-   public void setStartAngle(Double startAngle)
-   {
-      this.startAngle = startAngle;
-   }
+    @Override
+    public Dataset createDataset() {
+        return new DefaultPieDataset();
+    }
 
-   @Override
-   public void restoreState(FacesContext context, Object state)
-   {
-      Object[] values = (Object[]) state;
-      super.restoreState(context, values[0]);
+    public Rotation rotationValue(String value) {
+        if (value == null || value.equalsIgnoreCase("anticlockwise")) {
+            return Rotation.ANTICLOCKWISE;
+        } else {
+            return Rotation.CLOCKWISE;
+        }
+    }
 
-      title = (String) values[1];
-      label = (String) values[2];
-      legend = (Boolean) values[3];
-      is3D = (Boolean) values[4];
-      labelLinkMargin = (Double) values[5];
-      labelLinkPaint = (String) values[6];
-      labelLinkStroke = (String) values[7];
-      labelLinksVisible = (Boolean) values[8];
-      labelOutlinePaint = (String) values[9];
-      labelOutlineStroke = (String) values[10];
-      labelShadowPaint = (String) values[11];
-      labelPaint = (String) values[12];
-      labelGap = (Double) values[13];
-      labelBackgroundPaint = (String) values[14];
-      startAngle = (Double) values[15];
-      circular = (Boolean) values[16];
-      direction = (String) values[17];
-      sectionOutlinePaint = (String) values[18];
-      sectionOutlineStroke = (String) values[19];
-      sectionOutlinesVisible = (Boolean) values[20];
-      baseSectionOutlinePaint = (String) values[21];
-      baseSectionPaint = (String) values[22];
-      baseSectionOutlineStroke = (String) values[23];
-   }
+    @Override
+    public void configurePlot(Plot plot) {
+        super.configurePlot(plot);
 
-   @Override
-   public Object saveState(FacesContext context)
-   {
-      Object[] values = new Object[24];
+        if (plot instanceof PiePlot) {
+            PiePlot pieplot = (PiePlot) plot;
+            if (label != null) {
+                pieplot.setLabelGenerator(new StandardPieSectionLabelGenerator(label));
+            }
 
-      values[0] = super.saveState(context);
-      values[1] = title;
-      values[2] = label;
-      values[3] = legend;
-      values[4] = is3D;
-      values[5] = labelLinkMargin;
-      values[6] = labelLinkPaint;
-      values[7] = labelLinkStroke;
-      values[8] = labelLinksVisible;
-      values[9] = labelOutlinePaint;
-      values[10] = labelOutlineStroke;
-      values[11] = labelShadowPaint;
-      values[12] = labelPaint;
-      values[13] = labelGap;
-      values[14] = labelBackgroundPaint;
-      values[15] = startAngle;
-      values[16] = circular;
-      values[17] = direction;
-      values[18] = sectionOutlinePaint;
-      values[19] = sectionOutlineStroke;
-      values[20] = sectionOutlinesVisible;
-      values[21] = baseSectionOutlinePaint;
-      values[22] = baseSectionPaint;
-      values[23] = baseSectionOutlineStroke;
+            if (baseSectionOutlinePaint != null) {
+                pieplot.setBaseSectionOutlinePaint(findColor(baseSectionOutlinePaint));
+            }
+            if (baseSectionOutlineStroke != null) {
+                pieplot.setBaseSectionOutlineStroke(findStroke(baseSectionOutlineStroke));
+            }
+            if (baseSectionPaint != null) {
+                pieplot.setBaseSectionPaint(findColor(baseSectionPaint));
+            }
 
-      return values;
-   }
+            if (circular != null) {
+                pieplot.setCircular(circular);
+            }
+            if (startAngle != null) {
+                pieplot.setStartAngle(startAngle);
+            }
+            if (direction != null) {
+                pieplot.setDirection(rotationValue(direction));
+            }
 
-   @Override
-   public void createDataset()
-   {
-      data = new DefaultPieDataset();
-   }
+            if (sectionOutlinePaint != null) {
+                pieplot
+                        .setBaseSectionOutlinePaint(findColor(sectionOutlinePaint));
+            }
+            if (sectionOutlineStroke != null) {
+                pieplot
+                        .setBaseSectionOutlineStroke(findStroke(sectionOutlineStroke));
+            }
+            if (sectionOutlinesVisible != null) {
+                pieplot.setSectionOutlinesVisible(sectionOutlinesVisible);
+            }
 
-   @Override
-   public Dataset getDataset()
-   {
-      return data;
-   }
+            // pieplot.setLabelFont(arg0);
+            if (labelBackgroundPaint != null) {
+                pieplot.setLabelBackgroundPaint(findColor(labelBackgroundPaint));
+            }
+            if (labelGap != null) {
+                pieplot.setLabelGap(labelGap);
+            }
+            if (labelLinkMargin != null) {
+                pieplot.setLabelLinkMargin(labelLinkMargin);
+            }
+            if (labelLinkPaint != null) {
+                pieplot.setLabelLinkPaint(findColor(labelLinkPaint));
+            }
+            if (labelLinkStroke != null) {
+                pieplot.setLabelLinkStroke(findStroke(labelLinkStroke));
+            }
+            if (labelLinksVisible != null) {
+                pieplot.setLabelLinksVisible(labelLinksVisible);
+            }
+            if (labelOutlinePaint != null) {
+                pieplot.setLabelOutlinePaint(findColor(labelOutlinePaint));
+            }
+            if (labelOutlineStroke != null) {
+                pieplot.setLabelOutlineStroke(findStroke(labelOutlineStroke));
+            }
+            if (labelPaint != null) {
+                pieplot.setLabelPaint(findColor(labelPaint));
+            }
+            if (labelShadowPaint != null) {
+                pieplot.setLabelShadowPaint(findColor(labelShadowPaint));
+            }
+        }
+    }
 
-   public Rotation rotationValue(String value)
-   {
-      if (value == null || value.equalsIgnoreCase("anticlockwise"))
-      {
-         return Rotation.ANTICLOCKWISE;
-      }
-      else
-      {
-         return Rotation.CLOCKWISE;
-      }
-   }
+    @Override
+    public JFreeChart createChart(FacesContext context) {
 
-   @Override
-   public void configurePlot(Plot plot)
-   {
-      super.configurePlot(plot);
-
-      if (plot instanceof PiePlot)
-      {
-         PiePlot pieplot = (PiePlot) plot;
-         if (label != null)
-         {
-            pieplot.setLabelGenerator(new StandardPieSectionLabelGenerator(label));
-         }
-
-         if (baseSectionOutlinePaint != null)
-         {
-            pieplot.setBaseSectionOutlinePaint(findColor(baseSectionOutlinePaint));
-         }
-         if (baseSectionOutlineStroke != null)
-         {
-            pieplot.setBaseSectionOutlineStroke(findStroke(baseSectionOutlineStroke));
-         }
-         if (baseSectionPaint != null)
-         {
-            pieplot.setBaseSectionPaint(findColor(baseSectionPaint));
-         }
-
-         if (circular != null)
-         {
-            pieplot.setCircular(circular);
-         }
-         if (startAngle != null)
-         {
-            pieplot.setStartAngle(startAngle);
-         }
-         if (direction != null)
-         {
-            pieplot.setDirection(rotationValue(direction));
-         }
-
-         if (sectionOutlinePaint != null)
-         {
-            pieplot.setSectionOutlinePaint(findColor(sectionOutlinePaint));
-         }
-         if (sectionOutlineStroke != null)
-         {
-            pieplot.setSectionOutlineStroke(findStroke(sectionOutlineStroke));
-         }
-         if (sectionOutlinesVisible != null)
-         {
-            pieplot.setSectionOutlinesVisible(sectionOutlinesVisible);
-         }
-
-         // pieplot.setLabelFont(arg0);
-         if (labelBackgroundPaint != null)
-         {
-            pieplot.setLabelBackgroundPaint(findColor(labelBackgroundPaint));
-         }
-         if (labelGap != null)
-         {
-            pieplot.setLabelGap(labelGap);
-         }
-         if (labelLinkMargin != null)
-         {
-            pieplot.setLabelLinkMargin(labelLinkMargin);
-         }
-         if (labelLinkPaint != null)
-         {
-            pieplot.setLabelLinkPaint(findColor(labelLinkPaint));
-         }
-         if (labelLinkStroke != null)
-         {
-            pieplot.setLabelLinkStroke(findStroke(labelLinkStroke));
-         }
-         if (labelLinksVisible != null)
-         {
-            pieplot.setLabelLinksVisible(labelLinksVisible);
-         }
-         if (labelOutlinePaint != null)
-         {
-            pieplot.setLabelOutlinePaint(findColor(labelOutlinePaint));
-         }
-         if (labelOutlineStroke != null)
-         {
-            pieplot.setLabelOutlineStroke(findStroke(labelOutlineStroke));
-         }
-         if (labelPaint != null)
-         {
-            pieplot.setLabelPaint(findColor(labelPaint));
-         }
-         if (labelShadowPaint != null)
-         {
-            pieplot.setLabelShadowPaint(findColor(labelShadowPaint));
-         }
-
-      }
-   }
-
-   @Override
-   public JFreeChart createChart(FacesContext context)
-   {
-      legend = (Boolean) valueBinding(context, "legend", getLegend());
-
-      if (!is3D)
-      {
-         return ChartFactory.createPieChart(getTitle(), data, legend, false, false);
-      }
-      else
-      {
-         return ChartFactory.createPieChart3D(getTitle(), data, legend, false, false);
-      }
-   }
+        if (!getIs3D()) {
+            return ChartFactory.createPieChart(getTitle(), (PieDataset) dataset, getLegend(), false, false);
+        } else {
+            return ChartFactory.createPieChart3D(getTitle(), (PieDataset) dataset, getLegend(), false, false);
+        }
+    }
 }

Added: trunk/src/pdf/org/jboss/seam/pdf/ui/UITimeSeriesChart.java
===================================================================
--- trunk/src/pdf/org/jboss/seam/pdf/ui/UITimeSeriesChart.java	                        (rev 0)
+++ trunk/src/pdf/org/jboss/seam/pdf/ui/UITimeSeriesChart.java	2009-02-16 23:47:23 UTC (rev 10051)
@@ -0,0 +1,188 @@
+package org.jboss.seam.pdf.ui;
+
+import javax.faces.context.FacesContext;
+
+import org.jfree.chart.ChartFactory;
+import org.jfree.chart.JFreeChart;
+import org.jfree.data.general.Dataset;
+import org.jfree.data.xy.DefaultXYDataset;
+import org.jfree.data.xy.XYDataset;
+
+public class UITimeSeriesChart 
+    extends UIChart 
+{
+    private String domainAxisLabel;
+    private String domainLabelPosition;
+    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 String getDomainLabelPosition() {
+        return (String) valueBinding("domainLabelPosition", domainLabelPosition);
+    }
+
+    public void setDomainLabelPosition(String domainLabelPosition) {
+        this.domainLabelPosition = domainLabelPosition;
+    }
+    
+    public String getDomainGridlinePaint() {
+        return (String) valueBinding("domainGridlinePaint", domainGridlinePaint);
+    }
+
+    public void setDomainGridlinePaint(String domainGridlinePaint) {
+        this.domainGridlinePaint = domainGridlinePaint;
+    }
+
+    public String getDomainGridlineStroke() {
+        return (String) valueBinding("domainGridlineStroke",
+                domainGridlineStroke);
+    }
+
+    public void setDomainGridlineStroke(String domainGridlineStroke) {
+        this.domainGridlineStroke = domainGridlineStroke;
+    }
+
+    public Boolean getDomainGridlinesVisible() {
+        return (Boolean) valueBinding("domainGridlinesVisible",
+                domainGridlinesVisible);
+    }
+
+    public void setDomainGridlinesVisible(Boolean domainGridlinesVisible) {
+        this.domainGridlinesVisible = domainGridlinesVisible;
+    }
+
+    public String getRangeGridlinePaint() {
+        return (String) valueBinding("rangeGridlinePaint", rangeGridlinePaint);
+    }
+
+    public void setRangeGridlinePaint(String rangeGridlinePaint) {
+        this.rangeGridlinePaint = rangeGridlinePaint;
+    }
+
+    public String getRangeGridlineStroke() {
+        return (String) valueBinding("rangeGridlineStroke", rangeGridlineStroke);
+    }
+
+    public void setRangeGridlineStroke(String rangeGridlineStroke) {
+        this.rangeGridlineStroke = rangeGridlineStroke;
+    }
+
+    public Boolean getRangeGridlinesVisible() {
+        return (Boolean) valueBinding("rangeGridlinesVisible",
+                rangeGridlinesVisible);
+    }
+
+    public void setRangeGridlinesVisible(Boolean rangeGridlinesVisible) {
+        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) {
+        Object[] values = (Object[]) state;
+
+        super.restoreState(context, values[0]);
+
+        //orientation = (String) values[1];
+        //legend = (Boolean) values[2];
+        //is3D = (Boolean) values[3];
+//        titleBackgroundPaint = (String) values[5];
+//        titlePaint = (String) values[6];
+//        legendBackgroundPaint = (String) values[7];
+//        legendItemPaint = (String) values[8];
+//        legendOutlinePaint = (String) values[9];
+        domainAxisLabel = (String) values[10];
+        domainAxisPaint = (String) values[11];
+        domainGridlinesVisible = (Boolean) values[12];
+        domainGridlinePaint = (String) values[13];
+        domainGridlineStroke = (String) values[14];
+        rangeAxisLabel = (String) values[15];
+        rangeAxisPaint = (String) values[16];
+        rangeGridlinesVisible = (Boolean) values[17];
+        rangeGridlinePaint = (String) values[18];
+        rangeGridlineStroke = (String) values[19];
+        domainLabelPosition = (String) values[20];
+    }
+
+    @Override
+    public Object saveState(FacesContext context) {
+        Object[] values = new Object[21];
+        values[0] = super.saveState(context);
+        //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] = legendOutlinePaint;
+        values[10] = domainAxisLabel;
+        values[11] = domainAxisPaint;
+        values[12] = domainGridlinesVisible;
+        values[13] = domainGridlinePaint;
+        values[14] = domainGridlineStroke;
+        values[15] = rangeAxisLabel;
+        values[16] = rangeAxisPaint;
+        values[17] = rangeGridlinesVisible;
+        values[18] = rangeGridlinePaint;
+        values[19] = rangeGridlineStroke;
+        values[20] = domainLabelPosition;
+
+        return values;
+    }
+    @Override
+    public JFreeChart createChart(FacesContext context)
+    {
+          return ChartFactory.createTimeSeriesChart(getTitle(), 
+                  getDomainAxisLabel(), 
+                  getRangeAxisLabel(), 
+                  (XYDataset) getDataset(), 
+                  true, false, false);
+       
+    }
+
+    @Override
+    public Dataset createDataset() {
+        return new DefaultXYDataset();
+    }
+
+}




More information about the seam-commits mailing list