Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/LoadScenarioSelect.java @ 9078:fc02833dbcc1
SingleInputItem abstract
author | gernotbelger |
---|---|
date | Tue, 22 May 2018 17:44:05 +0200 |
parents | b5d7a9d79837 |
children | 5a0e8d76582e |
comparison
equal
deleted
inserted
replaced
9077:2b13de1b0897 | 9078:fc02833dbcc1 |
---|---|
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; | |
12 import java.util.Map; | |
13 | |
11 import org.apache.log4j.Logger; | 14 import org.apache.log4j.Logger; |
12 import org.dive4elements.artifacts.Artifact; | 15 import org.dive4elements.artifacts.Artifact; |
16 import org.dive4elements.artifacts.CallContext; | |
17 import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator; | |
18 import org.dive4elements.river.artifacts.states.AddTableDataHelper; | |
13 import org.dive4elements.river.artifacts.states.DefaultState; | 19 import org.dive4elements.river.artifacts.states.DefaultState; |
20 import org.w3c.dom.Element; | |
14 | 21 |
15 /** State in which to fetch years for sedminent load calculation. */ | 22 /** State in which to fetch years for sedminent load calculation. */ |
16 public class LoadScenarioSelect extends DefaultState { | 23 public class LoadScenarioSelect extends DefaultState { |
17 private static final long serialVersionUID = 1L; | 24 private static final long serialVersionUID = 1L; |
18 /** The log used in this class. */ | 25 /** The log used in this class. */ |
25 } | 32 } |
26 | 33 |
27 /** Year Select Widget. */ | 34 /** Year Select Widget. */ |
28 @Override | 35 @Override |
29 protected String getUIProvider() { | 36 protected String getUIProvider() { |
30 return "uinfo.sedimentheight_select"; // TODO: eigenes Panel oder allgemeineren Code und an SCENARIO AUS DB ANPASSEN! | 37 return "uinfo.sedimentheight_select"; |
38 } | |
39 | |
40 @Override | |
41 protected void appendItems(final Artifact artifact, final ElementCreator creator, final String name, final CallContext context, final Element select) { | |
42 final String datakey = "sedimentheight"; | |
43 try { | |
44 if (datakey.equals(name)) { | |
45 | |
46 final AddTableDataHelper helper = new AddTableDataHelper(creator, select, "cm", context.getMeta()); | |
47 | |
48 helper.addColumn(0, "pinfrom", "40", "common.client.ui.from", "ICON", "CENTER", "from"); | |
49 // helper.addColumn(1, "pinto", "40", "common.client.ui.to", "ICON", "CENTER", "to"); | |
50 helper.addColumn(1, "cm", "60", "Delta [cm]", "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 } | |
31 } | 64 } |
32 | 65 |
33 @Override | 66 @Override |
34 public boolean validate(final Artifact artifact) throws IllegalArgumentException { | 67 public boolean validate(final Artifact artifact) throws IllegalArgumentException { |
35 return true; | 68 return true; |