comparison artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/LoadSingleYearSelectState.java @ 9225:001a8ed1e71d

klasse vergessen
author gernotbelger
date Wed, 04 Jul 2018 17:13:31 +0200
parents
children f5cff8708531
comparison
equal deleted inserted replaced
9224:c3994657c15d 9225:001a8ed1e71d
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 LoadSingleYearSelectState extends DefaultState {
24 private static final long serialVersionUID = 1L;
25 /** The log used in this class. */
26 private static Logger log = Logger.getLogger(LoadSingleYearSelectState.class);
27
28 /**
29 * The default constructor that initializes an empty State object.
30 */
31 public LoadSingleYearSelectState() {
32 }
33
34 /** Year Select Widget. */
35 @Override
36 protected String getUIProvider() {
37 return "common.state.load_single_year_select";
38 }
39
40 @Override
41 protected void appendItems(final Artifact artifact, final ElementCreator creator, final String name, final CallContext context, final Element select) {
42 // TODO: MAKE DATASOURCE
43 try {
44 final String dataKeyofState = "singleyear";// siehe .xml
45 if (dataKeyofState.equals(name)) {
46
47 final AddTableDataHelper helper = new AddTableDataHelper(creator, select, "year", context.getMeta()); // "year" not to be confused with datakey
48
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 }
66 }
67 catch (final IllegalArgumentException iae) {
68 iae.printStackTrace();
69 }
70 }
71
72 }
73 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org