Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/process/BedWidthProcessor.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 | b2a8a94a92f9 |
children | 45cced06490c |
comparison
equal
deleted
inserted
replaced
7891:4fe290eddb43 | 7892:e844be34a606 |
---|---|
10 | 10 |
11 import org.apache.log4j.Logger; | 11 import org.apache.log4j.Logger; |
12 import org.jfree.data.xy.XYSeries; | 12 import org.jfree.data.xy.XYSeries; |
13 | 13 |
14 import java.util.List; | 14 import java.util.List; |
15 import java.util.Map; | |
15 | 16 |
16 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; | 17 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; |
17 import org.dive4elements.artifacts.CallContext; | 18 import org.dive4elements.artifacts.CallContext; |
18 import org.dive4elements.river.artifacts.model.FacetTypes; | 19 import org.dive4elements.river.artifacts.model.FacetTypes; |
19 import org.dive4elements.river.exports.DiagramGenerator; | 20 import org.dive4elements.river.exports.DiagramGenerator; |
35 public static final String I18N_AXIS_LABEL_DEFAULT = | 36 public static final String I18N_AXIS_LABEL_DEFAULT = |
36 "Breite [m]"; | 37 "Breite [m]"; |
37 public static final String I18N_AXIS_LABEL = | 38 public static final String I18N_AXIS_LABEL = |
38 "chart.beddifference.yaxis.label.morph"; | 39 "chart.beddifference.yaxis.label.morph"; |
39 | 40 |
41 protected String yAxisLabel; | |
40 @Override | 42 @Override |
41 public void doOut( | 43 public void doOut( |
42 DiagramGenerator generator, | 44 DiagramGenerator generator, |
43 ArtifactAndFacet bundle, | 45 ArtifactAndFacet bundle, |
44 ThemeDocument theme, | 46 ThemeDocument theme, |
45 boolean visible) { | 47 boolean visible) { |
46 CallContext context = generator.getCallContext(); | 48 CallContext context = generator.getCallContext(); |
47 XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), | 49 Map<String, String> metaData = bundle.getFacet().getMetaData(); |
50 StyledXYSeries series = new StyledXYSeries(bundle.getFacetDescription(), | |
48 theme); | 51 theme); |
52 series.putMetaData(metaData, bundle.getArtifact(), context); | |
53 yAxisLabel = metaData.get("Y"); | |
49 Object data = bundle.getData(context); | 54 Object data = bundle.getData(context); |
50 String facetName = bundle.getFacetName(); | 55 String facetName = bundle.getFacetName(); |
51 | 56 |
52 if (facetName.equals(FacetTypes.BED_DIFFERENCE_SOUNDING_WIDTH) && | 57 if (facetName.equals(FacetTypes.BED_DIFFERENCE_SOUNDING_WIDTH) && |
53 data instanceof BedDiffYearResult) { | 58 data instanceof BedDiffYearResult) { |
98 facettype.equals(FacetTypes.BEDHEIGHT_SOUNDING_WIDTH); | 103 facettype.equals(FacetTypes.BEDHEIGHT_SOUNDING_WIDTH); |
99 } | 104 } |
100 | 105 |
101 @Override | 106 @Override |
102 public String getAxisLabel(DiagramGenerator generator) { | 107 public String getAxisLabel(DiagramGenerator generator) { |
108 if (yAxisLabel != null && !yAxisLabel.isEmpty()) { | |
109 return generator.msg(yAxisLabel, I18N_AXIS_LABEL_DEFAULT); | |
110 } | |
103 return generator.msg( | 111 return generator.msg( |
104 I18N_AXIS_LABEL, | 112 I18N_AXIS_LABEL, |
105 I18N_AXIS_LABEL_DEFAULT); | 113 I18N_AXIS_LABEL_DEFAULT); |
106 } | 114 } |
107 } | 115 } |