Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java @ 1700:13a9ee6cebef
Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
labels in LongitudinalSectionGenerator subclasses.
flys-artifacts/trunk@2934 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 11 Oct 2011 10:44:12 +0000 |
parents | 0c9f7cc2cc11 |
children | 6e59208839ae |
comparison
equal
deleted
inserted
replaced
1699:608859aa5a7e | 1700:13a9ee6cebef |
---|---|
19 import de.intevation.flys.artifacts.model.WKms; | 19 import de.intevation.flys.artifacts.model.WKms; |
20 | 20 |
21 import de.intevation.flys.utils.DataUtil; | 21 import de.intevation.flys.utils.DataUtil; |
22 | 22 |
23 import de.intevation.flys.artifacts.model.WQKms; | 23 import de.intevation.flys.artifacts.model.WQKms; |
24 | 24 import de.intevation.flys.utils.FLYSUtils; |
25 | 25 |
26 | 26 |
27 /** | 27 /** |
28 * An OutGenerator that generates w differences curves. | 28 * An OutGenerator that generates w differences curves. |
29 */ | 29 */ |
33 { | 33 { |
34 /** The logger that is used in this generator. */ | 34 /** The logger that is used in this generator. */ |
35 private static Logger logger = | 35 private static Logger logger = |
36 Logger.getLogger(WDifferencesCurveGenerator.class); | 36 Logger.getLogger(WDifferencesCurveGenerator.class); |
37 | 37 |
38 public static final String I18N_CHART_TITLE = | 38 |
39 "chart.w_differences.title"; | 39 /** |
40 | 40 * Get internationalized title for chart. |
41 public static final String I18N_CHART_SUBTITLE = | 41 */ |
42 "chart.w_differences.subtitle"; | 42 public String getChartTitle() { |
43 | 43 return msg("chart.w_differences.title", "Differences"); |
44 public static final String I18N_YAXIS_LABEL = | 44 } |
45 "chart.w_differences.yaxis.label"; | 45 |
46 | 46 |
47 public static final String I18N_2YAXIS_LABEL = | 47 /** |
48 "chart.w_differences.yaxis.second.label"; | 48 * Get default value for the second Y-Axis' label (if no translation was |
49 | 49 * found). |
50 // TODO proper i18n. | 50 */ |
51 public static final String I18N_CHART_TITLE_DEFAULT = "W-Differenzen"; | 51 @Override |
52 public static final String I18N_XAXIS_LABEL_DEFAULT = "km"; | 52 protected String get2YAxisDefaultLabel() { |
53 public static final String I18N_YAXIS_LABEL_DEFAULT = "W [m]"; | 53 return "W [NN + m]"; |
54 public static final String I18N_2YAXIS_LABEL_DEFAULT = "W [NN + m]"; | 54 } |
55 | 55 |
56 | 56 |
57 /** | 57 /** |
58 * Add a subtitle to Chart. | 58 * Gets key to look up internationalized String for the charts subtitle. |
59 * @param chart Chart to add subtitle to. | 59 * @return key to look up translated subtitle. |
60 */ | 60 */ |
61 @Override | 61 @Override |
62 protected void addSubtitles(JFreeChart chart) { | 62 protected String getChartSubtitleKey() { |
63 String subtitle = msg(I18N_CHART_SUBTITLE, ""); | 63 return "chart.w_differences.subtitle"; |
64 chart.addSubtitle(new TextTitle(subtitle)); | 64 } |
65 | |
66 | |
67 /** | |
68 * Get key for internationalization of the second Y-Axis' label. | |
69 */ | |
70 @Override | |
71 protected String get2YAxisLabelKey() { | |
72 return "chart.w_differences.yaxis.second.label"; | |
73 } | |
74 | |
75 | |
76 /** | |
77 * Get internationalized label for the y axis. | |
78 */ | |
79 @Override | |
80 protected String getYAxisLabel() { | |
81 FLYSArtifact flys = (FLYSArtifact) master; | |
82 | |
83 String unit = FLYSUtils.getRiver(flys).getWstUnit().getName(); | |
84 | |
85 return msg( | |
86 "chart.w_differences.yaxis.label", | |
87 "m", | |
88 new Object[] { unit }); | |
65 } | 89 } |
66 | 90 |
67 | 91 |
68 /** | 92 /** |
69 * Add (themed) data for chart generation. | 93 * Add (themed) data for chart generation. |