Mercurial > dive4elements > river
annotate flys-client/src/main/java/org/dive4elements/river/client/client/ui/chart/ManualWSPEditor.java @ 5834:f507086aa94b
Repaired internal references.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 25 Apr 2013 12:31:32 +0200 |
parents | flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ManualWSPEditor.java@bbd82bd8e541 |
children | 821a02bbfb4e |
rev | line source |
---|---|
2925
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.client.ui.chart; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
2 |
2939
8e6b1df7c3b0
Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2937
diff
changeset
|
3 import com.google.gwt.core.client.GWT; |
8e6b1df7c3b0
Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2937
diff
changeset
|
4 import com.google.gwt.i18n.client.NumberFormat; |
2925
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
5 import com.google.gwt.json.client.JSONArray; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
6 import com.google.gwt.json.client.JSONNumber; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
7 import com.google.gwt.json.client.JSONParser; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
8 import com.google.gwt.json.client.JSONString; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
9 import com.google.gwt.user.client.rpc.AsyncCallback; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
10 |
2939
8e6b1df7c3b0
Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2937
diff
changeset
|
11 import com.smartgwt.client.types.Alignment; |
2925
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
12 import com.smartgwt.client.util.SC; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
13 import com.smartgwt.client.widgets.Button; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
14 import com.smartgwt.client.widgets.Label; |
2939
8e6b1df7c3b0
Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2937
diff
changeset
|
15 import com.smartgwt.client.widgets.Window; |
2925
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
16 import com.smartgwt.client.widgets.events.ClickEvent; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
17 import com.smartgwt.client.widgets.events.ClickHandler; |
2939
8e6b1df7c3b0
Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2937
diff
changeset
|
18 import com.smartgwt.client.widgets.form.DynamicForm; |
8e6b1df7c3b0
Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2937
diff
changeset
|
19 import com.smartgwt.client.widgets.form.fields.TextItem; |
8e6b1df7c3b0
Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2937
diff
changeset
|
20 import com.smartgwt.client.widgets.form.fields.events.BlurEvent; |
8e6b1df7c3b0
Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2937
diff
changeset
|
21 import com.smartgwt.client.widgets.form.fields.events.BlurHandler; |
8e6b1df7c3b0
Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2937
diff
changeset
|
22 import com.smartgwt.client.widgets.layout.HLayout; |
8e6b1df7c3b0
Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2937
diff
changeset
|
23 import com.smartgwt.client.widgets.layout.VLayout; |
2925
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
24 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
25 import de.intevation.flys.client.client.Config; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
26 import de.intevation.flys.client.client.FLYSConstants; |
2939
8e6b1df7c3b0
Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2937
diff
changeset
|
27 import de.intevation.flys.client.client.event.RedrawRequestEvent; |
8e6b1df7c3b0
Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2937
diff
changeset
|
28 import de.intevation.flys.client.client.event.RedrawRequestHandler; |
8e6b1df7c3b0
Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2937
diff
changeset
|
29 import de.intevation.flys.client.client.services.FeedServiceAsync; |
8e6b1df7c3b0
Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2937
diff
changeset
|
30 import de.intevation.flys.client.client.services.LoadArtifactServiceAsync; |
8e6b1df7c3b0
Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2937
diff
changeset
|
31 import de.intevation.flys.client.client.utils.DoubleValidator; |
8e6b1df7c3b0
Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2937
diff
changeset
|
32 import de.intevation.flys.client.shared.model.Artifact; |
2925
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
33 import de.intevation.flys.client.shared.model.Collection; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
34 import de.intevation.flys.client.shared.model.CollectionItem; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
35 import de.intevation.flys.client.shared.model.Data; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
36 import de.intevation.flys.client.shared.model.DefaultArtifact; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
37 import de.intevation.flys.client.shared.model.DefaultData; |
2939
8e6b1df7c3b0
Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2937
diff
changeset
|
38 import de.intevation.flys.client.shared.model.Property; |
8e6b1df7c3b0
Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2937
diff
changeset
|
39 import de.intevation.flys.client.shared.model.PropertyGroup; |
2925
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
40 import de.intevation.flys.client.shared.model.Recommendation; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
41 import de.intevation.flys.client.shared.model.Settings; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
42 import de.intevation.flys.client.shared.model.StringProperty; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
43 |
2939
8e6b1df7c3b0
Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2937
diff
changeset
|
44 import java.util.List; |
8e6b1df7c3b0
Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2937
diff
changeset
|
45 import java.util.Map; |
2925
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
46 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
47 /** |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
48 * UI to enter point data and save it to an PointArtifact. |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
49 */ |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
50 public class ManualWSPEditor |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
51 extends Window |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
52 implements ClickHandler |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
53 { |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
54 /** The interface that provides i18n messages. */ |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
55 protected FLYSConstants MSG = GWT.create(FLYSConstants.class); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
56 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
57 /** Name of the main data item to be fed. */ |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
58 public static final String LINE_DATA = "manualpoints.lines"; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
59 |
4568
bbd82bd8e541
flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents:
3354
diff
changeset
|
60 /** When we change something, we need a RedrawRequest(Handler). */ |
2925
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
61 protected RedrawRequestHandler redrawRequestHandler; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
62 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
63 /** The collection */ |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
64 protected Collection collection; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
65 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
66 /** Service handle to clone and add artifacts to collection. */ |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
67 LoadArtifactServiceAsync loadArtifactService = GWT.create( |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
68 de.intevation.flys.client.client.services.LoadArtifactService.class); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
69 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
70 /** Service to feed the artifact with new point-data. */ |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
71 FeedServiceAsync feedService = GWT.create( |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
72 de.intevation.flys.client.client.services.FeedService.class); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
73 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
74 /** UUID of artifact to feed. */ |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
75 protected String uuid; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
76 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
77 /** Name of the outputmode, important when feeding data. */ |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
78 protected String outputModeName; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
79 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
80 /** Name of the data item for lines in this context. */ |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
81 protected String dataItemName; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
82 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
83 /** Input Field for y-coor of line. */ |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
84 protected TextItem valueInputPanel; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
85 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
86 /** Input Field for name of line. */ |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
87 protected TextItem nameInputPanel; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
88 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
89 /** Line data that is not added in this session. */ |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
90 protected JSONArray oldLines = null; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
91 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
92 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
93 /** |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
94 * Setup editor dialog. |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
95 * @param collection The collection to use. |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
96 */ |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
97 public ManualWSPEditor(Collection collection, |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
98 RedrawRequestHandler handler, String outputModeName |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
99 ) { |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
100 this.collection = collection; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
101 this.redrawRequestHandler = handler; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
102 this.outputModeName = outputModeName; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
103 this.dataItemName = outputModeName + "." + LINE_DATA; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
104 init(); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
105 } |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
106 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
107 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
108 /** Searches collection for first artifact to serve (manual) line data. */ |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
109 public String findManualPointsUUID() { |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
110 int size = collection.getItemLength(); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
111 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
112 for (int i = 0; i < size; i++) { |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
113 CollectionItem item = collection.getItem(i); |
4568
bbd82bd8e541
flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents:
3354
diff
changeset
|
114 String dataValue = item.getData().get(dataItemName); |
2925
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
115 if (dataValue != null) { |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
116 // Found it. |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
117 uuid = item.identifier(); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
118 return uuid; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
119 } |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
120 } |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
121 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
122 return null; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
123 } |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
124 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
125 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
126 /** |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
127 * Initialize the editor window and its components. |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
128 */ |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
129 protected void init() { |
2927
f978058dc835
Nicen Manual WSP editor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2925
diff
changeset
|
130 setTitle(MSG.addWSP()); |
2925
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
131 setCanDragReposition(true); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
132 setCanDragResize(true); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
133 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
134 if(findManualPointsUUID() == null) { |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
135 addArtifactCreateUI(); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
136 } |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
137 else { |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
138 createUI(); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
139 } |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
140 } |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
141 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
142 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
143 /** Create and setup/add the ui. */ |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
144 public void createUI() { |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
145 Button accept = new Button(MSG.label_ok()); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
146 Button cancel = new Button(MSG.label_cancel()); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
147 cancel.addClickHandler(this); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
148 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
149 accept.addClickHandler(new ClickHandler() { |
4568
bbd82bd8e541
flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents:
3354
diff
changeset
|
150 @Override |
2925
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
151 public void onClick(ClickEvent e) { |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
152 okClicked(); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
153 } |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
154 }); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
155 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
156 HLayout buttons = new HLayout(); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
157 buttons.addMember(accept); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
158 buttons.addMember(cancel); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
159 buttons.setAlign(Alignment.CENTER); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
160 buttons.setHeight(30); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
161 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
162 // Use X and Y as default fallback. |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
163 String yAxis = "Y"; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
164 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
165 // Get header text from collection settings. |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
166 Settings settings = this.collection.getSettings(outputModeName); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
167 List<Property> axes = settings.getSettings("axes"); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
168 if(axes != null) { |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
169 for (Property p: axes) { |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
170 PropertyGroup pg = (PropertyGroup)p; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
171 StringProperty id = |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
172 (StringProperty)pg.getPropertyByName("id"); |
2927
f978058dc835
Nicen Manual WSP editor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2925
diff
changeset
|
173 if (id.getValue().equals("W")) { |
2925
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
174 StringProperty name = |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
175 (StringProperty)pg.getPropertyByName("label"); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
176 yAxis = name.getValue(); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
177 } |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
178 } |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
179 } |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
180 |
2927
f978058dc835
Nicen Manual WSP editor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2925
diff
changeset
|
181 DynamicForm form = new DynamicForm(); |
f978058dc835
Nicen Manual WSP editor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2925
diff
changeset
|
182 valueInputPanel = new TextItem(); |
f978058dc835
Nicen Manual WSP editor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2925
diff
changeset
|
183 valueInputPanel.setTitle(yAxis); |
f978058dc835
Nicen Manual WSP editor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2925
diff
changeset
|
184 valueInputPanel.setShowTitle(true); |
2928
f0c7c52203c0
Minor Manual WSP editor polish.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2927
diff
changeset
|
185 valueInputPanel.addBlurHandler(new BlurHandler() { |
4568
bbd82bd8e541
flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents:
3354
diff
changeset
|
186 @Override |
2928
f0c7c52203c0
Minor Manual WSP editor polish.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2927
diff
changeset
|
187 public void onBlur(BlurEvent e) { |
f0c7c52203c0
Minor Manual WSP editor polish.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2927
diff
changeset
|
188 DoubleValidator validator = new DoubleValidator(); |
f0c7c52203c0
Minor Manual WSP editor polish.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2927
diff
changeset
|
189 Map errors = e.getForm().getErrors(); |
3354
22f39c2d7a72
Cosmetic compression.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2939
diff
changeset
|
190 validator.validate(e.getItem(), errors); |
22f39c2d7a72
Cosmetic compression.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2939
diff
changeset
|
191 e.getForm().setErrors(errors, true); |
2928
f0c7c52203c0
Minor Manual WSP editor polish.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2927
diff
changeset
|
192 } |
f0c7c52203c0
Minor Manual WSP editor polish.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2927
diff
changeset
|
193 }); |
2927
f978058dc835
Nicen Manual WSP editor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2925
diff
changeset
|
194 nameInputPanel = new TextItem(); |
f978058dc835
Nicen Manual WSP editor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2925
diff
changeset
|
195 nameInputPanel.setTitle(MSG.pointname()); |
f978058dc835
Nicen Manual WSP editor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2925
diff
changeset
|
196 nameInputPanel.setShowTitle(true); |
f978058dc835
Nicen Manual WSP editor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2925
diff
changeset
|
197 form.setFields(valueInputPanel, nameInputPanel); |
f978058dc835
Nicen Manual WSP editor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2925
diff
changeset
|
198 |
f978058dc835
Nicen Manual WSP editor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2925
diff
changeset
|
199 VLayout layout = new VLayout(); |
f978058dc835
Nicen Manual WSP editor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2925
diff
changeset
|
200 layout.addMember(form); |
2925
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
201 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
202 // Find the artifacts uuid. |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
203 // TODO this has been called already, why call it again? |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
204 findManualPointsUUID(); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
205 CollectionItem item = collection.getItem(uuid); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
206 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
207 // Store the old line data. |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
208 if (item != null) { |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
209 String jsonData = item.getData().get(dataItemName); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
210 oldLines = (JSONArray) JSONParser.parse(jsonData); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
211 } |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
212 else { |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
213 GWT.log("No old lines found for " + uuid); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
214 } |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
215 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
216 addItem(layout); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
217 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
218 addItem(buttons); |
2927
f978058dc835
Nicen Manual WSP editor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2925
diff
changeset
|
219 setWidth(360); |
f978058dc835
Nicen Manual WSP editor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2925
diff
changeset
|
220 setHeight(120); |
2925
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
221 centerInPage(); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
222 } |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
223 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
224 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
225 /** |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
226 * Create JSON representation of the points present in the form. |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
227 * Add old data, too. |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
228 * @return a jsonarray with the old and the new lines. |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
229 */ |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
230 protected JSONArray jsonArrayFromForm() { |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
231 if (oldLines == null) { |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
232 oldLines = new JSONArray(); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
233 } |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
234 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
235 double val; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
236 if (valueInputPanel.getValue() == null) |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
237 return oldLines; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
238 try { |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
239 NumberFormat nf = NumberFormat.getDecimalFormat(); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
240 double d = nf.parse(valueInputPanel.getValue().toString()); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
241 val = d; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
242 } |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
243 catch(NumberFormatException nfe) { |
4568
bbd82bd8e541
flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents:
3354
diff
changeset
|
244 GWT.log("fehler... nfe... TODO"); |
2925
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
245 return oldLines; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
246 } |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
247 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
248 JSONArray data = new JSONArray(); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
249 data.set(0, new JSONNumber(val)); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
250 if (nameInputPanel.getValue() == null) { |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
251 data.set(1, new JSONString(valueInputPanel.getValue().toString())); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
252 } |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
253 else { |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
254 data.set(1, new JSONString(nameInputPanel.getValue().toString())); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
255 } |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
256 oldLines.set(oldLines.size(), data); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
257 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
258 return oldLines; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
259 } |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
260 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
261 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
262 /** |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
263 * Called when OK Button was clicked. Then, if entered values are valid, |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
264 * fire a RedrawRequest and destroy. |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
265 */ |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
266 protected void okClicked() { |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
267 if (valueInputPanel.getValue() == null) { |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
268 return; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
269 } |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
270 GWT.log(valueInputPanel.getValue().toString()); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
271 if(isDialogValid()) { |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
272 // Feed JSON-encoded content of form. |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
273 JSONArray list = jsonArrayFromForm(); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
274 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
275 Data[] feedData = new Data[] { |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
276 DefaultData.createSimpleStringData(dataItemName, |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
277 list.toString()) |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
278 }; |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
279 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
280 feedService.feed( |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
281 Config.getInstance().getLocale(), |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
282 new DefaultArtifact(uuid, "TODO:hash"), |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
283 feedData, |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
284 new AsyncCallback<Artifact>() { |
4568
bbd82bd8e541
flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents:
3354
diff
changeset
|
285 @Override |
2925
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
286 public void onFailure(Throwable caught) { |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
287 GWT.log("Could not feed artifact with lines."); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
288 SC.warn(MSG.getString(caught.getMessage())); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
289 enable(); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
290 } |
4568
bbd82bd8e541
flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents:
3354
diff
changeset
|
291 @Override |
2925
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
292 public void onSuccess(Artifact fartifact) { |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
293 GWT.log("Successfully set lines "); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
294 redrawRequestHandler.onRedrawRequest( |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
295 new RedrawRequestEvent()); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
296 destroy(); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
297 } |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
298 }); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
299 } |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
300 else { |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
301 GWT.log("Dialog not valid"); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
302 SC.warn(MSG.error_dialog_not_valid()); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
303 } |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
304 } |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
305 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
306 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
307 /** Add a ManualPointArtifact to Collection. */ |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
308 public void addArtifactCreateUI() { |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
309 final Label standByLabel = new Label(MSG.standby()); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
310 addItem(standByLabel); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
311 |
2928
f0c7c52203c0
Minor Manual WSP editor polish.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2927
diff
changeset
|
312 setWidth(360); |
f0c7c52203c0
Minor Manual WSP editor polish.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2927
diff
changeset
|
313 setHeight(120); |
2925
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
314 centerInPage(); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
315 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
316 Config config = Config.getInstance(); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
317 String locale = config.getLocale(); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
318 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
319 loadArtifactService.load( |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
320 this.collection, |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
321 new Recommendation("manualpoints", ""), |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
322 "manualpoints", |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
323 locale, |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
324 new AsyncCallback<Artifact>() { |
4568
bbd82bd8e541
flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents:
3354
diff
changeset
|
325 @Override |
2925
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
326 public void onFailure(Throwable caught) { |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
327 GWT.log("Creating manualpoint artifact failed!"); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
328 } |
4568
bbd82bd8e541
flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents:
3354
diff
changeset
|
329 @Override |
2925
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
330 public void onSuccess(Artifact artifact) { |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
331 GWT.log("Successfully created artifact."); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
332 removeItem(standByLabel); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
333 uuid = artifact.getUuid(); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
334 createUI(); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
335 } |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
336 }); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
337 } |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
338 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
339 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
340 /** |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
341 * This method is called when the user aborts point editing. |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
342 * @param event The event. |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
343 */ |
4568
bbd82bd8e541
flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents:
3354
diff
changeset
|
344 @Override |
2925
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
345 public void onClick(ClickEvent event) { |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
346 this.destroy(); |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
347 } |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
348 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
349 |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
350 /** Return false if x or y attribute is missing. */ |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
351 protected boolean isDialogValid() { |
2929
0ef4753e5515
Improved manual wsp input validation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2928
diff
changeset
|
352 return (DoubleValidator.isDouble(valueInputPanel.getValue())); |
2925
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
353 } |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
354 } |
6461b8dbe093
Added basic GUI for manual WSPs in cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
355 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |