Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ManualPointsEditor.java @ 2462:d45059aa8507
i18n and moved reference selectbox for cross section master to top.
flys-client/trunk@4168 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 20 Mar 2012 11:08:20 +0000 |
parents | 4e81439ffa28 |
children | cef4c624c68c |
rev | line source |
---|---|
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.client.ui.chart; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
2 |
1569
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
3 import java.util.List; |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
4 |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
5 import com.google.gwt.json.client.JSONArray; |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
6 import com.google.gwt.json.client.JSONBoolean; |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
7 import com.google.gwt.json.client.JSONNumber; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
8 import com.google.gwt.json.client.JSONParser; |
1553
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
9 import com.google.gwt.json.client.JSONString; |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
10 import com.google.gwt.core.client.GWT; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
11 import com.google.gwt.user.client.rpc.AsyncCallback; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
12 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
13 import com.smartgwt.client.util.SC; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
14 import com.smartgwt.client.widgets.Window; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
15 import com.smartgwt.client.widgets.layout.VLayout; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
16 import com.smartgwt.client.widgets.layout.HLayout; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
17 import com.smartgwt.client.widgets.IButton; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
18 import com.smartgwt.client.widgets.Button; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
19 import com.smartgwt.client.widgets.Label; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
20 import com.smartgwt.client.widgets.grid.ListGrid; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
21 import com.smartgwt.client.widgets.grid.ListGridField; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
22 import com.smartgwt.client.widgets.grid.ListGridRecord; |
1561
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
23 import com.smartgwt.client.widgets.grid.events.RecordClickEvent; |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
24 import com.smartgwt.client.widgets.grid.events.RecordClickHandler; |
1553
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
25 import com.smartgwt.client.types.ListGridFieldType; |
1562
af29d43cf4da
Added basic validation, improved editing function, minor refac.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1561
diff
changeset
|
26 import com.smartgwt.client.widgets.grid.CellFormatter; |
af29d43cf4da
Added basic validation, improved editing function, minor refac.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1561
diff
changeset
|
27 import com.google.gwt.i18n.client.NumberFormat; |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
28 |
1604
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
29 import com.smartgwt.client.widgets.grid.CellEditValueParser; |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
30 import com.smartgwt.client.widgets.grid.CellEditValueFormatter; |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
31 import com.smartgwt.client.widgets.events.ClickEvent; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
32 import com.smartgwt.client.widgets.events.ClickHandler; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
33 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
34 import com.smartgwt.client.types.Alignment; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
35 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
36 import de.intevation.flys.client.shared.model.Artifact; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
37 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
38 import de.intevation.flys.client.client.Config; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
39 import de.intevation.flys.client.client.FLYSConstants; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
40 import de.intevation.flys.client.shared.model.Collection; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
41 import de.intevation.flys.client.shared.model.CollectionItem; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
42 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
43 import de.intevation.flys.client.client.services.LoadArtifactService; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
44 import de.intevation.flys.client.client.services.LoadArtifactServiceAsync; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
45 import de.intevation.flys.client.client.services.FeedService; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
46 import de.intevation.flys.client.client.services.FeedServiceAsync; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
47 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
48 import de.intevation.flys.client.shared.model.Data; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
49 import de.intevation.flys.client.shared.model.DefaultArtifact; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
50 import de.intevation.flys.client.shared.model.DefaultData; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
51 import de.intevation.flys.client.shared.model.Recommendation; |
1569
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
52 import de.intevation.flys.client.shared.model.Settings; |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
53 import de.intevation.flys.client.shared.model.Property; |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
54 import de.intevation.flys.client.shared.model.PropertyGroup; |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
55 import de.intevation.flys.client.shared.model.StringProperty; |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
56 |
1549
42f1213dfbcc
Let ManualPointEditor use RedrawRequests to let freshly edited points show up in Chart.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1548
diff
changeset
|
57 import de.intevation.flys.client.client.event.RedrawRequestHandler; |
42f1213dfbcc
Let ManualPointEditor use RedrawRequests to let freshly edited points show up in Chart.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1548
diff
changeset
|
58 import de.intevation.flys.client.client.event.RedrawRequestEvent; |
42f1213dfbcc
Let ManualPointEditor use RedrawRequests to let freshly edited points show up in Chart.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1548
diff
changeset
|
59 |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
60 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
61 /** |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
62 * UI to enter point data and save it to an PointArtifact. |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
63 */ |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
64 public class ManualPointsEditor |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
65 extends Window |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
66 implements ClickHandler |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
67 { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
68 /** The interface that provides i18n messages. */ |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
69 protected FLYSConstants MSG = GWT.create(FLYSConstants.class); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
70 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
71 /** Name of the main data item to be fed. */ |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
72 public static final String POINT_DATA = "manualpoints.data"; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
73 // TODO with separate point sets in multiple diagrams, we might need |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
74 // different POINT_DATA-names (e.g. one per diagram). |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
75 |
1549
42f1213dfbcc
Let ManualPointEditor use RedrawRequests to let freshly edited points show up in Chart.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1548
diff
changeset
|
76 /** When we chaged something, we need a RedrawRequest(Handler). */ |
42f1213dfbcc
Let ManualPointEditor use RedrawRequests to let freshly edited points show up in Chart.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1548
diff
changeset
|
77 protected RedrawRequestHandler redrawRequestHandler; |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
78 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
79 /** The collection */ |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
80 protected Collection collection; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
81 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
82 /** The listGrid showing point entries. */ |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
83 protected ListGrid listGrid; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
84 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
85 /** Service handle to clone and add artifacts to collection. */ |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
86 LoadArtifactServiceAsync loadArtifactService = GWT.create( |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
87 de.intevation.flys.client.client.services.LoadArtifactService.class); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
88 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
89 /** Service to feed the artifact with new point-data. */ |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
90 FeedServiceAsync feedService = GWT.create( |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
91 de.intevation.flys.client.client.services.FeedService.class); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
92 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
93 /** UUID of artifact to feed. */ |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
94 protected String uuid; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
95 |
1568
2432973ccced
Handle manual points on a per-chart(type) basis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1565
diff
changeset
|
96 /** Name of the outputmode, important when feeding data. */ |
2432973ccced
Handle manual points on a per-chart(type) basis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1565
diff
changeset
|
97 protected String outputModeName; |
2432973ccced
Handle manual points on a per-chart(type) basis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1565
diff
changeset
|
98 |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
99 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
100 /** |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
101 * Setup editor dialog. |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
102 * @param collection The collection to use. |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
103 */ |
1549
42f1213dfbcc
Let ManualPointEditor use RedrawRequests to let freshly edited points show up in Chart.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1548
diff
changeset
|
104 public ManualPointsEditor(Collection collection, |
1568
2432973ccced
Handle manual points on a per-chart(type) basis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1565
diff
changeset
|
105 RedrawRequestHandler handler, String outputModeName |
1549
42f1213dfbcc
Let ManualPointEditor use RedrawRequests to let freshly edited points show up in Chart.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1548
diff
changeset
|
106 ) { |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
107 this.collection = collection; |
1549
42f1213dfbcc
Let ManualPointEditor use RedrawRequests to let freshly edited points show up in Chart.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1548
diff
changeset
|
108 this.redrawRequestHandler = handler; |
1568
2432973ccced
Handle manual points on a per-chart(type) basis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1565
diff
changeset
|
109 this.outputModeName = outputModeName; |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
110 init(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
111 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
112 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
113 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
114 /** Searches collection for first artifact to serve (manual) point data. */ |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
115 public String findManualPointsUUID() { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
116 // TODO Need to be more picky (different points in different diagrams) |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
117 int size = collection.getItemLength(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
118 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
119 for (int i = 0; i < size; i++) { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
120 CollectionItem item = collection.getItem(i); |
1568
2432973ccced
Handle manual points on a per-chart(type) basis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1565
diff
changeset
|
121 String dataValue = (String) item.getData().get(outputModeName |
2432973ccced
Handle manual points on a per-chart(type) basis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1565
diff
changeset
|
122 + "." + POINT_DATA); |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
123 if (dataValue != null) { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
124 // Found it. |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
125 uuid = item.identifier(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
126 return uuid; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
127 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
128 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
129 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
130 return null; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
131 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
132 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
133 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
134 /** |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
135 * Initialize the editor window and its components. |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
136 */ |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
137 protected void init() { |
1553
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
138 setTitle(MSG.addpoints()); |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
139 setCanDragReposition(true); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
140 setCanDragResize(true); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
141 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
142 // If no manualpoints artifact found, create it now. |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
143 if(findManualPointsUUID() == null) { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
144 addArtifactCreateUI(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
145 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
146 else { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
147 createUI(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
148 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
149 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
150 |
1547
76377fe3f0c7
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1545
diff
changeset
|
151 |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
152 /** Create and setup/add the ui. */ |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
153 public void createUI() { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
154 Config config = Config.getInstance(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
155 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
156 Button accept = new Button(MSG.label_ok()); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
157 Button cancel = new Button(MSG.label_cancel()); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
158 cancel.addClickHandler(this); |
1561
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
159 |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
160 accept.addClickHandler(new ClickHandler() { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
161 public void onClick(ClickEvent e) { |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
162 okClicked(); |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
163 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
164 }); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
165 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
166 HLayout buttons = new HLayout(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
167 buttons.addMember(accept); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
168 buttons.addMember(cancel); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
169 buttons.setAlign(Alignment.CENTER); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
170 buttons.setHeight(30); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
171 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
172 VLayout layout = new VLayout(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
173 listGrid = new ListGrid(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
174 listGrid.setWidth100(); |
1570
eeee85c4d996
Adjusted table height to fill the window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1569
diff
changeset
|
175 listGrid.setHeight("*"); |
1561
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
176 listGrid.setCanSort(false); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
177 listGrid.setCanEdit(true); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
178 listGrid.setShowHeaderContextMenu(false); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
179 |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
180 CellFormatter doubleFormat = new CellFormatter() { |
1562
af29d43cf4da
Added basic validation, improved editing function, minor refac.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1561
diff
changeset
|
181 public String format(Object value, ListGridRecord record, int rowNum, int colNum) { |
af29d43cf4da
Added basic validation, improved editing function, minor refac.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1561
diff
changeset
|
182 if(value != null) { |
1604
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
183 NumberFormat nf = NumberFormat.getDecimalFormat(); |
1562
af29d43cf4da
Added basic validation, improved editing function, minor refac.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1561
diff
changeset
|
184 try { |
1604
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
185 double d = Double.valueOf(value.toString()).doubleValue(); |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
186 return nf.format(d); |
1562
af29d43cf4da
Added basic validation, improved editing function, minor refac.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1561
diff
changeset
|
187 } catch (Exception e) { |
af29d43cf4da
Added basic validation, improved editing function, minor refac.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1561
diff
changeset
|
188 return value.toString(); |
af29d43cf4da
Added basic validation, improved editing function, minor refac.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1561
diff
changeset
|
189 } |
af29d43cf4da
Added basic validation, improved editing function, minor refac.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1561
diff
changeset
|
190 } else { |
af29d43cf4da
Added basic validation, improved editing function, minor refac.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1561
diff
changeset
|
191 return null; |
af29d43cf4da
Added basic validation, improved editing function, minor refac.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1561
diff
changeset
|
192 } |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
193 }}; |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
194 |
1604
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
195 CellEditValueParser cevp = new CellEditValueParser() { |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
196 public Object parse(Object value, ListGridRecord record, int rowNum, int colNum) { |
2461
4e81439ffa28
Fix flys/issue462
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1613
diff
changeset
|
197 if (value == null) |
4e81439ffa28
Fix flys/issue462
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1613
diff
changeset
|
198 return null; |
1604
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
199 try { |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
200 NumberFormat nf = NumberFormat.getDecimalFormat(); |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
201 double d = nf.parse(value.toString()); |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
202 return (new Double(d)).toString(); |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
203 } |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
204 catch(NumberFormatException nfe) { |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
205 return value; |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
206 } |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
207 } |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
208 }; |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
209 |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
210 CellEditValueFormatter cevf = new CellEditValueFormatter() { |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
211 public Object format(Object value, ListGridRecord record, int rowNum, int colNum) { |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
212 NumberFormat nf = NumberFormat.getDecimalFormat(); |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
213 try { |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
214 double d = Double.valueOf(value.toString()).doubleValue(); |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
215 return nf.format(d); |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
216 } |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
217 catch(NumberFormatException nfe) { |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
218 return value; |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
219 } |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
220 } |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
221 }; |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
222 |
1569
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
223 // Use X and Y as default fallback. |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
224 String xAxis = "X"; |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
225 String yAxis = "Y"; |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
226 |
1569
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
227 // Get header text from collection settings. |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
228 Settings settings = this.collection.getSettings(outputModeName); |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
229 List<Property> axes = settings.getSettings("axes"); |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
230 if(axes != null) { |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
231 for (Property p: axes) { |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
232 PropertyGroup pg = (PropertyGroup)p; |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
233 StringProperty id = |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
234 (StringProperty)pg.getPropertyByName("id"); |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
235 if(id.getValue().equals("X")) { |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
236 StringProperty name = |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
237 (StringProperty)pg.getPropertyByName("label"); |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
238 xAxis = name.getValue(); |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
239 } |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
240 else if (yAxis.equals("Y")) { |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
241 StringProperty name = |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
242 (StringProperty)pg.getPropertyByName("label"); |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
243 yAxis = name.getValue(); |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
244 } |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
245 } |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
246 } |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
247 ListGridField xField = |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
248 new ListGridField(PointRecord.ATTRIBUTE_X, xAxis); |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
249 xField.setType(ListGridFieldType.FLOAT); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
250 xField.setCellFormatter(doubleFormat); |
1604
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
251 xField.setEditValueParser(cevp); |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
252 xField.setEditValueFormatter(cevf); |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
253 |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
254 |
1569
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
255 ListGridField yField = |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
256 new ListGridField(PointRecord.ATTRIBUTE_Y, yAxis); |
1553
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
257 yField.setType(ListGridFieldType.FLOAT); |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
258 yField.setCellFormatter(doubleFormat); |
1604
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
259 yField.setEditValueParser(cevp); |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
260 yField.setEditValueFormatter(cevf); |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
261 |
1562
af29d43cf4da
Added basic validation, improved editing function, minor refac.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1561
diff
changeset
|
262 ListGridField nameField = new ListGridField(PointRecord.ATTRIBUTE_NAME, |
1553
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
263 MSG.pointname()); |
1561
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
264 final ListGridField removeField = |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
265 new ListGridField("_removeRecord", MSG.removepoint()){{ |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
266 setType(ListGridFieldType.ICON); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
267 setIcon(GWT.getHostPageBaseURL() + MSG.removeFeature()); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
268 setCanEdit(false); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
269 setCanFilter(false); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
270 setCanSort(false); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
271 setCanGroupBy(false); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
272 setCanFreeze(false); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
273 setWidth(25); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
274 }}; |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
275 |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
276 ListGridField activeField = new ListGridField( |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
277 PointRecord.ATTRIBUTE_ACTIVE, MSG.selection()); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
278 activeField.setType(ListGridFieldType.BOOLEAN); |
1564
3606f2caf93e
Make manual Points active by default.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1563
diff
changeset
|
279 activeField.setDefaultValue(true); |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
280 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
281 listGrid.setFields(new ListGridField[] {activeField, xField, yField, |
1553
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
282 nameField, removeField}); |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
283 |
1561
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
284 listGrid.addRecordClickHandler(new RecordClickHandler() { |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
285 public void onRecordClick(final RecordClickEvent event) { |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
286 // Just handle remove-clicks |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
287 if(!event.getField().getName().equals(removeField.getName())) { |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
288 return; |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
289 } |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
290 event.getViewer().removeData(event.getRecord()); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
291 } |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
292 }); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
293 |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
294 // Find the artifacts uuid. |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
295 findManualPointsUUID(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
296 CollectionItem item = collection.getItem(uuid); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
297 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
298 // Add points to grid. |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
299 if (item != null) { |
1568
2432973ccced
Handle manual points on a per-chart(type) basis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1565
diff
changeset
|
300 String jsonData = item.getData().get(outputModeName + "." + POINT_DATA); |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
301 JSONArray jsonArray = (JSONArray) JSONParser.parse(jsonData); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
302 for (int i = 0; i < jsonArray.size(); i++) { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
303 JSONArray point = (JSONArray) jsonArray.get(i); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
304 listGrid.addData(pointRecordFromJSON(point)); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
305 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
306 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
307 else { |
1553
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
308 // TODO proper log |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
309 System.out.println("No item found for " + uuid); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
310 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
311 |
1553
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
312 IButton button = new IButton(MSG.newpoint()); |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
313 button.setTop(250); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
314 button.addClickHandler(new ClickHandler() { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
315 public void onClick(ClickEvent event) { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
316 listGrid.startEditingNew(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
317 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
318 }); |
1553
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
319 |
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
320 layout.addMember(listGrid); |
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
321 layout.addMember(button); |
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
322 |
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
323 addItem(layout); |
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
324 |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
325 addItem(buttons); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
326 setWidth(380); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
327 setHeight(470); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
328 centerInPage(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
329 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
330 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
331 |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
332 /** Create JSON representation of the points present in the list grid. */ |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
333 protected JSONArray jsonArrayFromListGrid() { |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
334 JSONArray list = new JSONArray(); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
335 int idx = 0; |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
336 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
337 for(ListGridRecord record : listGrid.getRecords()) { |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
338 if (record instanceof PointRecord) { |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
339 JSONArray data = new JSONArray(); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
340 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
341 PointRecord point = (PointRecord) record; |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
342 data.set(0, new JSONNumber(point.getX())); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
343 data.set(1, new JSONNumber(point.getY())); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
344 data.set(2, new JSONString(point.getName())); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
345 data.set(3, JSONBoolean.getInstance(point.isActive())); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
346 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
347 list.set(idx, data); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
348 idx++; |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
349 } |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
350 else { |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
351 JSONArray data = new JSONArray(); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
352 |
1565
87f5ed6960e8
Improved form validation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1564
diff
changeset
|
353 String nameString = record.getAttributeAsString(PointRecord.ATTRIBUTE_NAME); |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
354 // Apply default name if none set. |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
355 if (nameString == null || nameString.equals("")) { |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
356 String xString = record.getAttributeAsString( |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
357 PointRecord.ATTRIBUTE_X); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
358 String yString = record.getAttributeAsString( |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
359 PointRecord.ATTRIBUTE_Y); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
360 nameString = xString + "/" + yString; |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
361 } |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
362 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
363 data.set(0, new JSONNumber(record. |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
364 getAttributeAsDouble(PointRecord.ATTRIBUTE_X))); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
365 data.set(1, new JSONNumber(record. |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
366 getAttributeAsDouble(PointRecord.ATTRIBUTE_Y))); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
367 data.set(2, new JSONString(nameString)); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
368 data.set(3, JSONBoolean.getInstance(record.getAttributeAsBoolean( |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
369 PointRecord.ATTRIBUTE_ACTIVE))); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
370 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
371 list.set(idx, data); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
372 idx++; |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
373 } |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
374 } |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
375 return list; |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
376 } |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
377 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
378 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
379 /** |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
380 * Called when OK Button was clicked. Then, if entered values are valid, |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
381 * fire a RedrawRequest and destroy. |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
382 */ |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
383 protected void okClicked() { |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
384 if(isDialogValid()) { |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
385 // Feed JSON-encoded content of listgrid. |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
386 JSONArray list = jsonArrayFromListGrid(); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
387 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
388 Data[] feedData = new Data[] { |
1568
2432973ccced
Handle manual points on a per-chart(type) basis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1565
diff
changeset
|
389 DefaultData.createSimpleStringData(outputModeName + "." + POINT_DATA, |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
390 list.toString()) |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
391 }; |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
392 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
393 feedService.feed( |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
394 Config.getInstance().getLocale(), |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
395 new DefaultArtifact(uuid, "TODO:hash"), |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
396 feedData, |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
397 new AsyncCallback<Artifact>() { |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
398 public void onFailure(Throwable caught) { |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
399 GWT.log("Could not feed artifact with points."); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
400 SC.warn(MSG.getString(caught.getMessage())); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
401 enable(); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
402 } |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
403 public void onSuccess(Artifact fartifact) { |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
404 GWT.log("Successfully set points "); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
405 redrawRequestHandler.onRedrawRequest( |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
406 new RedrawRequestEvent()); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
407 destroy(); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
408 } |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
409 }); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
410 } |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
411 else { |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
412 GWT.log("Dialog not valid"); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
413 SC.warn(MSG.error_dialog_not_valid()); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
414 } |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
415 } |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
416 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
417 |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
418 /** From a JSON-encoded point, create a PointRecord. */ |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
419 public PointRecord pointRecordFromJSON(JSONArray jsonArray) { |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
420 JSONNumber x = (JSONNumber) jsonArray.get(0); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
421 JSONNumber y = (JSONNumber) jsonArray.get(1); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
422 JSONString s = (JSONString) jsonArray.get(2); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
423 JSONBoolean b = (JSONBoolean) jsonArray.get(3); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
424 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
425 return new PointRecord(b.booleanValue(), x.doubleValue(), |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
426 y.doubleValue(), s.stringValue()); |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
427 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
428 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
429 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
430 /** Add a ManualPointArtifact to Collection. */ |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
431 public void addArtifactCreateUI() { |
1553
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
432 final Label standByLabel = new Label(MSG.standby()); |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
433 addItem(standByLabel); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
434 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
435 setWidth(380); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
436 setHeight(470); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
437 centerInPage(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
438 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
439 Config config = Config.getInstance(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
440 String locale = config.getLocale(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
441 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
442 loadArtifactService.load( |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
443 this.collection, |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
444 new Recommendation("manualpoints", ""), |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
445 "manualpoints", |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
446 locale, |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
447 new AsyncCallback<Artifact>() { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
448 public void onFailure(Throwable caught) { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
449 GWT.log("Creating manualpoint artifact failed!"); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
450 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
451 public void onSuccess(Artifact artifact) { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
452 GWT.log("Successfully created artifact."); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
453 removeItem(standByLabel); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
454 uuid = artifact.getUuid(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
455 createUI(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
456 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
457 }); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
458 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
459 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
460 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
461 /** |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
462 * This method is called when the user aborts point editing. |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
463 * @param event The event. |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
464 */ |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
465 public void onClick(ClickEvent event) { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
466 this.destroy(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
467 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
468 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
469 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
470 /** Simple record to store points. */ |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
471 public class PointRecord extends ListGridRecord { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
472 protected static final String ATTRIBUTE_X = "X"; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
473 protected static final String ATTRIBUTE_Y = "Y"; |
1553
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
474 protected static final String ATTRIBUTE_NAME = "name"; |
1561
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
475 protected static final String ATTRIBUTE_ACTIVE = "active"; |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
476 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
477 private PointRecord() {;} |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
478 |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
479 public PointRecord(boolean b, double x, double y, String name) { |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
480 setActive(b); |
1553
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
481 setName(name); |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
482 setX(x); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
483 setY(y); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
484 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
485 |
1561
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
486 public void setActive(boolean b) { |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
487 setAttribute(ATTRIBUTE_ACTIVE, b); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
488 } |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
489 |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
490 public boolean isActive() { |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
491 return getAttributeAsBoolean(ATTRIBUTE_ACTIVE); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
492 } |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
493 |
1553
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
494 public void setName(String name) { |
1561
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
495 setAttribute(ATTRIBUTE_NAME, name); |
1553
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
496 } |
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
497 |
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
498 public String getName() { |
1561
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
499 return getAttributeAsString(ATTRIBUTE_NAME); |
1553
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
500 } |
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
501 |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
502 public void setX(double x) { |
1561
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
503 setAttribute(ATTRIBUTE_X, x); |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
504 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
505 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
506 public void setY(double y) { |
1561
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
507 setAttribute(ATTRIBUTE_Y, y); |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
508 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
509 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
510 public double getX() { |
1561
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
511 return getAttributeAsDouble(ATTRIBUTE_X); |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
512 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
513 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
514 public double getY() { |
1561
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
515 return getAttributeAsDouble(ATTRIBUTE_Y); |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
516 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
517 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
518 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
519 |
1565
87f5ed6960e8
Improved form validation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1564
diff
changeset
|
520 /** Return false if x or y attribute is missing. */ |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
521 protected boolean isDialogValid() { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
522 boolean valid = true; |
1565
87f5ed6960e8
Improved form validation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1564
diff
changeset
|
523 for (ListGridRecord record : listGrid.getRecords()) { |
87f5ed6960e8
Improved form validation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1564
diff
changeset
|
524 if (record.getAttributeAsDouble(PointRecord.ATTRIBUTE_X) == null |
87f5ed6960e8
Improved form validation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1564
diff
changeset
|
525 || record.getAttributeAsDouble(PointRecord.ATTRIBUTE_Y) == null) { |
87f5ed6960e8
Improved form validation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1564
diff
changeset
|
526 return false; |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
527 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
528 } |
1604
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
529 if (listGrid.hasErrors()) { |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
530 valid = false; |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
531 } |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
532 return valid; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
533 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
534 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
535 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |