comparison gwt-client/src/main/java/org/dive4elements/river/client/server/ChartServiceHelper.java @ 9104:07d51fd4864c

Added metadata subtitle to all chart export
author gernotbelger
date Tue, 29 May 2018 11:35:44 +0200
parents 238fc722f87a
children 4809e23ffd27
comparison
equal deleted inserted replaced
9103:e68d4a10c308 9104:07d51fd4864c
60 60
61 Element attributes = ec.create("attributes"); 61 Element attributes = ec.create("attributes");
62 62
63 appendChartSize(req, attributes, ec); 63 appendChartSize(req, attributes, ec);
64 appendFormat(req, attributes, ec); 64 appendFormat(req, attributes, ec);
65 appendExport(req, attributes, ec);
65 appendXRange(req, attributes, ec); 66 appendXRange(req, attributes, ec);
66 appendYRange(req, attributes, ec); 67 appendYRange(req, attributes, ec);
67 appendCurrentKm(req, attributes, ec); 68 appendCurrentKm(req, attributes, ec);
68 69
69 doc.appendChild(attributes); 70 doc.appendChild(attributes);
172 * 173 *
173 * @param req The request object that might contain the chart format. 174 * @param req The request object that might contain the chart format.
174 * @param doc The attribute document used to adjust chart settings. 175 * @param doc The attribute document used to adjust chart settings.
175 * @param ec The ElementCreator that might be used to create new Elements. 176 * @param ec The ElementCreator that might be used to create new Elements.
176 */ 177 */
177 protected static void appendFormat( 178 private static void appendFormat(
178 Map<String, String> req, 179 Map<String, String> req,
179 Element attributes, 180 Element attributes,
180 ElementCreator ec 181 ElementCreator ec
181 182
182 ) { 183 ) {
191 ec.addAttr(format, "value", formatStr, true); 192 ec.addAttr(format, "value", formatStr, true);
192 193
193 attributes.appendChild(format); 194 attributes.appendChild(format);
194 } 195 }
195 196
197 /**
198 * This method extracts the export string from request object and appends
199 * those format - if existing - to the attribute document used to adjust
200 * the chart settings.
201 *
202 * @param req The request object that might contain the chart export flag.
203 * @param doc The attribute document used to adjust chart settings.
204 * @param ec The ElementCreator that might be used to create new Elements.
205 */
206 private static void appendExport( final Map<String, String> req, final Element attributes, final ElementCreator ec ) {
207
208 final String exportStr = req.get("export");
209 if (exportStr == null || exportStr.isEmpty())
210 return;
211
212 final Element format = ec.create("export");
213 ec.addAttr(format, "value", exportStr, true);
214
215 attributes.appendChild(format);
216 }
196 217
197 /** 218 /**
198 * This method extracts the current km for the chart from request object and 219 * This method extracts the current km for the chart from request object and
199 * appends this km - if it exists - to the attribute document used to 220 * appends this km - if it exists - to the attribute document used to
200 * adjust the chart settings. 221 * adjust the chart settings.

http://dive4elements.wald.intevation.org