diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WQAdapted.java @ 401:34de11dcf355

Small bugfix in the adapted WQ state and further i18n strings. flys-artifacts/trunk@1836 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 05 May 2011 12:34:53 +0000
parents 53cc794fee07
children e54053bc0e70
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WQAdapted.java	Thu May 05 12:31:28 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WQAdapted.java	Thu May 05 12:34:53 2011 +0000
@@ -28,6 +28,11 @@
     private static Logger logger = Logger.getLogger(WQAdapted.class);
 
 
+    public static final String FIELD_WQ_MODE = "wq_mode";
+
+    public static final String FIELD_WQ_VALUES = "wq_values";
+
+
     /**
      * This method creates one element for each gauge of the selected river that
      * is intersected by the given kilometer range. Each element is a tuple of
@@ -51,6 +56,42 @@
     {
         logger.debug("WQAdapted.createItems");
 
+        if (name != null && name.equals(FIELD_WQ_MODE)) {
+            return createModeItems(cr, artifact, name, context);
+        }
+        else if (name != null && name.equals(FIELD_WQ_VALUES)) {
+            return createValueItems(cr, artifact, name, context);
+        }
+        else {
+            logger.warn("Unknown data object: " + name);
+            return null;
+        }
+    }
+
+
+    protected Element[] createModeItems(
+        XMLUtils.ElementCreator cr,
+        Artifact    artifact,
+        String      name,
+        CallContext context)
+    {
+        logger.debug("WQAdapted.createModeItems");
+
+        Element w = createItem(cr, new String[] { "w", "W" });
+        Element q = createItem(cr, new String[] { "q", "Q" });
+
+        return new Element[] { w, q };
+    }
+
+
+    protected Element[] createValueItems(
+        XMLUtils.ElementCreator cr,
+        Artifact    artifact,
+        String      name,
+        CallContext context)
+    {
+        logger.debug("WQAdapted.createValueItems");
+
         FLYSArtifact flysArtifact = (FLYSArtifact) artifact;
 
         double[]    dist   = flysArtifact.getDistance();

http://dive4elements.wald.intevation.org