comparison artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/CalculationSelectBundu.java @ 9072:02739b8c010d

bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
author gernotbelger
date Wed, 16 May 2018 17:43:47 +0200
parents
children
comparison
equal deleted inserted replaced
9071:a561b882436d 9072:02739b8c010d
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.bundu;
11
12 import java.util.ArrayList;
13 import java.util.Collection;
14
15 import org.apache.log4j.Logger;
16 import org.dive4elements.artifacts.Artifact;
17 import org.dive4elements.artifacts.CallContext;
18 import org.dive4elements.artifacts.CallMeta;
19 import org.dive4elements.artifacts.common.utils.XMLUtils;
20 import org.dive4elements.river.artifacts.resources.Resources;
21 import org.dive4elements.river.artifacts.states.DefaultState;
22 import org.w3c.dom.Element;
23
24 /**
25 * @author Gernot Belger
26 */
27 public class CalculationSelectBundu extends DefaultState {
28
29 private static final long serialVersionUID = 1L;
30
31 /** The log that is used in this class. */
32 private static Logger log = Logger.getLogger(CalculationSelectBundu.class);
33
34 @Override
35 protected Element[] createItems(final XMLUtils.ElementCreator cr, final Artifact artifact, final String name, final CallContext context) {
36 final CallMeta meta = context.getMeta();
37
38 final Collection<Element> calcs = new ArrayList<>(BunduCalcMode.values().length);
39
40 for (final BunduCalcMode calcMode : BunduCalcMode.values()) {
41 final String calc = calcMode.name();
42
43 final String label = Resources.getMsg(meta, calc, calc);
44
45 final Element element = createItem(cr, new String[] { label, calc });
46 calcs.add(element);
47 }
48
49 return calcs.toArray(new Element[calcs.size()]);
50 }
51
52 @Override
53 public boolean validate(final Artifact artifact) throws IllegalArgumentException {
54 log.debug("CalculationSelect.validate");
55
56 final BUNDUArtifact m_artifact = (BUNDUArtifact) artifact;
57 /* throws an exception if calculation mode is invalid */
58 m_artifact.getCalculationMode();
59 return true;
60 }
61 }

http://dive4elements.wald.intevation.org