Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/LoadSingleYearSelectState.java @ 9245:f5cff8708531
bedheight datasource for salix.historical
author | gernotbelger |
---|---|
date | Wed, 11 Jul 2018 14:45:01 +0200 |
parents | 001a8ed1e71d |
children | a978b601a034 |
comparison
equal
deleted
inserted
replaced
9244:b9505aa78cdd | 9245:f5cff8708531 |
---|---|
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.salix; | 9 package org.dive4elements.river.artifacts.uinfo.salix; |
10 | 10 |
11 import java.util.HashMap; | 11 import java.util.List; |
12 import java.util.Map; | |
13 | 12 |
14 import org.apache.log4j.Logger; | 13 import org.apache.log4j.Logger; |
15 import org.dive4elements.artifacts.Artifact; | 14 import org.dive4elements.artifacts.Artifact; |
16 import org.dive4elements.artifacts.CallContext; | 15 import org.dive4elements.artifacts.CallContext; |
17 import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator; | 16 import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator; |
18 import org.dive4elements.river.artifacts.states.AddTableDataHelper; | |
19 import org.dive4elements.river.artifacts.states.DefaultState; | 17 import org.dive4elements.river.artifacts.states.DefaultState; |
18 import org.dive4elements.river.artifacts.uinfo.UINFOArtifact; | |
19 import org.dive4elements.river.model.BedHeight; | |
20 import org.w3c.dom.Element; | 20 import org.w3c.dom.Element; |
21 | 21 |
22 /** State in which to fetch years for sedminent load calculation. */ | 22 /** State in which to fetch years for sedminent load calculation. */ |
23 public class LoadSingleYearSelectState extends DefaultState { | 23 public class LoadSingleYearSelectState extends DefaultState { |
24 private static final long serialVersionUID = 1L; | 24 private static final long serialVersionUID = 1L; |
37 return "common.state.load_single_year_select"; | 37 return "common.state.load_single_year_select"; |
38 } | 38 } |
39 | 39 |
40 @Override | 40 @Override |
41 protected void appendItems(final Artifact artifact, final ElementCreator creator, final String name, final CallContext context, final Element select) { | 41 protected void appendItems(final Artifact artifact, final ElementCreator creator, final String name, final CallContext context, final Element select) { |
42 // TODO: MAKE DATASOURCE | 42 |
43 final String dataKeyofState = "singleyear";// siehe .xml | |
43 try { | 44 try { |
44 final String dataKeyofState = "singleyear";// siehe .xml | |
45 if (dataKeyofState.equals(name)) { | 45 if (dataKeyofState.equals(name)) { |
46 | 46 final SalixLineAccess access = new SalixLineAccess((UINFOArtifact) artifact); |
47 final AddTableDataHelper helper = new AddTableDataHelper(creator, select, "year", context.getMeta()); // "year" not to be confused with datakey | 47 final List<BedHeight> bhs = BedHeight.getBedHeightYear(access.getRiver(), access.getLowerKm(), access.getUpperKm()); |
48 | 48 LoadSingleEpochSelectState.makeDataSourceYearEpoch(artifact, creator, select, context, bhs); |
49 helper.addColumn(0, "pinfrom", "60", "common.client.ui.selection", "ICON", "CENTER", "from"); | |
50 helper.addColumn(1, "year", "60", "year", "INTEGER", "LEFT", null); | |
51 helper.addColumn(2, "sounding", "200", "uinfo.salix.soundings", "STRING", "LEFT", null); | |
52 // TODO: MAKE DATASOURCE | |
53 // final CollisionAccess access = new CollisionAccess((SINFOArtifact) artifact); // TODO: MAKE DATASOURCE | |
54 // TODO: MAKE DATASOURCE | |
55 // final List<Collision> collisions = CollisionHibernateFactory.getCollisionsByRiver(access.getRiver()); | |
56 // for (final Collision coll : collisions) { | |
57 for (int i = 0; i < 3; i++) {// : Collision.getYearsOfRiver(access.getRiver())) { | |
58 // final Integer year = coll.getYear(); | |
59 final Map<String, String> row = new HashMap<>(); | |
60 row.put("year", String.valueOf(1995 + i)); // Nullpointer? | |
61 row.put("sounding", "TODO: Peilungen für das Jahr in dieser Zelle auflisten."); | |
62 helper.addRow(row); | |
63 } | |
64 helper.submitMapToXml(); | |
65 } | 49 } |
66 } | 50 } |
67 catch (final IllegalArgumentException iae) { | 51 catch ( |
52 | |
53 final IllegalArgumentException iae) { | |
68 iae.printStackTrace(); | 54 iae.printStackTrace(); |
69 } | 55 } |
56 | |
70 } | 57 } |
71 | |
72 } | 58 } |
73 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : | 59 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |