[Schmitzm-commits] r453 - in branches/1.0-gt2-2.6/src: schmitzm/jfree/chart/style schmitzm/jfree/feature/style skrueger/i8n
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri Oct 9 23:50:49 CEST 2009
Author: mojays
Date: 2009-10-09 23:50:48 +0200 (Fri, 09 Oct 2009)
New Revision: 453
Modified:
branches/1.0-gt2-2.6/src/schmitzm/jfree/chart/style/AbstractChartStyle.java
branches/1.0-gt2-2.6/src/schmitzm/jfree/chart/style/ChartLabelStyle.java
branches/1.0-gt2-2.6/src/schmitzm/jfree/chart/style/ChartPlotStyle.java
branches/1.0-gt2-2.6/src/schmitzm/jfree/feature/style/FeatureBasicChartStyle.java
branches/1.0-gt2-2.6/src/schmitzm/jfree/feature/style/FeatureChartStyle.java
branches/1.0-gt2-2.6/src/schmitzm/jfree/feature/style/FeatureScatterChartStyle.java
branches/1.0-gt2-2.6/src/skrueger/i8n/Translation.java
Log:
Bugs with Copyable (Feature)ChartStyles fixed. Should work now!
Modified: branches/1.0-gt2-2.6/src/schmitzm/jfree/chart/style/AbstractChartStyle.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/jfree/chart/style/AbstractChartStyle.java 2009-10-09 19:16:27 UTC (rev 452)
+++ branches/1.0-gt2-2.6/src/schmitzm/jfree/chart/style/AbstractChartStyle.java 2009-10-09 21:50:48 UTC (rev 453)
@@ -176,7 +176,22 @@
* {@link AbstractChartStyle}
*/
@Override
- public AbstractChartStyle copyTo(ChartStyle dest) {
+ public ChartStyle copyTo(ChartStyle dest) {
+ if ( dest != null && !(dest instanceof AbstractChartStyle) )
+ throw new IllegalArgumentException(LangUtil.getSimpleClassName(this)+".copy(..) can not be applied on "+LangUtil.getSimpleClassName(dest));
+ return copyTo((AbstractChartStyle)dest);
+ }
+
+ /**
+ * Copies all properties of this chart style to another
+ * chart style.
+ * @param dest destination object (if {@code null} the copy
+ * is created by {@link #copy()})
+ * @return {@code dest} or the new instance
+ * @exception IllegalArgumentException if {@code dest} is no
+ * {@link AbstractChartStyle}
+ */
+ public AbstractChartStyle copyTo(AbstractChartStyle dest) {
if ( dest == null )
return copy();
if ( !(dest instanceof AbstractChartStyle) )
Modified: branches/1.0-gt2-2.6/src/schmitzm/jfree/chart/style/ChartLabelStyle.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/jfree/chart/style/ChartLabelStyle.java 2009-10-09 19:16:27 UTC (rev 452)
+++ branches/1.0-gt2-2.6/src/schmitzm/jfree/chart/style/ChartLabelStyle.java 2009-10-09 21:50:48 UTC (rev 453)
@@ -114,7 +114,7 @@
public ChartLabelStyle copyTo(ChartLabelStyle dest) {
if ( dest == null )
return copy();
- dest.setLabelTranslation( getLabelTranslation() );
+ dest.setLabelTranslation( getLabelTranslation().copy() );
dest.setPaint( getPaint() );
return dest;
}
Modified: branches/1.0-gt2-2.6/src/schmitzm/jfree/chart/style/ChartPlotStyle.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/jfree/chart/style/ChartPlotStyle.java 2009-10-09 19:16:27 UTC (rev 452)
+++ branches/1.0-gt2-2.6/src/schmitzm/jfree/chart/style/ChartPlotStyle.java 2009-10-09 21:50:48 UTC (rev 453)
@@ -38,6 +38,7 @@
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.plot.Plot;
import org.jfree.chart.plot.XYPlot;
+import org.jfree.data.Range;
import org.jfree.ui.RectangleInsets;
import schmitzm.jfree.JFreeChartUtil;
@@ -379,5 +380,33 @@
// plot.zoomDomainAxes(1.0, null, new Point2D.Double(50,50), true );
// plot.zoomDomainAxes(0.5,0.5, null, null);
// plot.zoomRangeAxes(0.5,0.5, null, null);
+// Range domainAxisRange = plot.getDomainAxis().getRange();
+// double domainAbsMax = Math.max(
+// Math.abs(domainAxisRange.getLowerBound()),
+// Math.abs(domainAxisRange.getUpperBound())
+// );
+// plot.getDomainAxis().setRange(-domainAbsMax, domainAbsMax);
+//
+//
+// Range rangeAxisRange = plot.getRangeAxis().getRange();
+// double rangeAbsMax = Math.max(
+// Math.abs(rangeAxisRange.getLowerBound()),
+// Math.abs(rangeAxisRange.getUpperBound())
+// );
+// plot.getRangeAxis().setRange(-rangeAbsMax, rangeAbsMax);
+
+// plot.getDomainAxis().centerRange(0);
+// plot.getRangeAxis().centerRange(0);
+//
+// plot.getDomainAxis().setAutoRange(false);
+// plot.getRangeAxis().setAutoRange(false);
+// plot.getDomainAxis().setDefaultAutoRange( new Range(
+// plot.getDomainAxis().getRange().getLowerBound(),
+// plot.getDomainAxis().getRange().getUpperBound())
+// );
+// plot.getRangeAxis().setDefaultAutoRange( new Range(
+// plot.getRangeAxis().getRange().getLowerBound(),
+// plot.getRangeAxis().getRange().getUpperBound())
+// );
}
}
Modified: branches/1.0-gt2-2.6/src/schmitzm/jfree/feature/style/FeatureBasicChartStyle.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/jfree/feature/style/FeatureBasicChartStyle.java 2009-10-09 19:16:27 UTC (rev 452)
+++ branches/1.0-gt2-2.6/src/schmitzm/jfree/feature/style/FeatureBasicChartStyle.java 2009-10-09 21:50:48 UTC (rev 453)
@@ -86,7 +86,7 @@
// copy the super class properties
dest = (FeatureBasicChartStyle)copyTo((BasicChartStyle)dest);
// copy this classes properties
- dummyFeatureChartStyle.copyTo(dest);
+ dummyFeatureChartStyle.copyTo((FeatureChartStyle)dest);
return dest;
}
@@ -183,7 +183,7 @@
* @param normalize indicates the normalize property
*/
@Override
- public void setAttributeNormalized(int idx, boolean normalize){
+ public void setAttributeNormalized(int idx, Boolean normalize){
dummyFeatureChartStyle.setAttributeNormalized(idx, normalize);
}
Modified: branches/1.0-gt2-2.6/src/schmitzm/jfree/feature/style/FeatureChartStyle.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/jfree/feature/style/FeatureChartStyle.java 2009-10-09 19:16:27 UTC (rev 452)
+++ branches/1.0-gt2-2.6/src/schmitzm/jfree/feature/style/FeatureChartStyle.java 2009-10-09 21:50:48 UTC (rev 453)
@@ -81,7 +81,7 @@
* @param attrName feature attribute name
*/
public void setAttributeName(int idx, String attrName);
-
+
/**
* Creates a chart according to the given
* @param fc a feature collection
@@ -128,7 +128,7 @@
* 2=2nd range series; ...)
* @param normalize indicates the normalize property
*/
- public void setAttributeNormalized(int idx, boolean normalize);
+ public void setAttributeNormalized(int idx, Boolean normalize);
/**
* Returns whether the attribute data is normalized for an
@@ -222,11 +222,22 @@
* because they are unused for the dummy.
*/
@Override
- public Dummy copy() {
- return copyTo( new Dummy("") );
+ public AbstractChartStyle copy() {
+ return (AbstractChartStyle)copyTo( (FeatureChartStyle)new Dummy("") );
}
/**
+ * Does nothing but returning the input style, because
+ * {@link Dummy} only maintains the {@link FeatureChartStyle}
+ * properties!
+ */
+ @Override
+ public AbstractChartStyle copyTo(AbstractChartStyle dest) {
+ return dest;
+ }
+
+
+ /**
* Copies all properties of this style to another one. The properties
* of the super class ({@link AbstractChartStyle}) are <b>ignored</b>
* because they are unused for the dummy.
@@ -234,20 +245,25 @@
* is created by {@link #copy()})
* @return {@code dest} or the new instance
*/
- public Dummy copyTo(Dummy dest) {
- super.copyTo(dest);
-
+ public FeatureChartStyle copyTo(FeatureChartStyle dest) {
// !! do NOT copy the super class properties !!
// !! copy only this classes properties !!
dest.setSortDomainAxis( isSortDomainAxis() );
dest.setForceCategories( isForceCategories() );
- dest.attrNames.clear();
+ // Clear the attribute names and attribute normalization
+ int max = dest.getMaxAttributeCount();
+ for (int i=0; i<max; i++) {
+ dest.setAttributeName(i, null);
+ dest.setAttributeNormalized(i, null);
+ }
+ // Copy attribute names and normalization
for (Integer idx : attrNames.keySet() )
- dest.setAttributeName(idx, getAttributeName(idx));
- dest.normalizeAttr.clear();
+ if ( getAttributeName(idx) != null )
+ dest.setAttributeName(idx, getAttributeName(idx));
for (Integer idx : normalizeAttr.keySet() )
- dest.setAttributeNormalized(idx, isAttributeNormalized(idx));
+ if ( isAttributeNormalized(idx) )
+ dest.setAttributeNormalized(idx, isAttributeNormalized(idx));
return dest;
}
@@ -345,7 +361,7 @@
* @param normalize indicates the normalize property
*/
@Override
- public void setAttributeNormalized(int idx, boolean normalize){
+ public void setAttributeNormalized(int idx, Boolean normalize){
normalizeAttr.put(idx, normalize);
updateAttributeCount();
}
Modified: branches/1.0-gt2-2.6/src/schmitzm/jfree/feature/style/FeatureScatterChartStyle.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/jfree/feature/style/FeatureScatterChartStyle.java 2009-10-09 19:16:27 UTC (rev 452)
+++ branches/1.0-gt2-2.6/src/schmitzm/jfree/feature/style/FeatureScatterChartStyle.java 2009-10-09 21:50:48 UTC (rev 453)
@@ -90,10 +90,8 @@
public FeatureScatterChartStyle copyTo(FeatureScatterChartStyle dest) {
// copy the super class properties
dest = (FeatureScatterChartStyle)copyTo((ScatterChartStyle)dest);
-
-// Hey Martin! Die nächste line überschreibt alles mit null... wenn ich sie rausnehme
-// // copy this classes properties
- dummyFeatureChartStyle.copyTo(dest);
+ // copy this classes properties
+ dummyFeatureChartStyle.copyTo((FeatureChartStyle)dest);
return dest;
}
@@ -189,7 +187,7 @@
* @param normalize indicates the normalize property
*/
@Override
- public void setAttributeNormalized(int idx, boolean normalize){
+ public void setAttributeNormalized(int idx, Boolean normalize){
dummyFeatureChartStyle.setAttributeNormalized(idx, normalize);
}
Modified: branches/1.0-gt2-2.6/src/skrueger/i8n/Translation.java
===================================================================
--- branches/1.0-gt2-2.6/src/skrueger/i8n/Translation.java 2009-10-09 19:16:27 UTC (rev 452)
+++ branches/1.0-gt2-2.6/src/skrueger/i8n/Translation.java 2009-10-09 21:50:48 UTC (rev 453)
@@ -343,8 +343,9 @@
public Translation copyTo(Translation translation2) {
if (translation2 == null)
- throw new IllegalArgumentException(
- "Target translation may not be null.");
+// throw new IllegalArgumentException(
+// "Target translation may not be null.");
+ return copy();
for (String s : keySet()) {
translation2.put(s, get(s));
}
More information about the Schmitzm-commits
mailing list