Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/LoadEpochSelect.java @ 9079:aafae1ab25f0
epoch-panels, single-input-panels
author | gernotbelger |
---|---|
date | Wed, 23 May 2018 17:30:24 +0200 |
parents | b5d7a9d79837 |
children |
comparison
equal
deleted
inserted
replaced
9078:fc02833dbcc1 | 9079:aafae1ab25f0 |
---|---|
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.List; | |
13 import java.util.Map; | |
14 | |
11 import org.apache.log4j.Logger; | 15 import org.apache.log4j.Logger; |
16 import org.dive4elements.artifacts.Artifact; | |
17 import org.dive4elements.artifacts.CallContext; | |
18 import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator; | |
19 import org.dive4elements.river.artifacts.D4EArtifact; | |
20 import org.dive4elements.river.artifacts.access.RiverAccess; | |
21 import org.dive4elements.river.artifacts.model.CollisionHibernateFactory; | |
22 import org.dive4elements.river.artifacts.states.AddTableDataHelper; | |
12 import org.dive4elements.river.artifacts.states.DefaultState; | 23 import org.dive4elements.river.artifacts.states.DefaultState; |
24 import org.dive4elements.river.model.sinfo.Collision; | |
25 import org.w3c.dom.Element; | |
13 | 26 |
14 public class LoadEpochSelect extends DefaultState { | 27 public class LoadEpochSelect extends DefaultState { |
15 /** The log used in this class. */ | 28 /** The log used in this class. */ |
16 private static Logger log = Logger.getLogger(LoadEpochSelect.class); | 29 private static Logger log = Logger.getLogger(LoadEpochSelect.class); |
17 | 30 |
23 | 36 |
24 @Override | 37 @Override |
25 protected String getUIProvider() { | 38 protected String getUIProvider() { |
26 return "uinfo.inundationduration.load_totalepoch_select"; | 39 return "uinfo.inundationduration.load_totalepoch_select"; |
27 } | 40 } |
41 | |
42 @Override | |
43 protected void appendItems(final Artifact artifact, final ElementCreator creator, final String name, final CallContext context, final Element select) { | |
44 final String dataKey = "totalepoch"; | |
45 try { | |
46 if (dataKey.equals(name)) { | |
47 | |
48 final AddTableDataHelper helper = new AddTableDataHelper(creator, select, "year", context.getMeta()); // pinKeycolum; nicht zu verweschseln mit | |
49 // datakey..artifact. | |
50 | |
51 // helper.addColumn(0, "pinfrom", "60", "common.client.ui.selection", "ICON", "CENTER", "from"); | |
52 helper.addColumn(0, "year", "60", "year", "INTEGER", "LEFT", null); // Keine Pins | |
53 | |
54 final RiverAccess access = new RiverAccess((D4EArtifact) artifact); | |
55 final List<Collision> collisions = CollisionHibernateFactory.getCollisionsByRiver(access.getRiver());// TODO: DATASOURCE?! Has to be | |
56 // uinfo.inundation_duration | |
57 // (Überflutungsdauern Aue) irgendwas... | |
58 | |
59 for (final Collision coll : collisions) { | |
60 final Integer year = coll.getYear(); | |
61 final Map<String, String> row = new HashMap<>(); | |
62 row.put("year", year.toString()); // Nullpointer? | |
63 helper.addRow(row); | |
64 | |
65 } | |
66 helper.submitMapToXml(); | |
67 } | |
68 } | |
69 catch (final IllegalArgumentException iae) { | |
70 iae.printStackTrace(); | |
71 } | |
72 } | |
73 | |
28 } | 74 } |