comparison 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
comparison
equal deleted inserted replaced
920:a618dd6d80ea 921:610d0e0f4f85
23 import de.intevation.flys.artifacts.resources.Resources; 23 import de.intevation.flys.artifacts.resources.Resources;
24 24
25 /** 25 /**
26 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> 26 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
27 */ 27 */
28 public class WQSelect extends RangeState { 28 public class WQSelect extends DefaultState {
29 29
30 /** The logger used in this class.*/ 30 /** The logger used in this class.*/
31 private static Logger logger = Logger.getLogger(WQSelect.class); 31 private static Logger logger = Logger.getLogger(WQSelect.class);
32 32
33 33
214 return validateSingle(artifact, context); 214 return validateSingle(artifact, context);
215 } 215 }
216 else { 216 else {
217 return validateRange(artifact, context); 217 return validateRange(artifact, context);
218 } 218 }
219 }
220
221
222 protected boolean validateBounds(
223 double fromValid, double toValid,
224 double from, double to, double step)
225 throws IllegalArgumentException
226 {
227 logger.debug("RangeState.validateRange");
228
229 if (from < fromValid) {
230 logger.error(
231 "Invalid 'from'. " + from + " is smaller than " + fromValid);
232 throw new IllegalArgumentException("error_feed_from_out_of_range");
233 }
234 else if (to > toValid) {
235 logger.error(
236 "Invalid 'to'. " + to + " is bigger than " + toValid);
237 throw new IllegalArgumentException("error_feed_to_out_of_range");
238 }
239
240 return true;
219 } 241 }
220 242
221 243
222 protected boolean validateSingle(Artifact artifact, CallContext context) 244 protected boolean validateSingle(Artifact artifact, CallContext context)
223 throws IllegalArgumentException 245 throws IllegalArgumentException

http://dive4elements.wald.intevation.org