Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/LocationSelect.java @ 679:9a035ef7b595
The state that is used to enter locations writes the river's range into the DESCRIBE now.
flys-artifacts/trunk@2103 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 14 Jun 2011 10:38:00 +0000 |
parents | 929137ee8154 |
children | 610d0e0f4f85 |
comparison
equal
deleted
inserted
replaced
678:19a3185822a4 | 679:9a035ef7b595 |
---|---|
2 | 2 |
3 import gnu.trove.TDoubleArrayList; | 3 import gnu.trove.TDoubleArrayList; |
4 | 4 |
5 import org.apache.log4j.Logger; | 5 import org.apache.log4j.Logger; |
6 | 6 |
7 import org.w3c.dom.Element; | |
8 | |
7 import de.intevation.artifacts.Artifact; | 9 import de.intevation.artifacts.Artifact; |
8 import de.intevation.artifacts.CallContext; | 10 import de.intevation.artifacts.CallContext; |
11 | |
12 import de.intevation.artifacts.common.utils.XMLUtils; | |
9 | 13 |
10 import de.intevation.artifactdatabase.data.StateData; | 14 import de.intevation.artifactdatabase.data.StateData; |
11 | 15 |
12 import de.intevation.flys.artifacts.FLYSArtifact; | 16 import de.intevation.flys.artifacts.FLYSArtifact; |
13 | 17 |
34 | 38 |
35 | 39 |
36 @Override | 40 @Override |
37 protected String getUIProvider() { | 41 protected String getUIProvider() { |
38 return "location_panel"; | 42 return "location_panel"; |
43 } | |
44 | |
45 | |
46 @Override | |
47 protected Element[] createItems( | |
48 XMLUtils.ElementCreator cr, | |
49 Artifact artifact, | |
50 String name, | |
51 CallContext context) | |
52 { | |
53 double[] minmax = getMinMaxDistance(artifact); | |
54 | |
55 double minVal = Double.MIN_VALUE; | |
56 double maxVal = Double.MAX_VALUE; | |
57 | |
58 if (minmax != null) { | |
59 minVal = minmax[0]; | |
60 maxVal = minmax[1]; | |
61 } | |
62 else { | |
63 logger.warn("Could not read min/max distance values!"); | |
64 } | |
65 | |
66 if (name.equals(FIELD_LOCATIONS)) { | |
67 Element min = createItem( | |
68 cr, | |
69 new String[] {"min", new Double(minVal).toString()}); | |
70 | |
71 Element max = createItem( | |
72 cr, | |
73 new String[] {"max", new Double(maxVal).toString()}); | |
74 | |
75 return new Element[] { min, max }; | |
76 } | |
77 | |
78 return null; | |
39 } | 79 } |
40 | 80 |
41 | 81 |
42 @Override | 82 @Override |
43 public boolean validate(Artifact artifact, CallContext context) | 83 public boolean validate(Artifact artifact, CallContext context) |