9237
|
1 /** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde |
|
2 * Software engineering by |
|
3 * Björnsen Beratende Ingenieure GmbH |
|
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt |
|
5 * |
|
6 * This file is Free Software under the GNU AGPL (>=v3) |
|
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
|
8 * documentation coming with Dive4Elements River for details. |
|
9 */ |
|
10 package org.dive4elements.river.artifacts.uinfo.salix; |
|
11 |
|
12 import org.dive4elements.artifacts.Artifact; |
|
13 import org.dive4elements.artifacts.CallContext; |
|
14 import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator; |
|
15 import org.dive4elements.river.artifacts.D4EArtifact; |
|
16 import org.dive4elements.river.artifacts.access.RangeAccess; |
|
17 import org.dive4elements.river.artifacts.states.DefaultState; |
|
18 import org.w3c.dom.Element; |
|
19 |
|
20 /** |
|
21 * @author Domenico Nardi Tironi |
|
22 */ |
|
23 public class SupraRegionalTableState extends DefaultState { |
|
24 |
|
25 private static final long serialVersionUID = 1L; |
|
26 |
|
27 @Override |
|
28 protected String getUIProvider() { |
|
29 return "uinfo.salix.supraregional.table"; |
|
30 } |
|
31 |
|
32 @Override |
|
33 protected Element[] createItems(final ElementCreator cr, final Artifact artifact, final String name, final CallContext context) { |
|
34 final String datakey = "supraregional_table"; |
|
35 if (name.equals(datakey)) { |
|
36 |
|
37 final D4EArtifact flys = (D4EArtifact) artifact; |
|
38 final String s = flys.getDataAsString(datakey); |
|
39 |
|
40 final RangeAccess ra = new RangeAccess((D4EArtifact) artifact); |
|
41 |
|
42 final Element item = createItem(cr, new String[] { "salix_zones", s }); |
|
43 final Element min = createItem(cr, new String[] { "salix_zones_min", new Double(ra.getFrom()).toString() }); |
|
44 |
|
45 final Element max = createItem(cr, new String[] { "salix_zones_max", new Double(ra.getTo()).toString() }); |
|
46 |
|
47 return new Element[] { min, max, item }; |
|
48 |
|
49 } |
|
50 |
|
51 return new Element[] {}; |
|
52 } |
|
53 |
|
54 } |