Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/LoadScenarioSelectLimit5.java @ 9273:1b2623dff742
salix another review
author | gernotbelger |
---|---|
date | Thu, 19 Jul 2018 17:32:27 +0200 |
parents | c08d5cfa4981 |
children | a978b601a034 |
comparison
equal
deleted
inserted
replaced
9272:1d59da89b00d | 9273:1b2623dff742 |
---|---|
10 | 10 |
11 import java.util.HashMap; | 11 import java.util.HashMap; |
12 import java.util.Map; | 12 import java.util.Map; |
13 | 13 |
14 import org.apache.log4j.Logger; | 14 import org.apache.log4j.Logger; |
15 import org.dive4elements.artifactdatabase.data.StateData; | |
15 import org.dive4elements.artifacts.Artifact; | 16 import org.dive4elements.artifacts.Artifact; |
16 import org.dive4elements.artifacts.CallContext; | 17 import org.dive4elements.artifacts.CallContext; |
18 import org.dive4elements.artifacts.common.utils.XMLUtils; | |
17 import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator; | 19 import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator; |
18 import org.dive4elements.river.artifacts.states.AddTableDataHelper; | 20 import org.dive4elements.river.artifacts.states.AddTableDataHelper; |
19 import org.dive4elements.river.artifacts.states.DefaultState; | 21 import org.dive4elements.river.artifacts.states.DefaultState; |
20 import org.w3c.dom.Element; | 22 import org.w3c.dom.Element; |
21 | 23 |
37 return "uinfo.sedimentheight_select.limit5"; | 39 return "uinfo.sedimentheight_select.limit5"; |
38 } | 40 } |
39 | 41 |
40 @Override | 42 @Override |
41 protected void appendItems(final Artifact artifact, final ElementCreator creator, final String name, final CallContext context, final Element select) { | 43 protected void appendItems(final Artifact artifact, final ElementCreator creator, final String name, final CallContext context, final Element select) { |
44 | |
45 // the client is expecting helper input. bad abstraction. the table does not appear, only because no columns are added. | |
46 // TODO Implement abstraction without helper on client side and then delete this method | |
42 final String datakey = "sedimentheight"; | 47 final String datakey = "sedimentheight"; |
43 | |
44 try { | 48 try { |
45 if (datakey.equals(name)) { | 49 if (datakey.equals(name)) { |
46 | 50 |
47 final AddTableDataHelper helper = new AddTableDataHelper(creator, select, "cm", context.getMeta()); | 51 final AddTableDataHelper helper = new AddTableDataHelper(creator, select, "cm", context.getMeta()); |
48 for (int i = -200; i < 210; i = i + 10) { | 52 for (int i = -200; i < -100; i = i + 10) { |
49 final Map<String, String> row = new HashMap<>(); | 53 final Map<String, String> row = new HashMap<>(); |
50 row.put("cm", Integer.toString(i)); | 54 row.put("cm", Integer.toString(i)); |
51 helper.addRow(row); | 55 helper.addRow(row); |
52 } | 56 } |
53 helper.submitMapToXml(); | 57 helper.submitMapToXml(); |
57 iae.printStackTrace(); | 61 iae.printStackTrace(); |
58 } | 62 } |
59 } | 63 } |
60 | 64 |
61 @Override | 65 @Override |
62 public boolean validate(final Artifact artifact) throws IllegalArgumentException { | 66 protected Element createData(final XMLUtils.ElementCreator cr, final Artifact artifact, final StateData data, final CallContext context) { |
63 return true; | 67 return ScenarioTypeState.changeHeaderForCurrentState("state.uinfo.inundation.scenario.regional", data.getName(), cr, context); |
68 } | |
64 | 69 |
65 } | |
66 } | 70 } |
67 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : | 71 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |