comparison artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixDeltaWtGenerator.java @ 9123:1cc7653ca84f

Cleanup of ChartGenerator and ChartGenerator2 code. Put some of the copy/pasted code into a common abstraction.
author gernotbelger
date Tue, 05 Jun 2018 19:21:16 +0200
parents 5e38e2924c07
children 094ed9d1f2ad
comparison
equal deleted inserted replaced
9122:b8e7f6becf78 9123:1cc7653ca84f
104 }; 104 };
105 } 105 }
106 106
107 107
108 @Override 108 @Override
109 protected String getDefaultChartTitle() { 109 protected String getDefaultChartTitle(final CallContext context) {
110 return msg(I18N_CHART_TITLE, I18N_CHART_TITLE); 110 return msg(I18N_CHART_TITLE, I18N_CHART_TITLE);
111 } 111 }
112 112
113 113
114 @Override 114 @Override
115 protected String getChartTitle() { 115 protected String getChartTitle(final CallContext context) {
116 return Resources.format( 116 return Resources.format(
117 context.getMeta(), 117 context.getMeta(),
118 I18N_CHART_TITLE, 118 I18N_CHART_TITLE,
119 "", 119 "",
120 FixChartGenerator 120 FixChartGenerator
121 .getCurrentKmFromRequest(request).doubleValue()); 121 .getCurrentKmFromRequest(getRequest()).doubleValue());
122 } 122 }
123 123
124 124
125 @Override 125 @Override
126 protected String getDefaultChartSubtitle() { 126 protected String getDefaultChartSubtitle(final CallContext context) {
127 FixAnalysisAccess access = new FixAnalysisAccess(artifact); 127 FixAnalysisAccess access = new FixAnalysisAccess(artifact);
128 DateRange dateRange = access.getDateRange(); 128 DateRange dateRange = access.getDateRange();
129 DateRange refRange = access.getReferencePeriod(); 129 DateRange refRange = access.getReferencePeriod();
130 return Resources.format( 130 return Resources.format(
131 context.getMeta(), 131 context.getMeta(),
138 refRange.getTo()); 138 refRange.getTo());
139 } 139 }
140 140
141 141
142 @Override 142 @Override
143 protected String getDefaultXAxisLabel() { 143 protected String getDefaultXAxisLabel(final CallContext context) {
144 return msg(I18N_XAXIS_LABEL, I18N_XAXIS_LABEL); 144 return msg(I18N_XAXIS_LABEL, I18N_XAXIS_LABEL);
145 } 145 }
146 146
147 @Override 147 @Override
148 protected String getDefaultYAxisLabel(int pos) { 148 protected String getDefaultYAxisLabel(int pos) {
169 log.debug("Theme description is: " 169 log.debug("Theme description is: "
170 + artifactFacet.getFacetDescription()); 170 + artifactFacet.getFacetDescription());
171 171
172 this.artifact = (D4EArtifact)artifactFacet.getArtifact(); 172 this.artifact = (D4EArtifact)artifactFacet.getArtifact();
173 173
174 final CallContext context = getContext();
175
174 if (name.contains(FIX_SECTOR_AVERAGE_DWT)) { 176 if (name.contains(FIX_SECTOR_AVERAGE_DWT)) {
175 doSectorAverageOut( 177 doSectorAverageOut(
176 (D4EArtifact) artifactFacet.getArtifact(), 178 (D4EArtifact) artifactFacet.getArtifact(),
177 artifactFacet.getData(context), 179 artifactFacet.getData(context),
178 artifactFacet.getFacetDescription(), 180 artifactFacet.getFacetDescription(),
386 if (!visible || !theme.parseShowPointLabel()) { 388 if (!visible || !theme.parseShowPointLabel()) {
387 log.debug("doQWDTextAnnotation: annotation not visible"); 389 log.debug("doQWDTextAnnotation: annotation not visible");
388 return; 390 return;
389 } 391 }
390 392
391 Locale locale = Resources.getLocale(context.getMeta()); 393 Locale locale = Resources.getLocale(getContext().getMeta());
392 NumberFormat nf = NumberFormat.getInstance(locale); 394 NumberFormat nf = NumberFormat.getInstance(locale);
393 395
394 List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>(); 396 List<XYTextAnnotation> textAnnos = new ArrayList<>();
395 397
396 for (int[] idxs: annoIdxMap.values()) { 398 for (int[] idxs: annoIdxMap.values()) {
397 399
398 double x = tsc.getXValue(idxs[0], idxs[1]); 400 double x = tsc.getXValue(idxs[0], idxs[1]);
399 401

http://dive4elements.wald.intevation.org