felix@2251: package de.intevation.flys.artifacts.states;
felix@2251: 
sascha@2254: import de.intevation.flys.artifacts.FLYSArtifact;
sascha@2254: 
sascha@2254: import de.intevation.flys.utils.FLYSUtils;
felix@2251: 
felix@2251: 
felix@2251: /**
felix@2306:  * Get me a double (km).
felix@2251:  */
felix@2251: public class EnterLocationState extends InputDoubleState {
felix@2251: 
felix@2306:     /** Provoke this kind of provider in the UI. */
felix@2251:     @Override
felix@2251:     protected String getUIProvider() {
felix@2251:         return "location_panel";
felix@2251:     }
felix@2251: 
felix@2251: 
felix@2306:     /** Allow from min km of river. */
felix@2251:     @Override
felix@2251:     protected Object getLower(FLYSArtifact flys) {
felix@2251:         double[] lowerUpper = FLYSUtils.getRiverMinMax(flys);
felix@2251: 
felix@2251:         return lowerUpper != null
felix@2251:             ? lowerUpper[0]
felix@2251:             : 0;
felix@2251:     }
felix@2251: 
felix@2251: 
felix@2306:     /** Allow to max km of river. */
felix@2251:     @Override
felix@2251:     protected Object getUpper(FLYSArtifact flys) {
felix@2251:         double[] lowerUpper = FLYSUtils.getRiverMinMax(flys);
felix@2251: 
felix@2251:         return lowerUpper != null
felix@2251:             ? lowerUpper[1]
felix@2251:             : 0;
felix@2251:     }
felix@2251: }
felix@2251: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :