[Schmitzm-commits] r1074 - trunk/src/schmitzm/jfree/table/style

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


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

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

Modified: trunk/src/schmitzm/jfree/table/style/TableChartAxisStyle.java
===================================================================
--- trunk/src/schmitzm/jfree/table/style/TableChartAxisStyle.java	2010-10-05 08:45:59 UTC (rev 1073)
+++ trunk/src/schmitzm/jfree/table/style/TableChartAxisStyle.java	2010-10-05 09:03:08 UTC (rev 1074)
@@ -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