[Schmitzm-commits] r1075 - branches/2.2.x/src/schmitzm/jfree/table/style

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Oct 5 11:03:35 CEST 2010


Author: mojays
Date: 2010-10-05 11:03:30 +0200 (Tue, 05 Oct 2010)
New Revision: 1075

Modified:
   branches/2.2.x/src/schmitzm/jfree/table/style/TableChartAxisStyle.java
Log:
BugFix in TableChartAxisStyle: connected chart style must also be copied in copyTo(.)

Modified: branches/2.2.x/src/schmitzm/jfree/table/style/TableChartAxisStyle.java
===================================================================
--- branches/2.2.x/src/schmitzm/jfree/table/style/TableChartAxisStyle.java	2010-10-05 09:03:08 UTC (rev 1074)
+++ branches/2.2.x/src/schmitzm/jfree/table/style/TableChartAxisStyle.java	2010-10-05 09:03:30 UTC (rev 1075)
@@ -64,8 +64,7 @@
    * @param valuesAngle angel (in degrees) the axis values are rotated by
    */
   public TableChartAxisStyle(TableChartStyle<?> chartStyle, String title, Color color, Double labelAngle, Double valuesAngle) {
-    super(title, color, labelAngle, valuesAngle);
-    this.chartStyle = chartStyle; 
+    this(chartStyle, new Translation(title), color, labelAngle, valuesAngle);
   }
 
   /**
@@ -90,6 +89,19 @@
   }
 
   /**
+   * Creates a (deep) clone of this style.
+   */
+  @Override
+  public ChartAxisStyle copyTo(ChartAxisStyle dest) {
+    dest = super.copyTo(dest);
+    // also copy the chart style, the axis is connected to
+    if ( dest instanceof TableChartAxisStyle ) {
+      ((TableChartAxisStyle)dest).setChartStyle( getChartStyle() );
+    }
+    return dest;
+  };
+
+  /**
    * Returns the chart style, the axis is connected to.
    */
   public TableChartStyle<?> getChartStyle() {
@@ -120,7 +132,7 @@
     String unitStr = isUnitVisible() ? getUnitString() : null;
     String funcStr = null;
     String normStr = null; 
-    for (int i=0; i<chartStyle.getAxisCount(); i++)
+    for (int i=0; chartStyle != null && i<chartStyle.getAxisCount(); i++)
       if ( chartStyle.getAxisStyle(i) == this ) {
         // ToDo: ??? von welchem Attribut die Aggr.Function und
         //       Normalisierung verwenden. Ist 'i' richtig?



More information about the Schmitzm-commits mailing list