comparison gnv-artifacts/src/main/java/de/intevation/gnv/state/PreSettingsTransferCoordinateSelectionState.java @ 747:a5e860f17a52

Added an new State wich will handle the Display of Coordinatevalues and fetch given Inputparameters from the Presettings and copy them to the InputValues. gnv-artifacts/trunk@787 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Tue, 16 Mar 2010 13:02:56 +0000
parents
children 9a828e5a2390
comparison
equal deleted inserted replaced
746:b81f6f896668 747:a5e860f17a52
1 /**
2 *
3 */
4 package de.intevation.gnv.state;
5
6 import java.util.ArrayList;
7 import java.util.Collection;
8 import java.util.Map;
9
10 import org.w3c.dom.Element;
11 import org.w3c.dom.Node;
12
13 import de.intevation.artifactdatabase.Config;
14 import de.intevation.artifacts.CallContext;
15 import de.intevation.gnv.state.exception.StateException;
16
17 /**
18 * @author Tim Englich <tim.englich@intevation.de>
19 *
20 */
21 public class PreSettingsTransferCoordinateSelectionState extends CoordinateSelectionState {
22
23
24 /**
25 * The UID of this Class.
26 */
27 private static final long serialVersionUID = -3972304838976884048L;
28
29 private String transferPreSettingsName = null;
30
31 private String transferInputDataname = null;
32 /**
33 * Constructor
34 */
35 public PreSettingsTransferCoordinateSelectionState() {
36 super();
37 }
38
39 /**
40 * @see de.intevation.gnv.state.StateBase#initialize(java.lang.String, de.intevation.artifacts.CallContext)
41 */
42 @Override
43 public void initialize(String uuid, CallContext context)
44 throws StateException {
45 Map<String, InputData> preSettings = this.getPreSettings();
46 if (preSettings != null){
47 InputData ip = preSettings.get(transferPreSettingsName);
48 if (ip != null){
49 Collection<InputData> localInputdata = new ArrayList<InputData>(1);
50 localInputdata.add(new DefaultInputData(transferInputDataname,
51 ip.getValue()));
52 this.putInputData(localInputdata, uuid);
53 }
54 }
55
56 super.initialize(uuid, context);
57 }
58
59 /**
60 * @see de.intevation.gnv.state.StateBase#setup(org.w3c.dom.Node)
61 */
62 @Override
63 public void setup(Node configuration) {
64
65 Element preSettingsNode = (Element)Config.getNodeXPath(configuration,
66 "presettings-transfer");
67 if (preSettingsNode != null){
68 this.transferPreSettingsName = preSettingsNode.getAttribute("presetting");
69 this.transferInputDataname = preSettingsNode.getAttribute("inputvalue");
70 }
71 super.setup(configuration);
72 }
73
74
75
76 }

http://dive4elements.wald.intevation.org