Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/LoadScenarioSelectLimit5.java @ 9406:55e3b1a8aa06
salix pdf export column added
author | gernotbelger |
---|---|
date | Wed, 15 Aug 2018 15:10:01 +0200 |
parents | a978b601a034 |
children | 3b188c34d422 |
rev | line source |
---|---|
9222 | 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 | |
9273 | 14 import org.dive4elements.artifactdatabase.data.StateData; |
9222 | 15 import org.dive4elements.artifacts.Artifact; |
16 import org.dive4elements.artifacts.CallContext; | |
9273 | 17 import org.dive4elements.artifacts.common.utils.XMLUtils; |
9222 | 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.w3c.dom.Element; | |
22 | |
23 /** State in which to fetch years for sedminent load calculation. */ | |
24 public class LoadScenarioSelectLimit5 extends DefaultState { | |
9321
a978b601a034
Salix: Fixed ArrrayoutOfBoundsException; minor cleanup
gernotbelger
parents:
9273
diff
changeset
|
25 |
9222 | 26 private static final long serialVersionUID = 1L; |
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) { | |
9273 | 42 |
43 // the client is expecting helper input. bad abstraction. the table does not appear, only because no columns are added. | |
44 // TODO Implement abstraction without helper on client side and then delete this method | |
9222 | 45 final String datakey = "sedimentheight"; |
46 try { | |
47 if (datakey.equals(name)) { | |
48 | |
49 final AddTableDataHelper helper = new AddTableDataHelper(creator, select, "cm", context.getMeta()); | |
9273 | 50 for (int i = -200; i < -100; i = i + 10) { |
9222 | 51 final Map<String, String> row = new HashMap<>(); |
52 row.put("cm", Integer.toString(i)); | |
53 helper.addRow(row); | |
54 } | |
55 helper.submitMapToXml(); | |
56 } | |
57 } | |
58 catch (final IllegalArgumentException iae) { | |
59 iae.printStackTrace(); | |
60 } | |
61 } | |
62 | |
63 @Override | |
9273 | 64 protected Element createData(final XMLUtils.ElementCreator cr, final Artifact artifact, final StateData data, final CallContext context) { |
65 return ScenarioTypeState.changeHeaderForCurrentState("state.uinfo.inundation.scenario.regional", data.getName(), cr, context); | |
66 } | |
9321
a978b601a034
Salix: Fixed ArrrayoutOfBoundsException; minor cleanup
gernotbelger
parents:
9273
diff
changeset
|
67 } |