annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/EnterLocationState.java @ 5649:066f3a2f34d6

Minor refactoring.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 10 Apr 2013 13:11:45 +0200
parents cc6b8af44728
children
rev   line source
2251
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.states;
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
2
2254
ee7e774ed5b4 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2251
diff changeset
3 import de.intevation.flys.artifacts.FLYSArtifact;
ee7e774ed5b4 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2251
diff changeset
4
ee7e774ed5b4 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2251
diff changeset
5 import de.intevation.flys.utils.FLYSUtils;
2251
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
6
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
7
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
8 /**
2306
cc6b8af44728 Prepare new data input for reference curves 'Ziel' locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2254
diff changeset
9 * Get me a double (km).
2251
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
10 */
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
11 public class EnterLocationState extends InputDoubleState {
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
12
2306
cc6b8af44728 Prepare new data input for reference curves 'Ziel' locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2254
diff changeset
13 /** Provoke this kind of provider in the UI. */
2251
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
14 @Override
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
15 protected String getUIProvider() {
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
16 return "location_panel";
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
17 }
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
18
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
19
2306
cc6b8af44728 Prepare new data input for reference curves 'Ziel' locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2254
diff changeset
20 /** Allow from min km of river. */
2251
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
21 @Override
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
22 protected Object getLower(FLYSArtifact flys) {
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
23 double[] lowerUpper = FLYSUtils.getRiverMinMax(flys);
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
24
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
25 return lowerUpper != null
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
26 ? lowerUpper[0]
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
27 : 0;
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
28 }
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
29
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
30
2306
cc6b8af44728 Prepare new data input for reference curves 'Ziel' locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2254
diff changeset
31 /** Allow to max km of river. */
2251
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
32 @Override
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
33 protected Object getUpper(FLYSArtifact flys) {
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
34 double[] lowerUpper = FLYSUtils.getRiverMinMax(flys);
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
35
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
36 return lowerUpper != null
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
37 ? lowerUpper[1]
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
38 : 0;
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
39 }
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
40 }
c9c788eea200 Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
41 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org