comparison artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityDiameterProcessor.java @ 7892:e844be34a606 facet-metadata

Add metadata to chart series and datasets.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 21 May 2014 11:40:14 +0200
parents 1508ee33f85f
children 98ca61cb58fb
comparison
equal deleted inserted replaced
7891:4fe290eddb43 7892:e844be34a606
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the 5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
6 * documentation coming with Dive4Elements River for details. 6 * documentation coming with Dive4Elements River for details.
7 */ 7 */
8 8
9 package org.dive4elements.river.exports.process; 9 package org.dive4elements.river.exports.process;
10
11 import java.awt.Dialog.ModalExclusionType;
12 import java.util.Map;
10 13
11 import org.apache.log4j.Logger; 14 import org.apache.log4j.Logger;
12 import org.jfree.data.xy.XYSeries; 15 import org.jfree.data.xy.XYSeries;
13 16
14 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; 17 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet;
31 public static final String I18N_AXIS_LABEL_DEFAULT = 34 public static final String I18N_AXIS_LABEL_DEFAULT =
32 "Durchmesser [mm]"; 35 "Durchmesser [mm]";
33 public static final String I18N_AXIS_LABEL = 36 public static final String I18N_AXIS_LABEL =
34 "chart.bedquality.yaxis.label.diameter"; 37 "chart.bedquality.yaxis.label.diameter";
35 38
39 protected String yAxisLabel;
36 @Override 40 @Override
37 public void doOut( 41 public void doOut(
38 DiagramGenerator generator, 42 DiagramGenerator generator,
39 ArtifactAndFacet bundle, 43 ArtifactAndFacet bundle,
40 ThemeDocument theme, 44 ThemeDocument theme,
41 boolean visible) { 45 boolean visible) {
42 CallContext context = generator.getCallContext(); 46 CallContext context = generator.getCallContext();
43 XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), 47 Map<String, String> metaData = bundle.getFacet().getMetaData();
48 StyledXYSeries series = new StyledXYSeries(bundle.getFacetDescription(),
44 theme); 49 theme);
50 series.putMetaData(metaData, bundle.getArtifact(), context);
51 yAxisLabel = metaData.get("Y");
45 Object data = bundle.getData(context); 52 Object data = bundle.getData(context);
46 String facetName = bundle.getFacetName(); 53 String facetName = bundle.getFacetName();
47 double [][] points; 54 double [][] points;
48 55
49 if (facetName.equals(FacetTypes.BED_QUALITY_BED_DIAMETER_TOPLAYER)) { 56 if (facetName.equals(FacetTypes.BED_QUALITY_BED_DIAMETER_TOPLAYER)) {
75 facettype.equals(FacetTypes.BEDLOAD_DIAMETER_DATA); 82 facettype.equals(FacetTypes.BEDLOAD_DIAMETER_DATA);
76 } 83 }
77 84
78 @Override 85 @Override
79 public String getAxisLabel(DiagramGenerator generator) { 86 public String getAxisLabel(DiagramGenerator generator) {
87 if (yAxisLabel != null && !yAxisLabel.isEmpty()) {
88 return generator.msg(yAxisLabel, I18N_AXIS_LABEL_DEFAULT);
89 }
80 return generator.msg( 90 return generator.msg(
81 I18N_AXIS_LABEL, 91 I18N_AXIS_LABEL,
82 I18N_AXIS_LABEL_DEFAULT); 92 I18N_AXIS_LABEL_DEFAULT);
83 } 93 }
84 } 94 }

http://dive4elements.wald.intevation.org