[PATCH] Fixed sub title zoom stuff
Wald Commits
scm-commit at wald.intevation.org
Thu Aug 7 19:56:20 CEST 2014
# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1407434175 -7200
# Node ID e1b49fc9d2b55507a59d867b5209096aaeb9140d
# Parent 1cae4fc6bdd7e00937a054f79b332f73214dcd2c
Fixed sub title zoom stuff.
diff -r 1cae4fc6bdd7 -r e1b49fc9d2b5 artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator2.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator2.java Thu Aug 07 17:26:18 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator2.java Thu Aug 07 19:56:15 2014 +0200
@@ -16,14 +16,11 @@
import java.awt.Stroke;
import java.awt.TexturePaint;
import java.awt.Transparency;
-
import java.awt.geom.Rectangle2D;
-
import java.awt.image.BufferedImage;
-
import java.io.IOException;
import java.io.OutputStream;
-
+import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
@@ -34,28 +31,19 @@
import javax.xml.xpath.XPathConstants;
import org.apache.log4j.Logger;
-
import org.dive4elements.artifactdatabase.state.ArtifactAndFacet;
import org.dive4elements.artifactdatabase.state.Settings;
-
import org.dive4elements.artifacts.Artifact;
import org.dive4elements.artifacts.ArtifactNamespaceContext;
import org.dive4elements.artifacts.CallContext;
import org.dive4elements.artifacts.CallMeta;
import org.dive4elements.artifacts.PreferredLocale;
-
import org.dive4elements.artifacts.common.utils.XMLUtils;
-
import org.dive4elements.river.artifacts.D4EArtifact;
-
import org.dive4elements.river.artifacts.access.RangeAccess;
-
import org.dive4elements.river.artifacts.resources.Resources;
-
import org.dive4elements.river.collections.D4EArtifactCollection;
-
import org.dive4elements.river.java2d.NOPGraphics2D;
-
import org.dive4elements.river.jfree.AxisDataset;
import org.dive4elements.river.jfree.Bounds;
import org.dive4elements.river.jfree.DoubleBounds;
@@ -65,35 +53,22 @@
import org.dive4elements.river.jfree.Style;
import org.dive4elements.river.jfree.StyledAreaSeriesCollection;
import org.dive4elements.river.jfree.StyledSeries;
-
import org.dive4elements.river.model.River;
-
import org.dive4elements.river.themes.ThemeDocument;
-
import org.dive4elements.river.utils.Formatter;
import org.dive4elements.river.utils.RiverUtils;
-
import org.jfree.chart.ChartRenderingInfo;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.LegendItem;
import org.jfree.chart.LegendItemCollection;
-
import org.jfree.chart.axis.NumberAxis;
-
import org.jfree.chart.plot.XYPlot;
-
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
-
import org.jfree.chart.title.TextTitle;
-
import org.jfree.data.Range;
-
import org.jfree.data.general.Series;
-
import org.jfree.data.xy.XYDataset;
-
import org.jfree.ui.RectangleInsets;
-
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -475,7 +450,7 @@
protected ChartSection buildChartSection() {
ChartSection chartSection = new ChartSection();
chartSection.setTitle(getChartTitle());
- chartSection.setSubtitle(getChartSubtitle());
+ chartSection.setSubtitle(getChartSubtitlePure());
chartSection.setDisplayGrid(isGridVisible());
chartSection.setDisplayLogo(showLogo());
chartSection.setLogoVPlacement(logoVPlace());
@@ -675,16 +650,10 @@
}
protected String interpolateVariables(String s) {
-
Object radius = context.getContextValue("radius");
if (radius instanceof Double) {
- String txt = Resources.getMsg(
- context.getMeta(),
- I18N_SUBTITLE_RADIUS,
- new Object[] { radius });
-
- return s.replace("$RADIUS", txt);
-
+ NumberFormat f = Formatter.getCSVFormatter(context);
+ return s.replace("$RADIUS", f.format(radius));
}
return s;
}
@@ -697,24 +666,24 @@
*
* @return the subtitle of a chart.
*/
- protected String getChartSubtitle() {
+ protected String getChartSubtitlePure() {
ChartSettings chartSettings = getChartSettings();
- if (chartSettings != null) {
- String subTitle = getChartSubtitle(chartSettings);
- if (subTitle == null) {
- return getDefaultChartSubtitle();
- }
- String defSubTitle = getDefaultChartSubtitle();
- if (defSubTitle != null
- && !defSubTitle.isEmpty()
- && !subTitle.equals(defSubTitle)) {
- return interpolateVariables(defSubTitle);
- }
- return subTitle;
+ String subTitle = chartSettings != null
+ ? getChartSubtitle(chartSettings)
+ : getDefaultChartSubtitle();
+
+ String defSubTitle = getDefaultChartSubtitle();
+
+ if (subTitle == null) {
+ subTitle = defSubTitle != null ? defSubTitle : "";
}
- return getDefaultChartSubtitle();
+ return subTitle;
+ }
+
+ protected String getChartSubtitle() {
+ return interpolateVariables(getChartSubtitlePure());
}
diff -r 1cae4fc6bdd7 -r e1b49fc9d2b5 artifacts/src/main/java/org/dive4elements/river/exports/process/WDiffProcessor.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/WDiffProcessor.java Thu Aug 07 17:26:18 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/WDiffProcessor.java Thu Aug 07 19:56:15 2014 +0200
@@ -51,7 +51,7 @@
generator.addSubtitle(Resources.getMsg(
context.getMeta(),
I18N_SUBTITLE_RADIUS,
- new Object[] { radius }));
+ new Object[] { "$RADIUS" }));
}
super.doOut(generator, bundle, theme, visible);
}
More information about the Dive4Elements-commits
mailing list