9225
|
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 |
9245
|
11 import java.util.List; |
9225
|
12 |
|
13 import org.apache.log4j.Logger; |
|
14 import org.dive4elements.artifacts.Artifact; |
|
15 import org.dive4elements.artifacts.CallContext; |
|
16 import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator; |
|
17 import org.dive4elements.river.artifacts.states.DefaultState; |
9245
|
18 import org.dive4elements.river.artifacts.uinfo.UINFOArtifact; |
|
19 import org.dive4elements.river.model.BedHeight; |
9225
|
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 |
9245
|
43 final String dataKeyofState = "singleyear";// siehe .xml |
|
44 try { |
|
45 if (dataKeyofState.equals(name)) { |
|
46 final SalixLineAccess access = new SalixLineAccess((UINFOArtifact) artifact); |
|
47 final List<BedHeight> bhs = BedHeight.getBedHeightYear(access.getRiver(), access.getLowerKm(), access.getUpperKm()); |
|
48 LoadSingleEpochSelectState.makeDataSourceYearEpoch(artifact, creator, select, context, bhs); |
9225
|
49 } |
|
50 } |
9245
|
51 catch ( |
|
52 |
|
53 final IllegalArgumentException iae) { |
9225
|
54 iae.printStackTrace(); |
|
55 } |
9245
|
56 |
9225
|
57 } |
|
58 } |
|
59 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |