9063
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
|
2 * Software engineering by Intevation GmbH |
|
3 * |
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
|
6 * documentation coming with Dive4Elements River for details. |
|
7 */ |
|
8 |
|
9 package org.dive4elements.river.artifacts.uinfo.inundationduration; |
|
10 |
9078
|
11 import java.util.HashMap; |
|
12 import java.util.Map; |
|
13 |
9063
|
14 import org.apache.log4j.Logger; |
|
15 import org.dive4elements.artifacts.Artifact; |
9078
|
16 import org.dive4elements.artifacts.CallContext; |
|
17 import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator; |
|
18 import org.dive4elements.river.artifacts.states.AddTableDataHelper; |
9063
|
19 import org.dive4elements.river.artifacts.states.DefaultState; |
9078
|
20 import org.w3c.dom.Element; |
9063
|
21 |
|
22 /** State in which to fetch years for sedminent load calculation. */ |
|
23 public class LoadScenarioSelect extends DefaultState { |
|
24 private static final long serialVersionUID = 1L; |
|
25 /** The log used in this class. */ |
|
26 private static Logger log = Logger.getLogger(LoadScenarioSelect.class); |
|
27 |
|
28 /** |
|
29 * The default constructor that initializes an empty State object. |
|
30 */ |
|
31 public LoadScenarioSelect() { |
|
32 } |
|
33 |
|
34 /** Year Select Widget. */ |
|
35 @Override |
|
36 protected String getUIProvider() { |
9078
|
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 } |
9063
|
64 } |
|
65 |
|
66 @Override |
|
67 public boolean validate(final Artifact artifact) throws IllegalArgumentException { |
|
68 return true; |
9222
|
69 |
9063
|
70 } |
|
71 } |
|
72 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |