comparison artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/LoadScenarioSelectLimit5.java @ 9222:5a0e8d76582e

uinfo.salix regional workflow
author gernotbelger
date Wed, 04 Jul 2018 13:06:28 +0200
parents
children c08d5cfa4981
comparison
equal deleted inserted replaced
9221:5c34fe17ef15 9222:5a0e8d76582e
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.salix;
10
11 import java.util.HashMap;
12 import java.util.Map;
13
14 import org.apache.log4j.Logger;
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;
19 import org.dive4elements.river.artifacts.states.DefaultState;
20 import org.w3c.dom.Element;
21
22 /** State in which to fetch years for sedminent load calculation. */
23 public class LoadScenarioSelectLimit5 extends DefaultState {
24 private static final long serialVersionUID = 1L;
25 /** The log used in this class. */
26 private static Logger log = Logger.getLogger(LoadScenarioSelectLimit5.class);
27
28 /**
29 * The default constructor that initializes an empty State object.
30 */
31 public LoadScenarioSelectLimit5() {
32 }
33
34 /** Year Select Widget. */
35 @Override
36 protected String getUIProvider() {
37 return "uinfo.sedimentheight_select.limit5";
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
44 try {
45 if (datakey.equals(name)) {
46
47 final AddTableDataHelper helper = new AddTableDataHelper(creator, select, "cm", context.getMeta());
48 // no input help wanted
49 // helper.addColumn(0, "pinfrom", "40", "common.client.ui.from", "ICON", "CENTER", "from");
50 // helper.addColumn(1, "pinto", "40", "common.client.ui.to", "ICON", "CENTER", "to");
51 // helper.addColumn(1, "cm", "60", "Delta [cm]", "INTEGER", "RIGHT", null);
52
53 for (int i = -200; i < 210; i = i + 10) {
54 final Map<String, String> row = new HashMap<>();
55 row.put("cm", Integer.toString(i));
56 helper.addRow(row);
57
58 }
59 helper.submitMapToXml();
60 }
61 }
62 catch (final IllegalArgumentException iae) {
63 iae.printStackTrace();
64 }
65 }
66
67 @Override
68 public boolean validate(final Artifact artifact) throws IllegalArgumentException {
69 return true;
70
71 }
72 }
73 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org