Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/LoadScenarioSelect.java @ 9559:ba0561906f81
Uinfo inundation duration workflow (vegetation zones, scenario), wms-config changed
author | gernotbelger |
---|---|
date | Wed, 24 Oct 2018 18:40:38 +0200 |
parents | 73819a194bfd |
children |
comparison
equal
deleted
inserted
replaced
9558:709a73badd48 | 9559:ba0561906f81 |
---|---|
6 * documentation coming with Dive4Elements River for details. | 6 * documentation coming with Dive4Elements River for details. |
7 */ | 7 */ |
8 | 8 |
9 package org.dive4elements.river.artifacts.uinfo.inundationduration; | 9 package org.dive4elements.river.artifacts.uinfo.inundationduration; |
10 | 10 |
11 import java.util.HashMap; | 11 import org.dive4elements.river.artifacts.uinfo.inundationduration.UedauernConfiguration.YearType; |
12 import java.util.Map; | |
13 | |
14 import org.dive4elements.artifactdatabase.data.StateData; | |
15 import org.dive4elements.artifacts.Artifact; | |
16 import org.dive4elements.artifacts.CallContext; | |
17 import org.dive4elements.artifacts.common.utils.XMLUtils; | |
18 import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator; | |
19 import org.dive4elements.river.artifacts.states.AddTableDataHelper; | |
20 import org.dive4elements.river.artifacts.states.DefaultState; | |
21 import org.dive4elements.river.artifacts.uinfo.salix.ScenarioTypeState; | |
22 import org.w3c.dom.Element; | |
23 | 12 |
24 /** State in which to fetch years for sedminent load calculation. */ | 13 /** State in which to fetch years for sedminent load calculation. */ |
25 public class LoadScenarioSelect extends DefaultState { | 14 public class LoadScenarioSelect extends AbstractYearEpochUrlState { |
26 | 15 |
27 private static final long serialVersionUID = 1L; | 16 private static final long serialVersionUID = 1L; |
28 | 17 |
29 /** | 18 /** |
30 * The default constructor that initializes an empty State object. | 19 * The default constructor that initializes an empty State object. |
20 * | |
21 * @return | |
31 */ | 22 */ |
32 public LoadScenarioSelect() { | 23 public LoadScenarioSelect() { |
33 } | 24 super(YearType.szenario); |
34 | |
35 /** Year Select Widget. */ | |
36 @Override | |
37 protected String getUIProvider() { | |
38 return "uinfo.sedimentheight_select"; | |
39 } | 25 } |
40 | 26 |
41 @Override | 27 @Override |
42 protected void appendItems(final Artifact artifact, final ElementCreator creator, final String name, final CallContext context, final Element select) { | 28 protected String getUIProvider() { |
43 final String datakey = "sedimentheight"; | 29 return "uinfo.inundation.szenario"; |
44 try { | |
45 if (datakey.equals(name)) { | |
46 | |
47 final AddTableDataHelper helper = new AddTableDataHelper(creator, select, "cm", context.getMeta()); | |
48 | |
49 helper.addColumn(0, "pinfrom", "60", "common.client.ui.selection", "ICON", "CENTER", "from"); | |
50 helper.addColumn(1, "cm", "60", "uinfo_select_delta_w_column", "INTEGER", "RIGHT", null); | |
51 | |
52 for (int i = -200; i < 210; i = i + 10) { | |
53 final Map<String, String> row = new HashMap<>(); | |
54 row.put("cm", Integer.toString(i)); | |
55 helper.addRow(row); | |
56 | |
57 } | |
58 helper.submitMapToXml(); | |
59 } | |
60 } | |
61 catch (final IllegalArgumentException iae) { | |
62 iae.printStackTrace(); | |
63 } | |
64 } | 30 } |
65 | 31 |
66 @Override | 32 @Override |
67 public boolean validate(final Artifact artifact) throws IllegalArgumentException { | 33 protected String getDatakey() { |
68 return true; | 34 return "inundation_scenario"; |
69 } | 35 } |
70 | 36 |
71 @Override | |
72 protected Element createData(final XMLUtils.ElementCreator cr, final Artifact artifact, final StateData data, final CallContext context) { | |
73 return ScenarioTypeState.changeHeaderForCurrentState("state.uinfo.inundation.scenario", data.getName(), cr, context); | |
74 } | |
75 } | 37 } |
76 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |