Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/states/RiverSelect.java @ 9801:1d7a72a50183 3.2.x tip
Assume Compose V2, consistently
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 23 Nov 2023 10:14:13 +0100 |
parents | 0a5239a1e46e |
children |
rev | line source |
---|---|
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
2 * Software engineering by Intevation GmbH |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
3 * |
5994
af13ceeba52a
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5867
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
5994
af13ceeba52a
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5867
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
7 */ |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
8 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4049
diff
changeset
|
9 package org.dive4elements.river.artifacts.states; |
109
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
115
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
11 import java.util.List; |
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
12 |
9726 | 13 import org.apache.logging.log4j.Logger; |
14 import org.apache.logging.log4j.LogManager; | |
109
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 |
115
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
16 import org.w3c.dom.Element; |
109
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 import org.w3c.dom.Node; |
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4049
diff
changeset
|
19 import org.dive4elements.artifacts.Artifact; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4049
diff
changeset
|
20 import org.dive4elements.artifacts.CallContext; |
115
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
21 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4049
diff
changeset
|
22 import org.dive4elements.artifacts.common.utils.XMLUtils; |
109
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4049
diff
changeset
|
24 import org.dive4elements.artifactdatabase.ProtocolUtils; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4049
diff
changeset
|
25 import org.dive4elements.artifactdatabase.data.StateData; |
132
8be4a837f20a
Added support for the flys backend and an example how to use it.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
126
diff
changeset
|
26 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4049
diff
changeset
|
27 import org.dive4elements.river.model.River; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4049
diff
changeset
|
28 |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
29 import org.dive4elements.river.artifacts.D4EArtifact; |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4049
diff
changeset
|
30 import org.dive4elements.river.artifacts.model.RiverFactory; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4049
diff
changeset
|
31 import org.dive4elements.river.artifacts.resources.Resources; |
115
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
32 |
109
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 |
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 /** |
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 */ |
126
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
116
diff
changeset
|
37 public class RiverSelect extends DefaultState { |
109
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7754
diff
changeset
|
39 /** The log used in this class. */ |
9726 | 40 private static Logger log = LogManager.getLogger(RiverSelect.class); |
109
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 |
324
cd9e397cc2a8
The inserted river is validated in the feed operation().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
42 /** Error message that is thrown if no river was found based on a given |
cd9e397cc2a8
The inserted river is validated in the feed operation().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
43 * name.*/ |
cd9e397cc2a8
The inserted river is validated in the feed operation().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
44 public static final String ERROR_NO_SUCH_RIVER = |
cd9e397cc2a8
The inserted river is validated in the feed operation().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
45 "error_feed_no_such_river"; |
cd9e397cc2a8
The inserted river is validated in the feed operation().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
46 |
cd9e397cc2a8
The inserted river is validated in the feed operation().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
47 /** Error message that is thrown if no river was found based on a given |
cd9e397cc2a8
The inserted river is validated in the feed operation().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
48 * name.*/ |
cd9e397cc2a8
The inserted river is validated in the feed operation().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
49 public static final String ERROR_NO_RIVER_SELECTED = |
cd9e397cc2a8
The inserted river is validated in the feed operation().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
50 "error_feed_no_river_selected"; |
cd9e397cc2a8
The inserted river is validated in the feed operation().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
51 |
cd9e397cc2a8
The inserted river is validated in the feed operation().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
52 |
109
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 /** |
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 * The default constructor that initializes an empty State object. |
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 */ |
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 public RiverSelect() { |
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 } |
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 |
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 |
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 /** |
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 * Initialize the state based on the state node in the configuration. |
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 * |
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 * @param config The state configuration node. |
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 */ |
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 public void setup(Node config) { |
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 super.setup(config); |
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 } |
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 |
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 |
126
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
116
diff
changeset
|
70 protected Element createData( |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
116
diff
changeset
|
71 XMLUtils.ElementCreator cr, |
313
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
72 Artifact artifact, |
126
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
116
diff
changeset
|
73 StateData data, |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
116
diff
changeset
|
74 CallContext context) |
109
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 { |
126
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
116
diff
changeset
|
76 Element select = ProtocolUtils.createArtNode( |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
116
diff
changeset
|
77 cr, "select", |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
116
diff
changeset
|
78 new String[] { "uiprovider" }, |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
116
diff
changeset
|
79 new String[] { "select_with_map" }); |
304
992afc0299cd
Bugfix: Repaired the dynamic UI part of the RiverSelect state in DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
80 cr.addAttr(select, "name", data.getName(), true); |
115
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
81 |
126
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
116
diff
changeset
|
82 Element label = ProtocolUtils.createArtNode( |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
116
diff
changeset
|
83 cr, "label", null, null); |
115
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
84 |
4049
8e66293c5369
Removed dead code
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3650
diff
changeset
|
85 |
8e66293c5369
Removed dead code
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3650
diff
changeset
|
86 // XXX: DEAD CODE |
8e66293c5369
Removed dead code
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3650
diff
changeset
|
87 /* |
126
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
116
diff
changeset
|
88 Element choices = ProtocolUtils.createArtNode( |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
116
diff
changeset
|
89 cr, "choices", null, null); |
4049
8e66293c5369
Removed dead code
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3650
diff
changeset
|
90 */ |
115
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
91 |
304
992afc0299cd
Bugfix: Repaired the dynamic UI part of the RiverSelect state in DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
92 select.appendChild(label); |
992afc0299cd
Bugfix: Repaired the dynamic UI part of the RiverSelect state in DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
132
diff
changeset
|
93 |
126
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
116
diff
changeset
|
94 label.setTextContent(Resources.getMsg( |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
116
diff
changeset
|
95 context.getMeta(), |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
116
diff
changeset
|
96 getID(), |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
116
diff
changeset
|
97 getID())); |
115
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
98 |
126
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
116
diff
changeset
|
99 return select; |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
116
diff
changeset
|
100 } |
115
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
101 |
126
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
116
diff
changeset
|
102 |
660
627be3ca1ab6
code clean up in states
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
624
diff
changeset
|
103 @Override |
126
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
116
diff
changeset
|
104 protected Element[] createItems( |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
116
diff
changeset
|
105 XMLUtils.ElementCreator cr, |
313
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
304
diff
changeset
|
106 Artifact artifact, |
126
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
116
diff
changeset
|
107 String name, |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
116
diff
changeset
|
108 CallContext context) |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
116
diff
changeset
|
109 { |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
116
diff
changeset
|
110 List<River> rivers = RiverFactory.getRivers(); |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
116
diff
changeset
|
111 Element[] items = new Element[rivers.size()]; |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
116
diff
changeset
|
112 |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
116
diff
changeset
|
113 int idx = 0; |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
116
diff
changeset
|
114 for (River river: rivers) { |
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
116
diff
changeset
|
115 items[idx++] = createRiverItem(cr, river); |
115
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
116 } |
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
117 |
126
b18aebd1342f
Added an abstract base class DefaultState for States.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
116
diff
changeset
|
118 return items; |
115
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
119 } |
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
120 |
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
121 |
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
122 /** |
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
123 * This method creates a node that represents a river item. This node |
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
124 * contains the label and the value that describe the river. |
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
125 * |
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
126 * @param cr The ElementCreator. |
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
127 * @param river The river. |
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
128 * |
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
129 * @return the element that contains the information about the river. |
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
130 */ |
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
131 protected Element createRiverItem(XMLUtils.ElementCreator cr, River river) { |
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
132 Element item = ProtocolUtils.createArtNode(cr, "item", null, null); |
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
133 Element label = ProtocolUtils.createArtNode(cr, "label", null, null); |
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
134 Element value = ProtocolUtils.createArtNode(cr, "value", null, null); |
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
135 |
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
136 label.setTextContent(river.getName()); |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7754
diff
changeset
|
137 log.debug("model uuid: " + river.getModelUuid()); |
7754
9aa0bd26ce7f
Replaced river name with model_uuid as value in RiverSelect state.
Raimund Renkert <rrenkert@intevation.de>
parents:
5994
diff
changeset
|
138 value.setTextContent(river.getModelUuid()); |
115
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
139 |
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
140 item.appendChild(label); |
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
141 item.appendChild(value); |
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
142 |
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
143 return item; |
109
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
144 } |
324
cd9e397cc2a8
The inserted river is validated in the feed operation().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
145 |
cd9e397cc2a8
The inserted river is validated in the feed operation().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
146 |
cd9e397cc2a8
The inserted river is validated in the feed operation().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
147 @Override |
1050
eccf966fb677
State engine: Removed CallContext from state validation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
660
diff
changeset
|
148 public boolean validate(Artifact artifact) |
324
cd9e397cc2a8
The inserted river is validated in the feed operation().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
149 throws IllegalArgumentException |
cd9e397cc2a8
The inserted river is validated in the feed operation().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
150 { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7754
diff
changeset
|
151 log.debug("RiverSelect.validate"); |
324
cd9e397cc2a8
The inserted river is validated in the feed operation().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
152 |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
153 D4EArtifact flys = (D4EArtifact) artifact; |
324
cd9e397cc2a8
The inserted river is validated in the feed operation().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
154 |
624
929137ee8154
ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
424
diff
changeset
|
155 StateData dRiver = getData(flys, "river"); |
324
cd9e397cc2a8
The inserted river is validated in the feed operation().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
156 |
cd9e397cc2a8
The inserted river is validated in the feed operation().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
157 if (dRiver == null || dRiver.getValue() == null) { |
cd9e397cc2a8
The inserted river is validated in the feed operation().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
158 throw new IllegalArgumentException(ERROR_NO_RIVER_SELECTED); |
cd9e397cc2a8
The inserted river is validated in the feed operation().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
159 } |
cd9e397cc2a8
The inserted river is validated in the feed operation().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
160 |
cd9e397cc2a8
The inserted river is validated in the feed operation().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
161 River river = RiverFactory.getRiver((String) dRiver.getValue()); |
cd9e397cc2a8
The inserted river is validated in the feed operation().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
162 |
cd9e397cc2a8
The inserted river is validated in the feed operation().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
163 if (river == null) { |
cd9e397cc2a8
The inserted river is validated in the feed operation().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
164 throw new IllegalArgumentException(ERROR_NO_SUCH_RIVER); |
cd9e397cc2a8
The inserted river is validated in the feed operation().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
165 } |
cd9e397cc2a8
The inserted river is validated in the feed operation().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
166 |
cd9e397cc2a8
The inserted river is validated in the feed operation().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
167 return true; |
cd9e397cc2a8
The inserted river is validated in the feed operation().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
168 } |
424
82bd39f27569
ISSUE-37 The river state wants to be rendered using a river_panel UI provider.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
343
diff
changeset
|
169 |
82bd39f27569
ISSUE-37 The river state wants to be rendered using a river_panel UI provider.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
343
diff
changeset
|
170 |
82bd39f27569
ISSUE-37 The river state wants to be rendered using a river_panel UI provider.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
343
diff
changeset
|
171 @Override |
82bd39f27569
ISSUE-37 The river state wants to be rendered using a river_panel UI provider.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
343
diff
changeset
|
172 protected String getUIProvider() { |
82bd39f27569
ISSUE-37 The river state wants to be rendered using a river_panel UI provider.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
343
diff
changeset
|
173 return "river_panel"; |
82bd39f27569
ISSUE-37 The river state wants to be rendered using a river_panel UI provider.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
343
diff
changeset
|
174 } |
109
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
175 } |
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
176 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |