Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/states/fixation/FunctionSelect.java @ 9274:1c8eeaf6031f
bundu.wst workflow
author | gernotbelger |
---|---|
date | Thu, 19 Jul 2018 17:33:24 +0200 |
parents | af13ceeba52a |
children |
comparison
equal
deleted
inserted
replaced
9273:1b2623dff742 | 9274:1c8eeaf6031f |
---|---|
8 | 8 |
9 package org.dive4elements.river.artifacts.states.fixation; | 9 package org.dive4elements.river.artifacts.states.fixation; |
10 | 10 |
11 import java.util.Collection; | 11 import java.util.Collection; |
12 | 12 |
13 import org.w3c.dom.Element; | 13 import org.dive4elements.artifactdatabase.data.StateData; |
14 | |
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; | 16 import org.dive4elements.artifacts.common.utils.XMLUtils; |
17 import org.dive4elements.river.artifacts.bundu.BUNDUArtifact; | |
18 import org.dive4elements.river.artifacts.math.fitting.Function; | 18 import org.dive4elements.river.artifacts.math.fitting.Function; |
19 import org.dive4elements.river.artifacts.math.fitting.FunctionFactory; | 19 import org.dive4elements.river.artifacts.math.fitting.FunctionFactory; |
20 import org.dive4elements.river.artifacts.states.DefaultState; | 20 import org.dive4elements.river.artifacts.states.DefaultState; |
21 import org.dive4elements.river.artifacts.uinfo.salix.ScenarioTypeState; | |
22 import org.w3c.dom.Element; | |
21 | 23 |
22 /** | 24 /** |
23 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> | 25 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> |
24 */ | 26 */ |
25 public class FunctionSelect extends DefaultState { | 27 public class FunctionSelect extends DefaultState { |
34 public String getUIProvider() { | 36 public String getUIProvider() { |
35 return "fix.functionselect"; | 37 return "fix.functionselect"; |
36 } | 38 } |
37 | 39 |
38 @Override | 40 @Override |
39 protected Element[] createItems( | 41 protected Element[] createItems(final XMLUtils.ElementCreator ec, final Artifact artifact, final String name, final CallContext context) { |
40 XMLUtils.ElementCreator ec, | 42 final FunctionFactory ff = FunctionFactory.getInstance(); |
41 Artifact artifact, | 43 final Collection<Function> fc = ff.getFunctions(); |
42 String name, | 44 final Element[] functions = new Element[fc.size()]; |
43 CallContext context) | |
44 { | |
45 FunctionFactory ff = FunctionFactory.getInstance(); | |
46 Collection<Function> fc = ff.getFunctions(); | |
47 Element[] functions = new Element[fc.size()]; | |
48 | 45 |
49 int j = 0; | 46 int j = 0; |
50 for (Function f: fc) { | 47 for (final Function f : fc) { |
51 String n = f.getName(); | 48 final String n = f.getName(); |
52 String d = f.getDescription(); | 49 final String d = f.getDescription(); |
53 functions[j] = createItem(ec, new String[] {d, n}); | 50 functions[j] = createItem(ec, new String[] { d, n }); |
54 j++; | 51 j++; |
55 } | 52 } |
56 | 53 |
57 return functions; | 54 return functions; |
58 } | 55 } |
56 | |
57 @Override | |
58 protected Element createData(final XMLUtils.ElementCreator cr, final Artifact artifact, final StateData data, final CallContext context) { | |
59 if (artifact instanceof BUNDUArtifact) { | |
60 if (((BUNDUArtifact) artifact).getCurrentStateId().equals("state.bundu.wst.load.function")) { | |
61 return ScenarioTypeState.changeHeaderForCurrentState("state.bundu.wst.function", data.getName(), cr, context); | |
62 } | |
63 | |
64 } | |
65 return super.createData(cr, artifact, data, context); | |
66 } | |
59 } | 67 } |
60 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : | 68 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |