comparison gnv-artifacts/src/main/java/de/intevation/gnv/transition/timeseries/TimeSeriesOutputTransition.java @ 331:1c427acb6c76

Added subtitles to charts. gnv-artifacts/trunk@397 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 04 Dec 2009 15:30:20 +0000
parents 22a6493e8460
children e37930705daa
comparison
equal deleted inserted replaced
330:477c0c46605e 331:1c427acb6c76
208 } 208 }
209 } catch (NumberFormatException e) { 209 } catch (NumberFormatException e) {
210 log.error(e, e); 210 log.error(e, e);
211 throw new TransitionException(e); 211 throw new TransitionException(e);
212 } 212 }
213 Collection<KeyValueDescibeData> parameters = this.getParameters(uuid);
214 Collection<KeyValueDescibeData> measurements = this.getMeasurements(uuid);
215 Collection<KeyValueDescibeData> dates = this.getDates(uuid);
216 ChartLabels chartLables = new ChartLabels(this.getFisName(callMeta.getLanguages())+" "+this
217 .getSelectedFeatureName(uuid), this.domainLable);
218
219 String exportFormat = getExportFormat(mimeType);
220
221 // TODO Remove this and parse input data
222 boolean linesVisible = true;
223 boolean shapesVisible = true;
224 213
225 PreferredLocale[] locales = callMeta.getLanguages(); 214 PreferredLocale[] locales = callMeta.getLanguages();
226 Locale[] serverLocales = 215 Locale[] serverLocales =
227 RessourceFactory.getInstance().getLocales(); 216 RessourceFactory.getInstance().getLocales();
228 Locale locale = 217 Locale locale =
230 219
231 log.debug( 220 log.debug(
232 "Best locale - regarding intersection of server and " + 221 "Best locale - regarding intersection of server and " +
233 "browser locales - is " + locale.toString() 222 "browser locales - is " + locale.toString()
234 ); 223 );
224
225 Collection parameters = this.getParameters(uuid);
226 Collection measurements = this.getMeasurements(uuid);
227 Collection dates = this.getDates(uuid);
228
229 ChartLabels chartLables = new ChartLabels(
230 createChartTitle(locale, uuid),
231 createChartSubtitle(locale, uuid),
232 domainLable
233 );
234
235 String exportFormat = getExportFormat(mimeType);
236
237 // TODO Remove this and parse input data
238 boolean linesVisible = true;
239 boolean shapesVisible = true;
235 240
236 this.createChart( 241 this.createChart(
237 outputStream, 242 outputStream,
238 parameters, 243 parameters,
239 measurements, 244 measurements,
269 outputStream, 274 outputStream,
270 getParameters(uuid), 275 getParameters(uuid),
271 getMeasurements(uuid), 276 getMeasurements(uuid),
272 getDates(uuid), 277 getDates(uuid),
273 new ChartLabels( 278 new ChartLabels(
274 this.getFisName(callMeta.getLanguages()) + 279 createChartTitle(locale, uuid),
275 " "+ getSelectedFeatureName(uuid), 280 createChartSubtitle(locale, uuid),
276 this.domainLable), 281 domainLable),
277 uuid, 282 uuid,
278 "A4", 283 "A4",
279 true, 284 true,
280 locale, 285 locale,
281 linesVisible, 286 linesVisible,
305 outputStream, 310 outputStream,
306 getParameters(uuid), 311 getParameters(uuid),
307 getMeasurements(uuid), 312 getMeasurements(uuid),
308 getDates(uuid), 313 getDates(uuid),
309 new ChartLabels( 314 new ChartLabels(
310 this.getFisName(callMeta.getLanguages()) + 315 createChartTitle(locale, uuid),
311 " "+ getSelectedFeatureName(uuid), 316 createChartSubtitle(locale, uuid),
312 this.domainLable), 317 domainLable
318 ),
313 uuid, 319 uuid,
314 locale, 320 locale,
315 width, 321 width,
316 height, 322 height,
317 linesVisible, 323 linesVisible,
454 460
455 } 461 }
456 return doc; 462 return doc;
457 } 463 }
458 464
465
459 protected String getSelectedFeatureName(String uuid) { 466 protected String getSelectedFeatureName(String uuid) {
460 Collection<KeyValueDescibeData> values = this 467 Collection values = getCollection(featureValuesName, uuid);
461 .getCollection(featureValuesName, uuid); 468
462 if (values != null) { 469 if (values != null) {
463 Iterator<KeyValueDescibeData> it = values.iterator(); 470 Iterator it = values.iterator();
471
464 while (it.hasNext()) { 472 while (it.hasNext()) {
465 KeyValueDescibeData data = it.next(); 473 KeyValueDescibeData data = (KeyValueDescibeData) it.next();
474
466 if (data.isSelected()) { 475 if (data.isSelected()) {
467 return data.getValue(); 476 return data.getValue();
468 } 477 }
469 } 478 }
470 } 479 }
471 return null; 480 return null;
472 } 481 }
482
473 483
474 /** 484 /**
475 * @param outputStream 485 * @param outputStream
476 * @param parameters 486 * @param parameters
477 * @param measurements 487 * @param measurements
681 theme.applyXMLConfiguration(template); 691 theme.applyXMLConfiguration(template);
682 692
683 return theme; 693 return theme;
684 } 694 }
685 695
686 protected String getFisName(PreferredLocale[] preferredLocales){ 696
687 String returnValue = ""; 697 protected String createChartTitle(Locale locale, String uuid) {
688 InputData inputData = this.inputData.get("fisname"); 698 return getFisName(locale);
689 if (inputData != null){ 699
690 returnValue = RessourceFactory.getInstance() 700 }
691 .getRessource(preferredLocales, 701
692 inputData.getValue(), 702
693 inputData.getValue()); 703 protected String createChartSubtitle(Locale locale, String uuid) {
704 return getSelectedFeatureName(uuid);
705 }
706
707
708 protected String getFisName(Locale locale) {
709 String returnValue = "";
710 InputData input = inputData.get("fisname");
711
712 if (input != null) {
713 String value = input.getValue();
714
715 returnValue = RessourceFactory.getInstance().getRessource(
716 locale,
717 value,
718 value
719 );
694 } 720 }
695 return returnValue; 721 return returnValue;
696 } 722 }
723
697 724
698 protected Collection<KeyValueDescibeData> getParameters(String uuid) { 725 protected Collection<KeyValueDescibeData> getParameters(String uuid) {
699 return this.getCollection(parameterValuesName, uuid); 726 return this.getCollection(parameterValuesName, uuid);
700 } 727 }
701 728

http://dive4elements.wald.intevation.org