diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WQSelect.java @ 921:610d0e0f4f85

#159 Modifications in the transition model to support a state with a kilometer range input only. flys-artifacts/trunk@2270 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 30 Jun 2011 11:32:17 +0000
parents 627be3ca1ab6
children eccf966fb677
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WQSelect.java	Wed Jun 29 09:00:31 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WQSelect.java	Thu Jun 30 11:32:17 2011 +0000
@@ -25,7 +25,7 @@
 /**
  * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
-public class WQSelect extends RangeState {
+public class WQSelect extends DefaultState {
 
     /** The logger used in this class.*/
     private static Logger logger = Logger.getLogger(WQSelect.class);
@@ -219,6 +219,28 @@
     }
 
 
+    protected boolean validateBounds(
+        double fromValid, double toValid,
+        double from,      double to,      double step)
+    throws IllegalArgumentException
+    {
+        logger.debug("RangeState.validateRange");
+
+        if (from < fromValid) {
+            logger.error(
+                "Invalid 'from'. " + from + " is smaller than " + fromValid);
+            throw new IllegalArgumentException("error_feed_from_out_of_range");
+        }
+        else if (to > toValid) {
+            logger.error(
+                "Invalid 'to'. " + to + " is bigger than " + toValid);
+            throw new IllegalArgumentException("error_feed_to_out_of_range");
+        }
+
+        return true;
+    }
+
+
     protected boolean validateSingle(Artifact artifact, CallContext context)
     throws    IllegalArgumentException
     {

http://dive4elements.wald.intevation.org