comparison flys-artifacts/src/main/java/de/intevation/flys/exports/AbstractExporter.java @ 2284:5d1ba04d2f68

Refactored Formatter access to ease reuse. flys-artifacts/trunk@3946 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 07 Feb 2012 09:54:29 +0000
parents 65dac9cf6ff5
children fe987587ebc9
comparison
equal deleted inserted replaced
2283:d4330439be3a 2284:5d1ba04d2f68
2 2
3 import java.io.IOException; 3 import java.io.IOException;
4 import java.io.OutputStream; 4 import java.io.OutputStream;
5 import java.io.OutputStreamWriter; 5 import java.io.OutputStreamWriter;
6 6
7 import java.text.NumberFormat;
8
7 import org.w3c.dom.Document; 9 import org.w3c.dom.Document;
8 10
9 import org.apache.log4j.Logger; 11 import org.apache.log4j.Logger;
10 12
11 import au.com.bytecode.opencsv.CSVWriter; 13 import au.com.bytecode.opencsv.CSVWriter;
18 20
19 import de.intevation.artifacts.common.ArtifactNamespaceContext; 21 import de.intevation.artifacts.common.ArtifactNamespaceContext;
20 import de.intevation.artifacts.common.utils.XMLUtils; 22 import de.intevation.artifacts.common.utils.XMLUtils;
21 23
22 import de.intevation.flys.artifacts.resources.Resources; 24 import de.intevation.flys.artifacts.resources.Resources;
25
26 import de.intevation.flys.utils.Formatter;
23 27
24 28
25 /** 29 /**
26 * An abstract exporter that implements some basic methods for exporting data of 30 * An abstract exporter that implements some basic methods for exporting data of
27 * artifacts. 31 * artifacts.
166 * @param facet The desired facet. 170 * @param facet The desired facet.
167 * 171 *
168 * @return true, if <i>facet</i> is valid, otherwise false. 172 * @return true, if <i>facet</i> is valid, otherwise false.
169 */ 173 */
170 protected boolean isFacetValid(String facet) { 174 protected boolean isFacetValid(String facet) {
171 logger.debug("AbstractExporter.isFacetValid"); 175 logger.debug("AbstractExporter.isFacetValid : " + facet + " (" + getFacet() + ")" );
172 176
173 String thisFacet = getFacet(); 177 String thisFacet = getFacet();
174 178
175 if (thisFacet == null || thisFacet.length() == 0) { 179 if (thisFacet == null || thisFacet.length() == 0) {
176 return false; 180 return false;
261 * <i>Settings</i> object. 265 * <i>Settings</i> object.
262 */ 266 */
263 public void setSettings(Settings settings) { 267 public void setSettings(Settings settings) {
264 // do nothing 268 // do nothing
265 } 269 }
270
271
272 /**
273 * Returns the number formatter for kilometer values.
274 *
275 * @return the number formatter for kilometer values.
276 */
277 protected NumberFormat getKmFormatter() {
278 return Formatter.getWaterlevelKM(context);
279 }
280
281
282 /**
283 * Returns the number formatter for W values.
284 *
285 * @return the number formatter for W values.
286 */
287 protected NumberFormat getWFormatter() {
288 return Formatter.getWaterlevelW(context);
289 }
290
291
292 /**
293 * Returns the number formatter for Q values.
294 *
295 * @return the number formatter for Q values.
296 */
297 protected NumberFormat getQFormatter() {
298 return Formatter.getWaterlevelQ(context);
299 }
266 } 300 }
267 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 301 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org