comparison flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java @ 2048:3157a78e6494

Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings. flys-artifacts/trunk@3538 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 23 Dec 2011 14:24:57 +0000
parents 0318fa6f0844
children 2d5f2bc68cc6
comparison
equal deleted inserted replaced
2047:0318fa6f0844 2048:3157a78e6494
182 datasets = new TreeMap<Integer, AxisDataset>(); 182 datasets = new TreeMap<Integer, AxisDataset>();
183 } 183 }
184 184
185 185
186 /** 186 /**
187 * Returns the title of a chart. 187 * Returns the title of a chart. The return value depends on the existence
188 * of ChartSettings: if there are ChartSettings set, this method returns the
189 * chart title provided by those settings. Otherwise, this method returns
190 * getDefaultChartTitle().
188 * 191 *
189 * @return the title of a chart. 192 * @return the title of a chart.
190 */ 193 */
191 protected abstract String getChartTitle(); 194 protected String getChartTitle() {
192 195 ChartSettings chartSettings = getChartSettings();
193 196
194 /** 197 if (chartSettings != null) {
195 * This method always returns null. If a concrete subclass of this class 198 return getChartTitle(chartSettings);
196 * requires a chart subtitle, this subclass can easily override this method. 199 }
197 * 200
198 * @return always null. 201 return getDefaultChartTitle();
202 }
203
204
205 protected abstract String getDefaultChartTitle();
206
207
208 /**
209 * Returns the subtitle of a chart. The return value depends on the
210 * existence of ChartSettings: if there are ChartSettings set, this method
211 * returns the chart title provided by those settings. Otherwise, this
212 * method returns getDefaultChartSubtitle().
213 *
214 * @return the subtitle of a chart.
199 */ 215 */
200 protected String getChartSubtitle() { 216 protected String getChartSubtitle() {
201 // overridden this method in subclasses that need subtitles 217 ChartSettings chartSettings = getChartSettings();
218
219 if (chartSettings != null) {
220 return getChartSubtitle(chartSettings);
221 }
222
223 return getDefaultChartSubtitle();
224 }
225
226
227 /**
228 * This method always returns null. Override it in subclasses that require
229 * subtitles.
230 *
231 * @return null.
232 */
233 protected String getDefaultChartSubtitle() {
234 // Override this method in subclasses
202 return null; 235 return null;
203 } 236 }
204 237
205 238
206 /** 239 /**

http://dive4elements.wald.intevation.org